still wip
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include "bitops.h"
|
||||
#include "handy.h"
|
||||
#include "tassert.h"
|
||||
#include "sha2.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -104,3 +105,13 @@ void cf_hmac(const uint8_t *key, size_t nkey,
|
||||
cf_hmac_finish(&ctx, out);
|
||||
}
|
||||
|
||||
// HMAC-SHA256
|
||||
int hmac_sha256 (const uint8_t *key, size_t keylen,
|
||||
const uint8_t *input, size_t ilen,
|
||||
uint8_t *output) {
|
||||
cf_hmac_ctx ctx;
|
||||
cf_hmac_init (&ctx, &cf_sha256, key, keylen);
|
||||
cf_hmac_update (&ctx, input, ilen);
|
||||
cf_hmac_finish (&ctx, output);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user