libsql-ffi: Update vendored SQLite3MultipleCiphers to 1.9.0#2245
Merged
Conversation
This updates the vendored SQLite3 Multiple Ciphers encryption extension from 1.8.1 to 1.9.0, the release that targets upstream SQLite 3.47.0 (the base version we now ship). The previous 1.8.1 vendoring lagged the SQLite base and was missing several upstream fixes, including a crash in sqlite3mcSetCodec(). The import replaces all upstream files with their v1.9.0 contents and re-applies libSQL's local patches via 3-way merge (base v1.8.1, ours libSQL, theirs v1.9.0). All merges were clean (no conflicts), and `cargo build -p libsql-ffi --features multiple-ciphers` builds. == Preserved as-is (not upstream sqlite3mc) == src/sqlite3.c, src/sqlite3.h — libSQL's own SQLite amalgamation, not sqlite3mc's vanilla copy. build.rs overwrites src/sqlite3.c with libsql-sqlite3's amalgamation at build time regardless, so these are left untouched. == Re-applied libSQL patches (3-way merged onto 1.9.0) == CMakeLists.txt — libSQL build options (LIBSQL_ENCRYPTION, LIBSQL_CUSTOM_PAGER_CODEC, LIBSQL_EXTRA_PRAGMAS, LIBSQL_ENABLE_WASM_RUNTIME), AES256-only cipher selection, and the arm/aarch64 guards around -msse4.2/-maes. src/sqlite3mc.c — `#include "sqlite3.c"` instead of "sqlite3patched.c" so the amalgamation pulls in libSQL's SQLite. src/codecext.c, src/sqlite3mc_vfs.c — libSQL codec hooks libsql_db_has_codec(), libsql_pager_codec_impl() (replacing sqlite3mcPagerHasCodec()/sqlite3mcPagerCodec()), and the cached hasCodec update in the rekey success path. src/cipher_config.c — libsql_extra_pragma(). src/cipher_wxaes256.c — libsql_generate_aes256_key(). src/codec_algos.c — libsql_generate_initial_vector(). == Notable upstream fixes now picked up == src/sqlite3mc_vfs.c — sqlite3mcSetCodec() now passes the VFS located by mcFindVfs() (pVfsMC) to mcFindDbMainFileName() instead of blindly casting db->pVfs. When the Multiple Ciphers VFS is not the top-level VFS (another VFS stacked on top), db->pVfs is not an sqlite3mc_vfs and the cast made mcFindDbMainFileName() dereference a bogus ->mutex and crash. This matches the fix already present in sqlite3mcGetCodec(). src/sqlite3mc_vfs.c — the mcRead* helpers now propagate codec errors via sqlite3mcGetCodecLastError() instead of silently resetting rc to SQLITE_OK after decryption.
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.
This updates the vendored SQLite3 Multiple Ciphers encryption extension from 1.8.1 to 1.9.0, the release that targets upstream SQLite 3.47.0 (the base version we now ship). The previous 1.8.1 vendoring lagged the SQLite base and was missing several upstream fixes, including a crash in sqlite3mcSetCodec().
The import replaces all upstream files with their v1.9.0 contents and re-applies libSQL's local patches via 3-way merge (base v1.8.1, ours libSQL, theirs v1.9.0). All merges were clean (no conflicts), and
cargo build -p libsql-ffi --features multiple-ciphersbuilds.== Preserved as-is (not upstream sqlite3mc) ==
src/sqlite3.c, src/sqlite3.h — libSQL's own SQLite amalgamation, not
sqlite3mc's vanilla copy. build.rs overwrites src/sqlite3.c with
libsql-sqlite3's amalgamation at build time regardless, so these are
left untouched.
== Re-applied libSQL patches (3-way merged onto 1.9.0) ==
CMakeLists.txt — libSQL build options (LIBSQL_ENCRYPTION,
LIBSQL_CUSTOM_PAGER_CODEC, LIBSQL_EXTRA_PRAGMAS,
LIBSQL_ENABLE_WASM_RUNTIME), AES256-only cipher selection, and the
arm/aarch64 guards around -msse4.2/-maes.
src/sqlite3mc.c —
#include "sqlite3.c"instead of "sqlite3patched.c"so the amalgamation pulls in libSQL's SQLite.
src/codecext.c, src/sqlite3mc_vfs.c — libSQL codec hooks
libsql_db_has_codec(), libsql_pager_codec_impl() (replacing
sqlite3mcPagerHasCodec()/sqlite3mcPagerCodec()), and the cached
hasCodec update in the rekey success path.
src/cipher_config.c — libsql_extra_pragma().
src/cipher_wxaes256.c — libsql_generate_aes256_key(). src/codec_algos.c — libsql_generate_initial_vector().
== Notable upstream fixes now picked up ==
src/sqlite3mc_vfs.c — sqlite3mcSetCodec() now passes the VFS located by
mcFindVfs() (pVfsMC) to mcFindDbMainFileName() instead of blindly
casting db->pVfs. When the Multiple Ciphers VFS is not the top-level
VFS (another VFS stacked on top), db->pVfs is not an sqlite3mc_vfs and
the cast made mcFindDbMainFileName() dereference a bogus ->mutex and
crash. This matches the fix already present in sqlite3mcGetCodec().
src/sqlite3mc_vfs.c — the mcRead* helpers now propagate codec errors via
sqlite3mcGetCodecLastError() instead of silently resetting rc to
SQLITE_OK after decryption.