mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-11-11 11:27:40 +00:00
* unit test fix for HKDF
This commit is contained in:
1 parent
31ad59b67d
commit
125c4a54f5
1 file changed
+16
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
// Mock HKDF for native testing — deterministic but not cryptographic.
|
||||
template <typename T> void hkdf
|
||||
(void *out, size_t outLen, const void *key, size_t keyLen,
|
||||
const void *salt, size_t saltLen, const void *info, size_t infoLen)
|
||||
{
|
||||
int j = 0, k = 0;
|
||||
for (int i = 0; i < outLen; i++) {
|
||||
((uint8_t *)out)[i] = ((const uint8_t *)key)[k] ^ ((const uint8_t *)info)[j];
|
||||
k = (k + 1) % keyLen;
|
||||
j = (j + 1) % infoLen;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user