aboutsummaryrefslogtreecommitdiff
path: root/src/hkdf.c
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2024-07-05 00:03:48 -0400
committerLibravatar vnugent <public@vaughnnugent.com>2024-07-05 00:03:48 -0400
commit23fe6e8c8596333c2183f0f4389817087442c551 (patch)
tree1b87644b34141f9deedf7c655084a3c0d5b22817 /src/hkdf.c
parentdc71f861df8929deee300368b88ef47d45560695 (diff)
push latest utils and changes
Diffstat (limited to 'src/hkdf.c')
-rw-r--r--src/hkdf.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/src/hkdf.c b/src/hkdf.c
index 0d91d14..cff7d60 100644
--- a/src/hkdf.c
+++ b/src/hkdf.c
@@ -21,23 +21,10 @@
#include "hkdf.h"
-/* Include string for memmove */
-#include <string.h>
-
#define HKDF_MIN(a, b) (a < b ? a : b)
STATIC_ASSERT(HKDF_IN_BUF_SIZE > SHA256_DIGEST_SIZE, "HDK Buffer must be at least the size of the underlying hashing alg output")
-static _nc_fn_inline void ncWriteSpanS(span_t* span, uint32_t offset, const uint8_t* data, uint32_t size)
-{
- DEBUG_ASSERT2(span != NULL, "Expected span to be non-null")
- DEBUG_ASSERT2(data != NULL, "Expected data to be non-null")
- DEBUG_ASSERT2(offset + size <= span->size, "Expected offset + size to be less than span size")
-
- /* Copy data to span */
- memmove(span->data + offset, data, size);
-}
-
static _nc_fn_inline void debugValidateHandler(const struct nc_hkdf_fn_cb_struct* handler)
{
DEBUG_ASSERT(handler != NULL)
@@ -114,7 +101,7 @@ cstatus_t hkdfExpandProcess(
DEBUG_ASSERT(tLen <= sizeof(t));
/* write the T buffer back to okm */
- ncWriteSpanS(okm, okmOffset, t, tLen);
+ ncSpanWrite(*okm, okmOffset, t, tLen);
/* shift base okm pointer by T */
okmOffset += tLen;