@@ -346,13 +346,10 @@ int sqlcipher_codec_ctx_set_cipher(codec_ctx *ctx, const char *cipher_name, int
346346 return SQLITE_OK ;
347347}
348348
349- int sqlcipher_codec_ctx_get_cipher ( Parse * pParse , codec_ctx * ctx , int for_ctx ) {
349+ const char * sqlcipher_codec_ctx_get_cipher ( codec_ctx * ctx , int for_ctx ) {
350350 cipher_ctx * c_ctx = for_ctx ? ctx -> write_ctx : ctx -> read_ctx ;
351351 EVP_CIPHER * evp_cipher = c_ctx -> evp_cipher ;
352- const char * name = EVP_CIPHER_name (evp_cipher );
353- codec_vdbe_return_static_string (pParse , "cipher" , name );
354-
355- return SQLITE_OK ;
352+ return EVP_CIPHER_name (evp_cipher );
356353}
357354
358355int sqlcipher_codec_ctx_set_kdf_iter (codec_ctx * ctx , int kdf_iter , int for_ctx ) {
@@ -369,13 +366,9 @@ int sqlcipher_codec_ctx_set_kdf_iter(codec_ctx *ctx, int kdf_iter, int for_ctx)
369366 return SQLITE_OK ;
370367}
371368
372- int sqlcipher_codec_ctx_get_kdf_iter (Parse * pParse , codec_ctx * ctx , int for_ctx ) {
369+ int sqlcipher_codec_ctx_get_kdf_iter (codec_ctx * ctx , int for_ctx ) {
373370 cipher_ctx * c_ctx = for_ctx ? ctx -> write_ctx : ctx -> read_ctx ;
374- char * kdf_iter = sqlite3_mprintf ("%d" , c_ctx -> kdf_iter );
375- codec_vdbe_return_static_string (pParse , "kdf_iter" , kdf_iter );
376- sqlite3_free (kdf_iter );
377-
378- return SQLITE_OK ;
371+ return c_ctx -> kdf_iter ;
379372}
380373
381374int sqlcipher_codec_ctx_set_fast_kdf_iter (codec_ctx * ctx , int fast_kdf_iter , int for_ctx ) {
@@ -398,17 +391,12 @@ void sqlcipher_set_default_use_hmac(int use) {
398391 else default_flags &= ~CIPHER_FLAG_HMAC ;
399392}
400393
401- void sqlcipher_set_hmac_salt_mask ( unsigned char mask ) {
402- hmac_salt_mask = mask ;
394+ int sqlcipher_get_default_use_hmac ( ) {
395+ return default_flags & CIPHER_FLAG_HMAC > 0 ;
403396}
404397
405- int sqlcipher_get_default_use_hmac (Parse * pParse ) {
406- int default_use_hmac_set = default_flags & CIPHER_FLAG_HMAC > 0 ;
407- char * default_use_hmac = sqlite3_mprintf ("%d" , default_use_hmac_set );
408- codec_vdbe_return_static_string (pParse , "cipher_default_use_hmac" , default_use_hmac );
409- sqlite3_free (default_use_hmac );
410-
411- return SQLITE_OK ;
398+ void sqlcipher_set_hmac_salt_mask (unsigned char mask ) {
399+ hmac_salt_mask = mask ;
412400}
413401
414402/* set the codec flag for whether this individual database should be using hmac */
@@ -437,14 +425,9 @@ int sqlcipher_codec_ctx_set_use_hmac(codec_ctx *ctx, int use) {
437425 return SQLITE_OK ;
438426}
439427
440- int sqlcipher_codec_ctx_get_use_hmac (Parse * pParse , codec_ctx * ctx , int for_ctx ) {
428+ int sqlcipher_codec_ctx_get_use_hmac (codec_ctx * ctx , int for_ctx ) {
441429 cipher_ctx * c_ctx = for_ctx ? ctx -> write_ctx : ctx -> read_ctx ;
442- int hmac_flag_set = c_ctx -> flags & CIPHER_FLAG_HMAC > 0 ;
443- char * hmac_flag = sqlite3_mprintf ("%d" , hmac_flag_set );
444- codec_vdbe_return_static_string (pParse , "cipher_use_hmac" , hmac_flag );
445- sqlite3_free (hmac_flag );
446-
447- return SQLITE_OK ;
430+ return c_ctx -> flags & CIPHER_FLAG_HMAC > 0 ;
448431}
449432
450433int sqlcipher_codec_ctx_set_flag (codec_ctx * ctx , unsigned int flag ) {
@@ -459,17 +442,12 @@ int sqlcipher_codec_ctx_unset_flag(codec_ctx *ctx, unsigned int flag) {
459442 return SQLITE_OK ;
460443}
461444
462-
463445void sqlcipher_codec_ctx_set_error (codec_ctx * ctx , int error ) {
464446 CODEC_TRACE (("sqlcipher_codec_ctx_set_error: ctx=%p, error=%d\n" , ctx , error ));
465447 sqlite3pager_sqlite3PagerSetError (ctx -> pBt -> pBt -> pPager , error );
466448 ctx -> pBt -> pBt -> db -> errCode = error ;
467449}
468450
469- int sqlcipher_codec_ctx_get_pagesize (codec_ctx * ctx ) {
470- return ctx -> page_sz ;
471- }
472-
473451int sqlcipher_codec_ctx_get_reservesize (codec_ctx * ctx ) {
474452 return ctx -> read_ctx -> reserve_sz ;
475453}
@@ -501,13 +479,8 @@ int sqlcipher_codec_ctx_set_pagesize(codec_ctx *ctx, int size) {
501479 return SQLITE_OK ;
502480}
503481
504- int sqlcipher_codec_ctx_get_cipher_pagesize (Parse * pParse , codec_ctx * ctx ) {
505- int page_size_value = ctx -> page_sz ;
506- char * page_size = sqlite3_mprintf ("%d" , page_size_value );
507- codec_vdbe_return_static_string (pParse , "cipher_page_size" , page_size );
508- sqlite3_free (page_size );
509-
510- return SQLITE_OK ;
482+ int sqlcipher_codec_ctx_get_pagesize (codec_ctx * ctx ) {
483+ return ctx -> page_sz ;
511484}
512485
513486int sqlcipher_codec_ctx_init (codec_ctx * * iCtx , Db * pDb , Pager * pPager , sqlite3_file * fd , const void * zKey , int nKey ) {
0 commit comments