|
3 | 3 | ** Purpose: Header for the ciphers of SQLite3 Multiple Ciphers |
4 | 4 | ** Author: Ulrich Telle |
5 | 5 | ** Created: 2020-02-02 |
6 | | -** Copyright: (c) 2006-2020 Ulrich Telle |
| 6 | +** Copyright: (c) 2006-2021 Ulrich Telle |
7 | 7 | ** License: MIT |
8 | 8 | */ |
9 | 9 |
|
@@ -240,4 +240,31 @@ SQLITE_PRIVATE void sqlite3mcCodecGetKey(sqlite3* db, int nDb, void** zKey, int* |
240 | 240 | #define SQLITE3MC_DEBUG_HEX(DESC,BUFFER,LEN) |
241 | 241 | #endif |
242 | 242 |
|
| 243 | +/* |
| 244 | +** If encryption was enabled and WAL journal mode was used, |
| 245 | +** SQLite3 Multiple Ciphers encrypted the WAL journal frames up to version 1.2.5 |
| 246 | +** within the VFS implementation. As a consequence the WAL journal file was not |
| 247 | +** compatible with legacy encryption implementations (for example, System.Data.SQLite |
| 248 | +** or SQLCipher). Additionally, the implementation of the WAL journal encryption |
| 249 | +** was broken, because reading and writing of complete WAL frames was not handled |
| 250 | +** correctly. Usually, operating in WAL journal mode worked nevertheless, but after |
| 251 | +** crashes the WAL journal file could be corrupted leading to data loss. |
| 252 | +** |
| 253 | +** Version 1.3.0 introduced a new way to handle WAL journal encryption. The advantage |
| 254 | +** is that the WAL journal file is now compatible with legacy encryption implementations. |
| 255 | +** Unfortunately the new implementation is not compatible with that used up to version |
| 256 | +** 1.2.5. To be able to access WAL journals created by prior versions, the configuration |
| 257 | +** parameter 'mc_legacy_wal' was introduced. If the parameter is set to 1, then the |
| 258 | +** prior WAL journal encryption mode is used. The default of this parameter can be set |
| 259 | +** at compile time by setting the symbol SQLITE3MC_LEGACY_WAL accordingly, but the actual |
| 260 | +** value can also be set at runtime using the pragma or the URI parameter 'mc_legacy_wal'. |
| 261 | +** |
| 262 | +** In principle, operating generally in WAL legacy mode is possible, but it is strongly |
| 263 | +** recommended to use the WAL legacy mode only to recover WAL journals left behind by |
| 264 | +** prior versions without data loss. |
| 265 | +*/ |
| 266 | +#ifndef SQLITE3MC_LEGACY_WAL |
| 267 | +#define SQLITE3MC_LEGACY_WAL 0 |
| 268 | +#endif |
| 269 | + |
243 | 270 | #endif |
0 commit comments