Commit 010e65a
committed
Normalize error behavior for wrong key when first op tries modifying schema
In previous versions of SQLCipher, if an incorrect key was used and the first
operation was a schema change (e.g. CREATE TABLE x(y)) then the error returned
up to the application would be SQLITE_NOMEM instead of SQLITE_NOTADB. While
this didn't cause any problems or insecurity, the inconsistency of the error
codes was undesirable.
Instead of immediately returning NULL from sqlite3Codec when a deferred
error condition is detected, SQLCipher now returns a zeroed out buffer instead.
This basically mirrors the existing failure mode for decryption. The zeroed
buffer is detected as invalid upstream and results in a SQLITE_NOTADB error
just like what would happen if a SELECT was executed as the first operation
with an incorrect key.1 parent 5dbb5b3 commit 010e65a
3 files changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
| 6 | + | |
5 | 7 | | |
6 | 8 | | |
7 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3245 | 3245 | | |
3246 | 3246 | | |
3247 | 3247 | | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
3248 | 3254 | | |
3249 | 3255 | | |
3250 | 3256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1213 | 1213 | | |
1214 | 1214 | | |
1215 | 1215 | | |
1216 | | - | |
| 1216 | + | |
1217 | 1217 | | |
1218 | 1218 | | |
1219 | 1219 | | |
| |||
0 commit comments