summaryrefslogtreecommitdiff
path: root/src/crypto_cc.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:43 -0400
committerHans-Christoph Steiner <hans@eds.org>2014-10-16 22:51:43 -0400
commit9f67c0520ea0d5f11a190197cdf746c512db4ce4 (patch)
treec88a33f01f20a3d13a09594f114fffacebd0d1a4 /src/crypto_cc.c
parentee20336e9c78d2e3782c8d096b9ab4f6ca8ce95f (diff)
parent569c6676a6ddb0ff73821d7693b5e18ddef809b9 (diff)
Merge tag 'upstream/3.2.0'
Upstream version 3.2.0 # gpg: Signature made Thu 16 Oct 2014 10:51:39 PM EDT using RSA key ID 374BBE81 # gpg: Good signature from "Hans-Christoph Steiner <hans@guardianproject.info>" # gpg: aka "Hans-Christoph Steiner <hans@eds.org>" # gpg: aka "Hans-Christoph Steiner <hans@at.or.at>" # gpg: aka "[jpeg image of size 5408]"
Diffstat (limited to 'src/crypto_cc.c')
-rw-r--r--src/crypto_cc.c11
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;
}