diff options
Diffstat (limited to 'src/crypto_cc.c')
-rw-r--r-- | src/crypto_cc.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/crypto_cc.c b/src/crypto_cc.c index cf932f6..1e18dc7 100644 --- a/src/crypto_cc.c +++ b/src/crypto_cc.c @@ -36,6 +36,10 @@ #include <CommonCrypto/CommonCrypto.h> #include <Security/SecRandom.h> +static int sqlcipher_cc_add_random(void *ctx, void *buffer, int length) { + return SQLITE_OK; +} + /* generate a defined number of random bytes */ static int sqlcipher_cc_random (void *ctx, void *buffer, int length) { return (SecRandomCopyBytes(kSecRandomDefault, length, (uint8_t *)buffer) == 0) ? SQLITE_OK : SQLITE_ERROR; @@ -54,8 +58,8 @@ static int sqlcipher_cc_hmac(void *ctx, unsigned char *hmac_key, int key_sz, uns return SQLITE_OK; } -static int sqlcipher_cc_kdf(void *ctx, const char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) { - CCKeyDerivationPBKDF(kCCPBKDF2, pass, pass_sz, salt, salt_sz, kCCPRFHmacAlgSHA1, workfactor, key, key_sz); +static int sqlcipher_cc_kdf(void *ctx, const unsigned char *pass, int pass_sz, unsigned char* salt, int salt_sz, int workfactor, int key_sz, unsigned char *key) { + CCKeyDerivationPBKDF(kCCPBKDF2, (const char *)pass, pass_sz, salt, salt_sz, kCCPRFHmacAlgSHA1, workfactor, key, key_sz); return SQLITE_OK; } @@ -105,7 +109,7 @@ static int sqlcipher_cc_ctx_copy(void *target_ctx, void *source_ctx) { } static int sqlcipher_cc_ctx_cmp(void *c1, void *c2) { - return SQLITE_OK; + return 1; /* always indicate contexts are the same */ } static int sqlcipher_cc_ctx_init(void **ctx) { @@ -132,6 +136,7 @@ int sqlcipher_cc_setup(sqlcipher_provider *p) { p->ctx_cmp = sqlcipher_cc_ctx_cmp; p->ctx_init = sqlcipher_cc_ctx_init; p->ctx_free = sqlcipher_cc_ctx_free; + p->add_random = sqlcipher_cc_add_random; return SQLITE_OK; } |