Nop for adding random to commoncrypto

This commit is contained in:
Nick Parker 2013-12-06 11:12:48 -06:00
parent bba319a716
commit c5360e120e
1 changed files with 5 additions and 0 deletions

View File

@ -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;
@ -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;
}