Skip to content

Commit d95b3f4

Browse files
committed
adjust test for new attach behavior introduced in upstream check-in a02da71f
1 parent fc84742 commit d95b3f4

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

test/sqlcipher-core.test

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,18 @@ db2 close
242242
file delete -force test.db
243243
file delete -force test2.db
244244

245-
# attach an empty encrypted database as the first op
246-
# on a keyed database and verify different
247-
# salts but same keys (because derivation of the key spec
248-
# has not occured yet)
245+
# attach an empty encrypted database as the first operation on a keyed database. Verify
246+
# that the new database has the same salt as the original.
247+
#
248+
# HISTORICAL NOTE: The original behavior of SQLCipher under these conditions
249+
# was that the databases would have different salts but the same keys. This was because
250+
# derivation of the key spec would not have occurred yet. However, upstream check-in
251+
# https://sqlite.org/src/info/a02da71f3a80dd8e changed this behavior by
252+
# forcing a read of the main database schema during the attach operation.
253+
# This causes the main database to be opened and the key derivation logic to fire which
254+
# reads the salt. Thus the current behavior of this test should now be identical
255+
# to the previous attach-empty-database-with-default-key.
256+
249257
setup test.db "'testkey'"
250258
do_test attach-empty-database-with-default-key-first-op {
251259
sqlite_orig db test.db
@@ -267,7 +275,7 @@ do_test attach-empty-database-with-default-key-first-op {
267275
} db2]
268276

269277
lappend rc [string equal [hexio_read test.db 0 16] [hexio_read test2.db 0 16]]
270-
} {{ok 1} 0}
278+
} {{ok 1} 1}
271279
db close
272280
db2 close
273281
file delete -force test.db

0 commit comments

Comments
 (0)