Skip to content

Commit 8f52dde

Browse files
committed
sqlcipher_codec_hmac convenience function
1 parent c7c5268 commit 8f52dde

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/crypto.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ static void sqlcipher_codec_get_pass(codec_ctx *ctx, void **zKey, int *nKey);
241241
static void sqlcipher_codec_set_store_pass(codec_ctx *ctx, int value);
242242
int sqlcipher_codec_fips_status(codec_ctx *ctx);
243243
const char* sqlcipher_codec_get_provider_version(codec_ctx *ctx);
244+
int sqlcipher_codec_hmac(const codec_ctx *ctx, const unsigned char *hmac_key, int key_sz,
245+
unsigned char* in, int in_sz, unsigned char *in2, int in2_sz,
246+
unsigned char *out);
244247
#endif
245248
#endif
246249
/* END SQLCIPHER */

src/crypto_impl.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,5 +1249,13 @@ const char* sqlcipher_codec_get_provider_version(codec_ctx *ctx) {
12491249
return ctx->read_ctx->provider->get_provider_version(ctx->read_ctx);
12501250
}
12511251

1252+
int sqlcipher_codec_hmac(const codec_ctx *ctx, const unsigned char *hmac_key, int key_sz,
1253+
unsigned char* in, int in_sz, unsigned char *in2, int in2_sz,
1254+
unsigned char *out) {
1255+
ctx->read_ctx->provider->hmac(ctx->read_ctx, (unsigned char *)hmac_key, key_sz, in, in_sz, in2, in2_sz, out);
1256+
return SQLITE_OK;
1257+
}
1258+
1259+
12521260
#endif
12531261
/* END SQLCIPHER */

0 commit comments

Comments
 (0)