diff --git a/src/crypto_impl.c b/src/crypto_impl.c index d3a1f1e..993531b 100644 --- a/src/crypto_impl.c +++ b/src/crypto_impl.c @@ -1256,7 +1256,7 @@ cleanup: int sqlcipher_codec_ctx_integrity_check(codec_ctx *ctx, Parse *pParse, char *column) { Pgno page = 1; - int i, trans_rc, rc = 0; + int i, rc = 0; char *result; unsigned char *hmac_out = NULL; sqlite3_file *fd = sqlite3PagerFile(ctx->pBt->pBt->pPager); @@ -1284,13 +1284,6 @@ int sqlcipher_codec_ctx_integrity_check(codec_ctx *ctx, Parse *pParse, char *col goto cleanup; } - /* establish an exclusive lock on the database */ - if((trans_rc = sqlite3BtreeBeginTrans(ctx->pBt, 2, 0)) != SQLITE_OK) { - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, "unable to lock database", P4_TRANSIENT); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); - goto cleanup; - } - sqlite3OsFileSize(fd, &file_sz); hmac_out = sqlcipher_malloc(ctx->hmac_sz); @@ -1330,7 +1323,6 @@ int sqlcipher_codec_ctx_integrity_check(codec_ctx *ctx, Parse *pParse, char *col } cleanup: - if(trans_rc == SQLITE_OK) sqlite3BtreeRollback(ctx->pBt, SQLITE_OK, 0); if(hmac_out != NULL) sqlcipher_free(hmac_out, ctx->hmac_sz); return SQLITE_OK; } diff --git a/test/sqlcipher-integrity.test b/test/sqlcipher-integrity.test index ec6856b..098c162 100644 --- a/test/sqlcipher-integrity.test +++ b/test/sqlcipher-integrity.test @@ -308,25 +308,4 @@ do_test integrity-check-plaintext-header { } {{} 1 {{HMAC verification failed for page 1} {HMAC verification failed for page 2}}} file delete -force test.db -# verify database locking for cipher_integrity_check -do_test integrity-check-locking { - sqlite_orig db test.db - sqlite_orig db2 test.db - - execsql { - PRAGMA key = 'test'; - CREATE TABLE t1(a,b); - BEGIN EXCLUSIVE; - INSERT INTO t1(a,b) VALUES (1,2); - } - - execsql { - PRAGMA key = 'test'; - PRAGMA cipher_integrity_check; - } db2 -} {{unable to lock database}} -sqlite_orig db test.db -sqlite_orig db2 test.db -file delete -force test.db - finish_test