mirror of
https://github.com/status-im/sqlcipher.git
synced 2026-08-31 22:41:06 +00:00
normalize attach behavior when key is not yet derived
This commit is contained in:
+5
-3
@@ -813,10 +813,12 @@ void sqlite3CodecGetKey(sqlite3* db, int nDb, void **zKey, int *nKey) {
|
||||
codec_ctx *ctx = (codec_ctx*) sqlite3PagerGetCodec(pDb->pBt->pBt->pPager);
|
||||
|
||||
if(ctx) {
|
||||
if(sqlcipher_codec_get_store_pass(ctx) == 1) {
|
||||
/* pass back the keyspec from the codec, unless PRAGMA cipher_store_pass
|
||||
is set or keyspec has not yet been derived, in which case pass
|
||||
back the password key material */
|
||||
sqlcipher_codec_get_keyspec(ctx, zKey, nKey);
|
||||
if(sqlcipher_codec_get_store_pass(ctx) == 1 || *zKey == NULL) {
|
||||
sqlcipher_codec_get_pass(ctx, zKey, nKey);
|
||||
} else {
|
||||
sqlcipher_codec_get_keyspec(ctx, zKey, nKey);
|
||||
}
|
||||
} else {
|
||||
*zKey = NULL;
|
||||
|
||||
Reference in New Issue
Block a user