From 1087a3fa6d6fd95a0700dfab7ec006c486f73b8d Mon Sep 17 00:00:00 2001 From: Stephen Lombardo Date: Tue, 20 Oct 2020 09:16:51 -0400 Subject: [PATCH] deprecate cipher_store_pass --- src/crypto.c | 3 +++ test/sqlcipher-pragmas.test | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/crypto.c b/src/crypto.c index 200c3a5..3c433a6 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -119,7 +119,10 @@ int sqlcipher_codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLef } else if( sqlite3StrICmp(zLeft, "cipher_store_pass")==0 && zRight ) { if(ctx) { + char *deprecation = "PRAGMA cipher_store_pass is deprecated, please remove from use"; sqlcipher_codec_set_store_pass(ctx, sqlite3GetBoolean(zRight, 1)); + codec_vdbe_return_string(pParse, "cipher_store_pass", deprecation, P4_TRANSIENT); + sqlite3_log(SQLITE_WARNING, deprecation); } } else if( sqlite3StrICmp(zLeft, "cipher_store_pass")==0 && !zRight ) { diff --git a/test/sqlcipher-pragmas.test b/test/sqlcipher-pragmas.test index a1d978d..6d4e71f 100644 --- a/test/sqlcipher-pragmas.test +++ b/test/sqlcipher-pragmas.test @@ -214,6 +214,17 @@ do_test verify-cipher-store-pass-before-key-does-not-segfault { db close file delete -force test.db +# verify setting cipher_store_pass results in deprecation warning +do_test verify-cipher-store-pass-deprecated { + sqlite_orig db test.db + execsql { + PRAGMA key = 'test'; + PRAGMA cipher_store_pass = 1; + } +} {ok {PRAGMA cipher_store_pass is deprecated, please remove from use}} +db close +file delete -force test.db + # verify the pragma cipher # reports the default value if_built_with_openssl verify-pragma-cipher-default {