Repository navigation
Remove the LibTomCrypt PRNG lookups that nothing calls and the empty go.sum - #7
Merged
Merged
Conversation
crypt_find_prng.c and crypt_prng_is_valid.c define find_prng and prng_is_valid. Nothing in the package calls either: SQLCipher registers Fortuna and calls the fortuna_* functions directly, and the LibTomCrypt functions that look PRNGs up by name or index are not included. cgo compiled and linked both files into every build all the same.
The module has no dependencies, so go.sum has been empty since go-sqlite3 dropped its last requirement, and go mod tidy does not recreate it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
crypt_find_prng.candcrypt_prng_is_valid.cdefine the LibTomCrypt functionsfind_prngandprng_is_valid, which nothing in the package calls: SQLCipher registers Fortuna withregister_prngand then calls thefortuna_*functions directly, and the LibTomCrypt functions that look a PRNG up by name or index are not included. cgo still compiled both files and linked them into every binary.go.sumhas been empty since go-sqlite3 dropped its last requirement (4120733, 2020), andgo mod tidydoes not recreate it, since the module has no dependencies.How nothing references the two functions under any build tag was checked:
.c,.hor.gofile of the repository (the cgo preambles and the per-platform files included) except in their definitions and in their declarations intomcrypt_prng.h, and no macro pastes tokens into them. Build tags select Go files and cgo flags only, and every.cfile is compiled under every tag set, so no tag set can add a caller.develop(47 to 63 of them, depending on the tags) define the two functions in 2 objects and reference them in none, and the test binaries contain both as text symbols. On this branch the test binaries link under every tag set and contain neither.developand this branch compile the same SQLite and SQLCipher code, so query results cannot change; the corpus check below confirms it.Left out:
tomcrypt_prng.hkeeps its declarations, as LibTomCrypt 1.18.2 ships it; a declaration without a caller links nothing.Testing
On linux/amd64 (Debian trixie container
cql-ci:go1.27pluslibsqlite3-dev), Go 1.27.3,--cpus 4. Tag sets: the four of.github/workflows/go.yaml(empty,libsqlite3, the full set,sqlite_vacuum_full), CovenantSQL'ssqlite_omit_load_extension sqlite_omit_localtime, and its miner tagssqlite_omit_load_extension sqlite_omit_localtime sqlite_vtable sqlite_fts5 sqlite_icu.developand on this branch:go build -work -tags "$TAGS" .with a throwaway Go file that forces cgo to compile every C file again, thennm -A --defined-onlyandnm -A -uover$WORK/b001/_x*.o; andgo test -c -tags "$TAGS"followed bynmof the test binary. Results as described above.go vet -tags "$TAGS" .andgo test -race -count=1 -tags "$TAGS" .pass for each tag set. Onlygo vetwith the full set fails, oncall to (*testing.T).Fatal from a non-test goroutineinsqlite3_opt_unlock_notify_test.go, identically ondevelop.go mod tidyleaves nogo.sum.vfs=nocurrenttimeand a Go function registered in aConnectHook, as CovenantSQL'sxenomint/sqlitedoes: types and conversions, numeric and text formatting, ICU case folding,LIKE,REGEXPand collation, date functions with and without the current time, JSON, window functions, FTS5 ranking, errors,EXPLAIN QUERY PLANand the SQLCipher pragmas. It prints every value with its Go type, every error, rows affected and last insert IDs. Its output is byte-identical withdevelopand with all five open PRs of this repository merged (tree74119820), for each tag set above and for the full set plus CovenantSQL's tags; withsqlite_os_trace, the VFS trace lines are identical once the temporary directory and the process ID are masked.