@@ -89,6 +89,13 @@ int codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLeft, const c
8989
9090 CODEC_TRACE (("codec_pragma: entered db=%p iDb=%d pParse=%p zLeft=%s zRight=%s ctx=%p\n" , db , iDb , pParse , zLeft , zRight , ctx ));
9191
92+ if ( sqlite3StrICmp (zLeft , "cipher_migrate" )== 0 && !zRight ){
93+ if (ctx ){
94+ char * migrate_status = sqlite3_mprintf ("%d" , sqlcipher_codec_ctx_migrate (ctx ));
95+ codec_vdbe_return_static_string (pParse , "sqlcipher_migrate" , migrate_status );
96+ sqlite3_free (migrate_status );
97+ }
98+ } else
9299 if ( sqlite3StrICmp (zLeft , "cipher_provider" )== 0 && !zRight ){
93100 if (ctx ) { codec_vdbe_return_static_string (pParse , "cipher_provider" ,
94101 sqlcipher_codec_get_cipher_provider (ctx ));
@@ -110,6 +117,15 @@ int codec_pragma(sqlite3* db, int iDb, Parse *pParse, const char *zLeft, const c
110117 if ( sqlite3StrICmp (zLeft , "rekey_cipher" )== 0 && zRight ){
111118 if (ctx ) sqlcipher_codec_ctx_set_cipher (ctx , zRight , 1 ); // change write cipher only
112119 }else
120+ if ( sqlite3StrICmp (zLeft ,"cipher_default_kdf_iter" )== 0 ){
121+ if ( zRight ) {
122+ sqlcipher_set_default_kdf_iter (atoi (zRight )); // change default KDF iterations
123+ } else {
124+ char * kdf_iter = sqlite3_mprintf ("%d" , sqlcipher_get_default_kdf_iter ());
125+ codec_vdbe_return_static_string (pParse , "cipher_default_kdf_iter" , kdf_iter );
126+ sqlite3_free (kdf_iter );
127+ }
128+ }else
113129 if ( sqlite3StrICmp (zLeft , "kdf_iter" )== 0 ){
114130 if (ctx ) {
115131 if ( zRight ) {
@@ -412,13 +428,11 @@ int sqlite3_rekey(sqlite3 *db, const void *pKey, int nKey) {
412428void sqlite3CodecGetKey (sqlite3 * db , int nDb , void * * zKey , int * nKey ) {
413429 struct Db * pDb = & db -> aDb [nDb ];
414430 CODEC_TRACE (("sqlite3CodecGetKey: entered db=%p, nDb=%d\n" , db , nDb ));
415-
416431 if ( pDb -> pBt ) {
417432 codec_ctx * ctx ;
418433 sqlite3pager_get_codec (pDb -> pBt -> pBt -> pPager , (void * * ) & ctx );
419-
420434 if (ctx ) { /* if the codec has an attached codec_context user the raw key data */
421- sqlcipher_codec_get_pass (ctx , zKey , nKey );
435+ sqlcipher_codec_get_keyspec (ctx , zKey , nKey );
422436 } else {
423437 * zKey = NULL ;
424438 * nKey = 0 ;
0 commit comments