Skip to content

Commit 3ec6803

Browse files
authored
libsql-ffi: Update vendored SQLite3MultipleCiphers to 1.9.0 (#2245)
2 parents 5816145 + eb03b04 commit 3ec6803

71 files changed

Lines changed: 23578 additions & 11348 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# This is the EditorConfig (http://editorconfig.org/) coding style file for
2+
# SQLite3 Multiple Ciphers.
3+
4+
root = true
5+
6+
[*]
7+
charset = utf-8
8+
end_of_line = lf
9+
insert_final_newline = true
10+
indent_style = space
11+
indent_size = 2
12+
trim_trailing_whitespace = true
13+
14+
[makefile.*]
15+
indent_style = tab
16+
indent_size = 8

libsql-ffi/bundled/SQLite3MultipleCiphers/CHANGELOG.md

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,70 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.9.0] - 2024-10-22
11+
12+
### Changed
13+
14+
- Based on SQLite version 3.47.0
15+
- Changed signature of cipher scheme method `GenerateKey` (affects only developers of dynamic cipher schemes)
16+
17+
### Fixed
18+
19+
- Using differing KDF and HMAC algorithms resulted in databases incompatible with the original SQLCipher library. Setting the parameter `hmac_algorithm_compat` to 0 restores the (incompatible) behaviour.
20+
21+
## [1.8.7] - 2024-08-14
22+
23+
### Changed
24+
25+
- Based on SQLite version 3.46.1
26+
27+
## [1.8.6] - 2024-06-14
28+
29+
### Changed
30+
31+
- Removed extern keyword in function declarations
32+
- Cleaned up white space
33+
- Added SQLITE_PRIVATE for several internal functions
34+
- The cipher configuration parameter `legacy_page_size` now accepts only valid page sizes
35+
- The cipher configuration parameter `plaintext_header_size` now accepts only values that are multiples of 16
36+
37+
### Fixed
38+
39+
- Fixed issue [#156](../../issues/156)) - corrupted database if MMAP_SIZE > 0 was used
40+
- Fixed issue [#158](../../issues/158)) - add check to verify compatibility of source and target database in backup operation
41+
- Fixed issue [#160](../../issues/160)) - fix accessing memory out of array bounds
42+
- Fixed issue [#162](../../issues/162)) - fix loading/storing misaligned data
43+
- Fixed issue [#164](../../issues/164)) - fix return of error messages from rekey
44+
- Fixed issue [#165](../../issues/165)) - fix rekey function by enforcing page size and number of reserved bytes per page
45+
- Fixed issue [#166](../../issues/166)) - missing attribute SQLITE_PRIVATE for several internal functions
46+
- Fixed issue [#167](../../issues/167)) - improve VFS error reporting
47+
- Fixed issue [#168](../../issues/168)) - add check for encryption support
48+
49+
## [1.8.5] - 2024-05-24
50+
51+
### Changed
52+
53+
- Based on SQLite version 3.46.0
54+
55+
## [1.8.4] - 2024-03-14
56+
57+
### Changed
58+
59+
- Based on SQLite version 3.45.2
60+
- Disable user authentication extension by default
61+
62+
## [1.8.3] - 2024-01-31
63+
64+
### Changed
65+
66+
- Based on SQLite version 3.45.1
67+
68+
## [1.8.2] - 2024-01-16
69+
70+
### Changed
71+
72+
- Based on SQLite version 3.45.0
73+
1074
## [1.8.1] - 2023-12-02
1175

1276
### Changed
@@ -469,7 +533,15 @@ The following ciphers are supported:
469533
- AES 256 Bit CBC - SHA1/SHA256/SHA512 HMAC ([SQLCipher](https://www.zetetic.net/sqlcipher/), database versions 1, 2, 3, and 4)
470534
- RC4 - No HMAC ([System.Data.SQLite](http://system.data.sqlite.org))
471535

472-
[Unreleased]: ../../compare/v1.8.0...HEAD
536+
[Unreleased]: ../../compare/v1.9.0...HEAD
537+
[1.9.0]: ../../compare/v1.8.7...v1.9.0
538+
[1.8.7]: ../../compare/v1.8.6...v1.8.7
539+
[1.8.6]: ../../compare/v1.8.5...v1.8.6
540+
[1.8.5]: ../../compare/v1.8.4...v1.8.5
541+
[1.8.4]: ../../compare/v1.8.3...v1.8.4
542+
[1.8.3]: ../../compare/v1.8.2...v1.8.3
543+
[1.8.2]: ../../compare/v1.8.1...v1.8.2
544+
[1.8.1]: ../../compare/v1.8.0...v1.8.1
473545
[1.8.0]: ../../compare/v1.7.4...v1.8.0
474546
[1.7.4]: ../../compare/v1.7.3...v1.7.4
475547
[1.7.3]: ../../compare/v1.7.2...v1.7.3

libsql-ffi/bundled/SQLite3MultipleCiphers/CMakeLists.txt

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ OPTION(SQLITE_ENABLE_JSON1 "Enable extension 'json1'" ON)
3232
OPTION(SQLITE_ENABLE_RTREE "Enable extension 'rtree'" ON)
3333
OPTION(SQLITE_ENABLE_UUID "Enable extension 'uuid'" ON)
3434
OPTION(SQLITE_USE_URI "Enable the URI filename process logic" ON)
35-
OPTION(SQLITE_USER_AUTHENTICATION "Enable extension 'user authentication'" ON)
35+
OPTION(SQLITE_USER_AUTHENTICATION "Enable extension 'user authentication'" OFF)
3636
OPTION(SQLITE_ENABLE_PREUPDATE_HOOK "Enable preupdate hooks" OFF)
3737
OPTION(SQLITE_ENABLE_SESSION "Enable session extension" OFF)
3838
OPTION(SQLITE_SHELL_IS_UTF8 "Shell command line arguments in UTF-8 encoding" ON)
@@ -64,7 +64,6 @@ OPTION(SQLITE3MC_USE_SQLCIPHER_LEGACY "Use sqlcipher legacy mode as default" OFF
6464

6565
# Additional memory security (filling freed memory allocations with zeros or random data)
6666
OPTION(SQLITE3MC_SECURE_MEMORY "Enable pragma to secure freed memory" OFF)
67-
OPTION(SQLITE3MC_USE_RANDOM_FILL_MEMORY "Fill freed memory with random data" OFF)
6867

6968
# Omit AES hardware support
7069
OPTION(SQLITE3MC_OMIT_AES_HARDWARE_SUPPORT "Omit AES hardware support" OFF)
@@ -182,12 +181,6 @@ if(SQLITE3MC_SECURE_MEMORY)
182181
SQLITE3MC_SECURE_MEMORY=1
183182
)
184183
endif()
185-
if(SQLITE3MC_USE_RANDOM_FILL_MEMORY)
186-
set(SQLITE3MC_BASE_DEFINITIONS
187-
${SQLITE3MC_BASE_DEFINITIONS}
188-
SQLITE3MC_USE_RANDOM_FILL_MEMORY=1
189-
)
190-
endif()
191184

192185
if(SQLITE3MC_USE_MINIZ OR _SQLITE3MC_REQUIRE_ZLIB)
193186
if(_SQLITE3MC_REQUIRE_ZLIB)

libsql-ffi/bundled/SQLite3MultipleCiphers/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019-2020 Ulrich Telle
3+
Copyright (c) 2019-2024 Ulrich Telle
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

libsql-ffi/bundled/SQLite3MultipleCiphers/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ ACLOCAL_AMFLAGS = -I admin/m4
2424
AM_CXXFLAGS = -I$(top_srcdir)/src
2525
AM_CFLAGS = -I$(top_srcdir)/src
2626

27-
AM_CFLAGS += -std=c99 -DSQLITE_THREADSAFE=1 -DSQLITE_DQS=0 -DSQLITE_MAX_ATTACHED=10 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_EXTFUNC=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_ENABLE_CSV=1 -DSQLITE_ENABLE_SHA3=1 -DSQLITE_ENABLE_CARRAY=1 -DSQLITE_ENABLE_FILEIO=1 -DSQLITE_ENABLE_SERIES=1 -DSQLITE_ENABLE_UUID=1 -DSQLITE_ENABLE_REGEXP=1 -DSQLITE_TEMP_STORE=2 -DSQLITE_USE_URI=1 -DSQLITE_USER_AUTHENTICATION=1 $(X86_FLAGS) $(ARM_FLAGS)
27+
AM_CFLAGS += -std=c99 -DSQLITE_THREADSAFE=1 -DSQLITE_DQS=0 -DSQLITE_MAX_ATTACHED=10 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_EXTFUNC=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_ENABLE_CSV=1 -DSQLITE_ENABLE_SHA3=1 -DSQLITE_ENABLE_CARRAY=1 -DSQLITE_ENABLE_FILEIO=1 -DSQLITE_ENABLE_SERIES=1 -DSQLITE_ENABLE_UUID=1 -DSQLITE_ENABLE_REGEXP=1 -DSQLITE_TEMP_STORE=2 -DSQLITE_USE_URI=1 -DSQLITE_USER_AUTHENTICATION=0 $(X86_FLAGS) $(ARM_FLAGS)
2828

2929
if HOST_WINDOWS
3030
AM_CFLAGS += -DSQLITE_API=__declspec\(dllexport\)
@@ -138,7 +138,7 @@ sqlite3shell_SOURCES = \
138138
src/sqlite3mc.c \
139139
src/shell.c
140140

141-
sqlite3shell_CFLAGS = -I$(top_srcdir)/src -std=c99 -D_GNU_SOURCE -DSQLITE_THREADSAFE=1 -DSQLITE_DQS=0 -DSQLITE_MAX_ATTACHED=10 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_EXTFUNC=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_ENABLE_CSV=1 -DSQLITE_ENABLE_CARRAY=1 -DSQLITE_ENABLE_UUID=1 -DSQLITE_TEMP_STORE=2 -DSQLITE_USE_URI=1 -DSQLITE_USER_AUTHENTICATION=1 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1 $(X86_FLAGS) $(ARM_FLAGS)
141+
sqlite3shell_CFLAGS = -I$(top_srcdir)/src -std=c99 -D_GNU_SOURCE -DSQLITE_THREADSAFE=1 -DSQLITE_DQS=0 -DSQLITE_MAX_ATTACHED=10 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_SECURE_DELETE=1 -DSQLITE_ENABLE_DESERIALIZE=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_FTS4=1 -DSQLITE_ENABLE_FTS5=1 -DSQLITE_ENABLE_JSON1=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_GEOPOLY=1 -DSQLITE_ENABLE_PREUPDATE_HOOK=1 -DSQLITE_ENABLE_SESSION=1 -DSQLITE_CORE=1 -DSQLITE_ENABLE_EXTFUNC=1 -DSQLITE_ENABLE_MATH_FUNCTIONS=1 -DSQLITE_ENABLE_CSV=1 -DSQLITE_ENABLE_CARRAY=1 -DSQLITE_ENABLE_UUID=1 -DSQLITE_TEMP_STORE=2 -DSQLITE_USE_URI=1 -DSQLITE_USER_AUTHENTICATION=0 -DSQLITE_ENABLE_DBPAGE_VTAB=1 -DSQLITE_ENABLE_DBSTAT_VTAB=1 -DSQLITE_ENABLE_STMTVTAB=1 -DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION=1 $(X86_FLAGS) $(ARM_FLAGS)
142142

143143
if HOST_WINDOWS
144144
sqlite3shell_LDADD =

libsql-ffi/bundled/SQLite3MultipleCiphers/configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
dnl Process this script with autoconf to create configure for sqlite3mc library
22
dnl
3-
dnl Copyright (C) 2019-2023 Ulrich Telle <ulrich@telle-online.de>
3+
dnl Copyright (C) 2019-2024 Ulrich Telle <ulrich@telle-online.de>
44
dnl
55
dnl This file is covered by the same licence as the entire SQLite3 Multiple Ciphers package.
66

7-
AC_INIT([sqlite3mc], [1.8.1], [ulrich@telle-online.de])
7+
AC_INIT([sqlite3mc], [1.9.0], [ulrich@telle-online.de])
88

99
dnl This is the version tested with, might work with earlier ones.
1010
AC_PREREQ([2.69])

libsql-ffi/bundled/SQLite3MultipleCiphers/premake5.lua

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,9 @@ project "sqlite3mc_lib"
9292
-- "SQLITE_ENABLE_SQLAR=1"
9393
-- "SQLITE_ENABLE_ZIPFILE=1"
9494
"SQLITE3MC_SECURE_MEMORY=$(SQLITE3MC_SECURE_MEMORY)",
95-
-- "SQLITE3MC_USE_RANDOM_FILL_MEMORY=$(SQLITE3MC_USE_RANDOM_FILL_MEMORY)",
9695
"SQLITE_TEMP_STORE=2",
9796
"SQLITE_USE_URI=1",
98-
"SQLITE_USER_AUTHENTICATION=1",
97+
"SQLITE_USER_AUTHENTICATION=0",
9998
-- Compatibility with official SQLite3 shell
10099
"SQLITE_ENABLE_DBPAGE_VTAB=1",
101100
"SQLITE_ENABLE_DBSTAT_VTAB=1",
@@ -190,10 +189,9 @@ project "sqlite3mc_dll"
190189
-- "SQLITE_ENABLE_SQLAR=1"
191190
-- "SQLITE_ENABLE_ZIPFILE=1"
192191
"SQLITE3MC_SECURE_MEMORY=$(SQLITE3MC_SECURE_MEMORY)",
193-
-- "SQLITE3MC_USE_RANDOM_FILL_MEMORY=$(SQLITE3MC_USE_RANDOM_FILL_MEMORY)",
194192
"SQLITE_TEMP_STORE=2",
195193
"SQLITE_USE_URI=1",
196-
"SQLITE_USER_AUTHENTICATION=1"
194+
"SQLITE_USER_AUTHENTICATION=0"
197195
}
198196

199197
-- Intermediate directory
@@ -251,7 +249,7 @@ project "sqlite3mc_shell"
251249
"SQLITE_SHELL_IS_UTF8=1",
252250
"SQLITE_ENABLE_SESSION=1",
253251
"SQLITE_ENABLE_DBPAGE_VTAB=1",
254-
"SQLITE_USER_AUTHENTICATION=1"
252+
"SQLITE_USER_AUTHENTICATION=0"
255253
}
256254

257255
-- Intermediate directory
@@ -342,10 +340,9 @@ project "sqlite3mc_libicu"
342340
-- "SQLITE_ENABLE_SQLAR=1"
343341
-- "SQLITE_ENABLE_ZIPFILE=1"
344342
"SQLITE3MC_SECURE_MEMORY=$(SQLITE3MC_SECURE_MEMORY)",
345-
-- "SQLITE3MC_USE_RANDOM_FILL_MEMORY=$(SQLITE3MC_USE_RANDOM_FILL_MEMORY)",
346343
"SQLITE_TEMP_STORE=2",
347344
"SQLITE_USE_URI=1",
348-
"SQLITE_USER_AUTHENTICATION=1",
345+
"SQLITE_USER_AUTHENTICATION=0",
349346
-- Compatibility with official SQLite3 shell
350347
"SQLITE_ENABLE_DBPAGE_VTAB=1",
351348
"SQLITE_ENABLE_DBSTAT_VTAB=1",
@@ -453,10 +450,9 @@ project "sqlite3mc_dllicu"
453450
-- "SQLITE_ENABLE_SQLAR=1"
454451
-- "SQLITE_ENABLE_ZIPFILE=1"
455452
"SQLITE3MC_SECURE_MEMORY=$(SQLITE3MC_SECURE_MEMORY)",
456-
-- "SQLITE3MC_USE_RANDOM_FILL_MEMORY=$(SQLITE3MC_USE_RANDOM_FILL_MEMORY)",
457453
"SQLITE_TEMP_STORE=2",
458454
"SQLITE_USE_URI=1",
459-
"SQLITE_USER_AUTHENTICATION=1"
455+
"SQLITE_USER_AUTHENTICATION=0"
460456
}
461457

462458
-- Intermediate directory
@@ -526,7 +522,7 @@ project "sqlite3mc_shellicu"
526522
"SQLITE_SHELL_IS_UTF8=1",
527523
"SQLITE_ENABLE_SESSION=1",
528524
"SQLITE_ENABLE_DBPAGE_VTAB=1",
529-
"SQLITE_USER_AUTHENTICATION=1"
525+
"SQLITE_USER_AUTHENTICATION=0"
530526
}
531527

532528
-- Intermediate directory

libsql-ffi/bundled/SQLite3MultipleCiphers/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ The code was mainly developed under Windows, but was tested under Linux as well.
1010

1111
## Version information
1212

13-
* 1.8.1 - *December 2023*
14-
- Based on SQLite version 3.44.2
15-
- Fixed issue #133 - missing API symbols
16-
- Applied several modifications to improve support for [SQLite3 WASM](https://sqlite.org/wasm/)
13+
* 1.9.0 - *October 2024*
14+
- Based on SQLite version 3.47.0
15+
- Changed signature of cipher scheme method `GenerateKey` (affects only developers of dynamic cipher schemes)
16+
- Using differing KDF and HMAC algorithms resulted in databases incompatible with the original SQLCipher library. Setting the parameter `hmac_algorithm_compat` to 0 restores the (incompatible) behaviour.
1717

1818
For further version information please consult the [CHANGELOG](CHANGELOG.md).
1919

libsql-ffi/bundled/SQLite3MultipleCiphers/scripts/patchshell.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ die() {
1414
exit 2
1515
}
1616

17-
sed -e '/^ oputf("SQLite version/{n;N;d}' "$INPUT" \
17+
sed -e '/^ sputf(stdout, "SQLite version/{n;N;d}' "$INPUT" \
1818
| sed '/#ifdef SQLITE_CUSTOM_INCLUDE/!{p;d;};n;n;n;a #if SQLITE3MC_USE_MINIZ != 0 && !defined(SQLITE_ENABLE_COMPRESS)\n#include "miniz.c"\n#ifdef SQLITE_HAVE_ZLIB\n#undef SQLITE_HAVE_ZLIB\n#endif\n#define SQLITE_HAVE_ZLIB 1\n#endif\n' \
1919
| sed '/#include <zlib.h>/c #include "zlibwrap.h"' \
20-
| sed '/^ oputf("SQLite version/c \ extern char* sqlite3mc_version();\n oputf("SQLite version \%s \%.19s%s" \/\*extra-version-info\*\/\n " (\%s)\\n" \/\*SQLite3-Multiple-Ciphers-version-info\*\/\n "Enter \\".help\\" for usage hints.\\n\",\n sqlite3_libversion(), sqlite3_sourceid(), SHELL_CIO_CHAR_SET, sqlite3mc_version());'
20+
| sed '/^ sqlite3_fprintf(stdout,$/c \ extern char* sqlite3mc_version();\n sqlite3_fprintf(stdout,' \
21+
| sed '/^ "SQLite version/c \ "SQLite version \%s \%.19s%s" \/\*extra-version-info\*\/\n " (\%s)\\n" \/\*SQLite3-Multiple-Ciphers-version-info\*\/' \
22+
| sed '/^ sqlite3_libversion(), sqlite3_sourceid(), SHELL_CIO_CHAR_SET);/c \ sqlite3_libversion(), sqlite3_sourceid(), SHELL_CIO_CHAR_SET, sqlite3mc_version());' \
23+
| sed '/^ sqlite3_libversion(), sqlite3_sourceid());/a \ extern char* sqlite3mc_version();\n sqlite3_fprintf(p->out, "\%s\\n", sqlite3mc_version());'

libsql-ffi/bundled/SQLite3MultipleCiphers/scripts/patchsqlite3.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ die() {
1717
# 1) Intercept VFS pragma handling
1818
# 2) Add handling of KEY parameter in ATTACH statements
1919
sed 's/sqlite3_file_control\(.*SQLITE_FCNTL_PRAGMA\)/sqlite3mcFileControlPragma\1/' "$INPUT" \
20-
| sed '/\#endif \/\* SQLITE3\_H \*\//a \ \n\/\* Function prototypes of SQLite3 Multiple Ciphers \*\/\nSQLITE_PRIVATE int sqlite3mcCheckVfs(const char*);\nSQLITE_PRIVATE int sqlite3mcFileControlPragma(sqlite3*, const char*, int, void*);\nSQLITE_PRIVATE int sqlite3mcHandleAttachKey(sqlite3*, const char*, const char*, sqlite3_value*, char**);\nSQLITE_PRIVATE int sqlite3mcHandleMainKey(sqlite3*, const char*);\ntypedef struct PgHdr PgHdrMC;\nSQLITE_PRIVATE void* sqlite3mcPagerCodec(PgHdrMC* pPg);\ntypedef struct Pager PagerMC;\nSQLITE_PRIVATE int sqlite3mcPagerHasCodec(PagerMC* pPager);\nSQLITE_PRIVATE void sqlite3mcInitMemoryMethods();' \
20+
| sed '/\#endif \/\* SQLITE3\_H \*\//a \ \n\/\* Function prototypes of SQLite3 Multiple Ciphers \*\/\nSQLITE_PRIVATE int sqlite3mcCheckVfs(const char*);\nSQLITE_PRIVATE int sqlite3mcFileControlPragma(sqlite3*, const char*, int, void*);\nSQLITE_PRIVATE int sqlite3mcHandleAttachKey(sqlite3*, const char*, const char*, sqlite3_value*, char**);\nSQLITE_PRIVATE int sqlite3mcHandleMainKey(sqlite3*, const char*);\ntypedef struct PgHdr PgHdrMC;\nSQLITE_PRIVATE void* sqlite3mcPagerCodec(PgHdrMC* pPg);\ntypedef struct Pager PagerMC;\nSQLITE_PRIVATE int sqlite3mcPagerHasCodec(PagerMC* pPager);\nSQLITE_PRIVATE void sqlite3mcInitMemoryMethods();\nSQLITE_PRIVATE int sqlite3mcIsBackupSupported(sqlite3*, const char*, sqlite3*, const char*);' \
2121
| sed '/\#define MAX\_PATHNAME 512/c #if SQLITE3MC\_MAX\_PATHNAME \> 512\n#define MAX_PATHNAME SQLITE3MC\_MAX\_PATHNAME\n#else\n#define MAX_PATHNAME 512\n#endif' \
2222
| sed '/pData = pPage->pData;/c \ if( (pData = sqlite3mcPagerCodec(pPage))==0 ) return SQLITE_NOMEM_BKPT;' \
2323
| sed '/pData = p->pData;/c \ if( (pData = sqlite3mcPagerCodec(p))==0 ) return SQLITE_NOMEM;' \
@@ -26,4 +26,5 @@ sed 's/sqlite3_file_control\(.*SQLITE_FCNTL_PRAGMA\)/sqlite3mcFileControlPragma\
2626
| sed '/sqlite3_free_filename(zOpen);/i \\n \/\* Handle encryption related URI parameters. \*\/\n if( rc==SQLITE_OK ){\n rc = sqlite3mcHandleMainKey(db, zOpen);\n }' \
2727
| sed '/^ if( sqlite3PCacheIsDirty(pPager->pPCache) ) return 0;/a \ if( sqlite3mcPagerHasCodec(pPager) != 0 ) return 0;' \
2828
| sed '/^ }else if( USEFETCH(pPager) ){/c \ }else if( USEFETCH(pPager) && sqlite3mcPagerHasCodec(pPager) == 0 ){' \
29-
| sed '/^ if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));/a \\n \/\* Initialize wrapper for memory management.\*\/\n if( rc==SQLITE_OK ) {\n sqlite3mcInitMemoryMethods();\n }\n'
29+
| sed '/^ if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));/a \\n \/\* Initialize wrapper for memory management.\*\/\n if( rc==SQLITE_OK ) {\n sqlite3mcInitMemoryMethods();\n }\n' \
30+
| sed '/Lock the source database handle./i \ \/\* Check whether databases are compatible with backup \*\/\n if (!sqlite3mcIsBackupSupported(pSrcDb, zSrcDb, pDestDb, zDestDb)){\n sqlite3ErrorWithMsg(pDestDb, SQLITE_ERROR, \"backup is not supported with incompatible source and target databases\");\n return NULL;\n }\n'

0 commit comments

Comments
 (0)