File tree Expand file tree Collapse file tree 2 files changed +13
-10
lines changed
Expand file tree Collapse file tree 2 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ static volatile int default_page_size = 4096;
5151static volatile int default_plaintext_header_sz = 0 ;
5252static volatile int default_hmac_algorithm = SQLCIPHER_HMAC_SHA512 ;
5353static volatile int default_kdf_algorithm = SQLCIPHER_PBKDF2_HMAC_SHA512 ;
54- static volatile int mem_security_on = 1 ;
54+ static volatile int mem_security_on = 0 ;
5555static volatile int mem_security_initialized = 0 ;
5656static volatile int mem_security_activated = 0 ;
5757static volatile unsigned int sqlcipher_activate_count = 0 ;
@@ -836,8 +836,11 @@ int sqlcipher_get_default_pagesize() {
836836}
837837
838838void sqlcipher_set_mem_security (int on ) {
839- mem_security_on = on ;
840- mem_security_activated = 0 ;
839+ /* memory security can only be enabled, not disabled */
840+ if (on ) {
841+ mem_security_on = on ;
842+ mem_security_activated = 0 ;
843+ }
841844}
842845
843846int sqlcipher_get_mem_security () {
Original file line number Diff line number Diff line change @@ -730,20 +730,20 @@ db close
730730file delete -force test.db
731731
732732# verify memory security behavior
733- # initially should report ON
734- # then disable, check that it is off
735- # turn it back on, then check.
733+ # initially should report OFF
734+ # then enable, check that it is ON
735+ # try to turn if off, but verify that it
736+ # can't be unset.
736737do_test verify-memory-security {
737738 sqlite_orig db test.db
738739 execsql {
739- PRAGMA cipher_memory_security;
740- PRAGMA cipher_memory_security = OFF;
741740 PRAGMA cipher_memory_security;
742741 PRAGMA cipher_memory_security = ON;
743742 PRAGMA cipher_memory_security;
744-
743+ PRAGMA cipher_memory_security = OFF;
744+ PRAGMA cipher_memory_security;
745745 }
746- } {1 0 1}
746+ } {0 1 1}
747747db close
748748file delete -force test.db
749749
You can’t perform that action at this time.
0 commit comments