From 569c6676a6ddb0ff73821d7693b5e18ddef809b9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 16 Oct 2014 22:51:35 -0400 Subject: Imported Upstream version 3.2.0 --- src/crypto.h | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/crypto.h') diff --git a/src/crypto.h b/src/crypto.h index a45b57c..b24b85a 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -44,7 +44,7 @@ #define FILE_HEADER_SZ 16 #ifndef CIPHER_VERSION -#define CIPHER_VERSION "2.2.1" +#define CIPHER_VERSION "3.2.0" #endif #ifndef CIPHER @@ -59,7 +59,7 @@ #define CIPHER_READWRITE_CTX 2 #ifndef PBKDF2_ITER -#define PBKDF2_ITER 4000 +#define PBKDF2_ITER 64000 #endif /* possible flags for cipher_ctx->flags */ @@ -142,13 +142,20 @@ static int cipher_hex2int(char c) { (c>='a' && c<='f') ? (c)-'a'+10 : 0; } -static void cipher_hex2bin(const char *hex, int sz, unsigned char *out){ +static void cipher_hex2bin(const unsigned char *hex, int sz, unsigned char *out){ int i; for(i = 0; i < sz; i += 2){ out[i/2] = (cipher_hex2int(hex[i])<<4) | cipher_hex2int(hex[i+1]); } } +static void cipher_bin2hex(const unsigned char* in, int sz, char *out) { + int i; + for(i=0; i < sz; i++) { + sqlite3_snprintf(3, out + (i*2), "%02x ", in[i]); + } +} + /* extensions defined in crypto_impl.c */ typedef struct codec_ctx codec_ctx; @@ -167,12 +174,15 @@ int sqlcipher_page_cipher(codec_ctx *, int, Pgno, int, int, unsigned char *, uns void sqlcipher_codec_ctx_set_error(codec_ctx *, int); int sqlcipher_codec_ctx_set_pass(codec_ctx *, const void *, int, int); -void sqlcipher_codec_get_pass(codec_ctx *, void **zKey, int *nKey); +void sqlcipher_codec_get_keyspec(codec_ctx *, void **zKey, int *nKey); int sqlcipher_codec_ctx_set_pagesize(codec_ctx *, int); int sqlcipher_codec_ctx_get_pagesize(codec_ctx *); int sqlcipher_codec_ctx_get_reservesize(codec_ctx *); +void sqlcipher_set_default_kdf_iter(int iter); +int sqlcipher_get_default_kdf_iter(); + int sqlcipher_codec_ctx_set_kdf_iter(codec_ctx *, int, int); int sqlcipher_codec_ctx_get_kdf_iter(codec_ctx *ctx, int); @@ -202,6 +212,14 @@ int sqlcipher_codec_ctx_unset_flag(codec_ctx *ctx, unsigned int flag); int sqlcipher_codec_ctx_get_flag(codec_ctx *ctx, unsigned int flag, int for_ctx); const char* sqlcipher_codec_get_cipher_provider(codec_ctx *ctx); +int sqlcipher_codec_ctx_migrate(codec_ctx *ctx); +int sqlcipher_codec_add_random(codec_ctx *ctx, const char *data, int random_sz); +int sqlcipher_cipher_profile(sqlite3 *db, const char *destination); +static void sqlcipher_profile_callback(void *file, const char *sql, sqlite3_uint64 run_time); +static int sqlcipher_codec_get_store_pass(codec_ctx *ctx); +static void sqlcipher_codec_get_pass(codec_ctx *ctx, void **zKey, int *nKey); +static void sqlcipher_codec_set_store_pass(codec_ctx *ctx, int value); + #endif #endif /* END SQLCIPHER */ -- cgit v1.2.3