Skip to content

Commit c66691b

Browse files
committed
Always seed libtomcrypt CSPRNG (even for tests)
1 parent 03c64f7 commit c66691b

2 files changed

Lines changed: 0 additions & 36 deletions

File tree

src/crypto_libtomcrypt.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ static int sqlcipher_ltc_activate(void *ctx) {
9494
}
9595
ltc_ref_count++;
9696

97-
#ifndef SQLCIPHER_TEST
9897
bytes = rng_get_bytes(random_buffer, FORTUNA_MAX_SZ, NULL);
99-
#endif
10098
sqlcipher_log(SQLCIPHER_LOG_TRACE, SQLCIPHER_LOG_PROVIDER, "sqlcipher_ltc_activate: seeded fortuna with %d bytes from rng_get_bytes", bytes);
10199

102100
if(sqlcipher_ltc_add_random(ctx, random_buffer, FORTUNA_MAX_SZ) != SQLITE_OK) {

test/sqlcipher-compatibility.test

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1264,40 +1264,6 @@ db close
12641264
file delete -force test.db
12651265
file delete -force new.db
12661266

1267-
1268-
# Requires SQLCipher to be built with -DSQLCIPHER_TEST
1269-
if_built_with_libtomcrypt verify-random-data-alters-file-content {
1270-
file delete -force test.db
1271-
file delete -force test2.db
1272-
file delete -force test3.db
1273-
set rc {}
1274-
1275-
sqlite_orig db test.db
1276-
execsql {
1277-
PRAGMA key="x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";
1278-
create table t1(a,b);
1279-
}
1280-
db close
1281-
sqlite_orig db test2.db
1282-
execsql {
1283-
PRAGMA key="x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";
1284-
create table t1(a,b);
1285-
}
1286-
db close
1287-
sqlite_orig db test3.db
1288-
execsql {
1289-
PRAGMA key="x'2DD29CA851E7B56E4697B0E1F08507293D761A05CE4D1B628663F411A8086D99'";
1290-
PRAGMA cipher_add_random = "x'deadbaad'";
1291-
create table t1(a,b);
1292-
}
1293-
db close
1294-
lappend rc [cmpFilesChunked test.db test2.db]
1295-
lappend rc [cmpFilesChunked test2.db test3.db]
1296-
} {0 1}
1297-
file delete -force test.db
1298-
file delete -force test2.db
1299-
file delete -force test3.db
1300-
13011267
do_test can-migrate-with-keys-longer-than-64-characters {
13021268
sqlite_orig db test.db
13031269
execsql {

0 commit comments

Comments
 (0)