still wip

This commit is contained in:
2025-12-22 23:02:29 +01:00
parent 627acef32c
commit a48ef9d5e0
60 changed files with 6993 additions and 4939 deletions

View File

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