Add incremental API for HMAC-BLAKE2[bs] computation

This commit is contained in:
Josh Holtrop
2026-01-14 15:37:07 -05:00
parent 74c79dab1e
commit b432ee93a5
5 changed files with 398 additions and 84 deletions
+172 -8
View File
@@ -46,7 +46,7 @@ int wc_InitBlake2b(Blake2b* b2b, word32 digestSz);
byte plain[] = { // initialize input };
ret = wc_Blake2bUpdate(&b2b, plain, sizeof(plain));
if( ret != 0) {
if (ret != 0) {
// error updating blake2b
}
\endcode
@@ -84,7 +84,7 @@ int wc_Blake2bUpdate(Blake2b* b2b, const byte* data, word32 sz);
... // call wc_Blake2bUpdate to add data to hash
ret = wc_Blake2bFinal(&b2b, hash, WC_BLAKE2B_DIGEST_SIZE);
if( ret != 0) {
if (ret != 0) {
// error generating blake2b hash
}
\endcode
@@ -97,8 +97,90 @@ int wc_Blake2bFinal(Blake2b* b2b, byte* final, word32 requestSz);
/*!
\ingroup BLAKE2
\brief This function computes the HMAC-BLAKE2b message authentication code
of the given input data using the given key.
\brief Initialize an HMAC-BLAKE2b message authentication code computation.
\return 0 Returned upon successfully initializing the HMAC-BLAKE2b MAC
computation.
\param b2b Blake2b structure to be used for the MAC computation.
\param key pointer to the key
\param key_len length of the key
_Example_
\code
Blake2b b2b;
int ret;
byte key[] = {4, 5, 6};
ret = wc_Blake2bHmacInit(&b2b, key);
if (ret != 0) {
// error generating HMAC-BLAKE2b
}
\endcode
*/
int wc_Blake2bHmacInit(Blake2b * b2b,
const byte * key, size_t key_len);
/*!
\ingroup BLAKE2
\brief Update an HMAC-BLAKE2b message authentication code computation with
additional input data.
\return 0 Returned upon successfully updating the HMAC-BLAKE2b MAC
computation.
\param b2b Blake2b structure to be used for the MAC computation.
\param in pointer to the input data
\param in_len length of the input data
_Example_
\code
Blake2b b2b;
int ret;
byte key[] = {4, 5, 6};
byte data[] = {1, 2, 3};
ret = wc_Blake2bHmacInit(&b2b, key, sizeof(key));
ret = wc_Blake2bHmacUpdate(&b2b, data, sizeof(data));
\endcode
*/
int wc_Blake2bHmacUpdate(Blake2b * b2b,
const byte * in, size_t in_len);
/*!
\ingroup BLAKE2
\brief Finalize an HMAC-BLAKE2b message authentication code computation.
\return 0 Returned upon successfully finalizing the HMAC-BLAKE2b MAC
computation.
\param b2b Blake2b structure to be used for the MAC computation.
\param key pointer to the key
\param key_len length of the key
\param out output buffer to store computed MAC
\param out_len length of output buffer
_Example_
\code
Blake2b b2b;
int ret;
byte key[] = {4, 5, 6};
byte data[] = {1, 2, 3};
byte mac[WC_BLAKE2B_DIGEST_SIZE];
ret = wc_Blake2bHmacInit(&b2b, key, sizeof(key));
ret = wc_Blake2bHmacUpdate(&b2b, data, sizeof(data));
ret = wc_Blake2bHmacFinalize(&b2b, key, sizeof(key), mac, sizezof(mac));
\endcode
*/
int wc_Blake2bHmacFinal(Blake2b * b2b,
const byte * key, size_t key_len,
byte * out, size_t out_len);
/*!
\ingroup BLAKE2
\brief Compute the HMAC-BLAKE2b message authentication code of the given
input data using the given key.
\return 0 Returned upon successfully computing the HMAC-BLAKE2b MAC.
@@ -116,7 +198,7 @@ int wc_Blake2bFinal(Blake2b* b2b, byte* final, word32 requestSz);
byte data[] = {1, 2, 3};
byte key[] = {4, 5, 6};
ret = wc_Blake2bHmac(data, sizeof(data), key, sizeof(key), mac, sizeof(mac));
if( ret != 0) {
if (ret != 0) {
// error generating HMAC-BLAKE2b
}
\endcode
@@ -174,7 +256,7 @@ int wc_InitBlake2s(Blake2s* b2s, word32 digestSz);
byte plain[] = { // initialize input };
ret = wc_Blake2sUpdate(&b2s, plain, sizeof(plain));
if( ret != 0) {
if (ret != 0) {
// error updating blake2s
}
\endcode
@@ -212,7 +294,7 @@ int wc_Blake2sUpdate(Blake2s* b2s, const byte* data, word32 sz);
... // call wc_Blake2sUpdate to add data to hash
ret = wc_Blake2sFinal(&b2s, hash, WC_BLAKE2S_DIGEST_SIZE);
if( ret != 0) {
if (ret != 0) {
// error generating blake2s hash
}
\endcode
@@ -222,6 +304,88 @@ int wc_Blake2sUpdate(Blake2s* b2s, const byte* data, word32 sz);
*/
int wc_Blake2sFinal(Blake2s* b2s, byte* final, word32 requestSz);
/*!
\ingroup BLAKE2
\brief Initialize an HMAC-BLAKE2s message authentication code computation.
\return 0 Returned upon successfully initializing the HMAC-BLAKE2s MAC
computation.
\param b2s Blake2s structure to be used for the MAC computation.
\param key pointer to the key
\param key_len length of the key
_Example_
\code
Blake2s b2s;
int ret;
byte key[] = {4, 5, 6};
ret = wc_Blake2sHmacInit(&b2s, key);
if (ret != 0) {
// error generating HMAC-BLAKE2s
}
\endcode
*/
int wc_Blake2sHmacInit(Blake2s * b2s,
const byte * key, size_t key_len);
/*!
\ingroup BLAKE2
\brief Update an HMAC-BLAKE2s message authentication code computation with
additional input data.
\return 0 Returned upon successfully updating the HMAC-BLAKE2s MAC
computation.
\param b2s Blake2s structure to be used for the MAC computation.
\param in pointer to the input data
\param in_len length of the input data
_Example_
\code
Blake2s b2s;
int ret;
byte key[] = {4, 5, 6};
byte data[] = {1, 2, 3};
ret = wc_Blake2sHmacInit(&b2s, key, sizeof(key));
ret = wc_Blake2sHmacUpdate(&b2s, data, sizeof(data));
\endcode
*/
int wc_Blake2sHmacUpdate(Blake2s * b2s,
const byte * in, size_t in_len);
/*!
\ingroup BLAKE2
\brief Finalize an HMAC-BLAKE2s message authentication code computation.
\return 0 Returned upon successfully finalizing the HMAC-BLAKE2s MAC
computation.
\param b2s Blake2s structure to be used for the MAC computation.
\param key pointer to the key
\param key_len length of the key
\param out output buffer to store computed MAC
\param out_len length of output buffer
_Example_
\code
Blake2s b2s;
int ret;
byte key[] = {4, 5, 6};
byte data[] = {1, 2, 3};
byte mac[WC_BLAKE2S_DIGEST_SIZE];
ret = wc_Blake2sHmacInit(&b2s, key, sizeof(key));
ret = wc_Blake2sHmacUpdate(&b2s, data, sizeof(data));
ret = wc_Blake2sHmacFinalize(&b2s, key, sizeof(key), mac, sizezof(mac));
\endcode
*/
int wc_Blake2sHmacFinal(Blake2s * b2s,
const byte * key, size_t key_len,
byte * out, size_t out_len);
/*!
\ingroup BLAKE2
@@ -244,7 +408,7 @@ int wc_Blake2sFinal(Blake2s* b2s, byte* final, word32 requestSz);
byte data[] = {1, 2, 3};
byte key[] = {4, 5, 6};
ret = wc_Blake2sHmac(data, sizeof(data), key, sizeof(key), mac, sizeof(mac));
if( ret != 0) {
if (ret != 0) {
// error generating HMAC-BLAKE2s
}
\endcode
+79 -37
View File
@@ -517,29 +517,21 @@ int wc_Blake2bFinal(Blake2b* b2b, byte* final, word32 requestSz)
}
int wc_Blake2bHmac(const byte * in, size_t in_len,
const byte * key, size_t key_len,
byte * out, size_t out_len)
int wc_Blake2bHmacInit(Blake2b * b2b, const byte * key, size_t key_len)
{
byte x_key[BLAKE2B_BLOCKBYTES];
byte i_hash[BLAKE2B_OUTBYTES];
Blake2b state;
int i;
int ret;
int ret = 0;
if (in == NULL || key == NULL || out == NULL)
if (key == NULL)
return BAD_FUNC_ARG;
if (out_len != BLAKE2B_OUTBYTES)
return BUFFER_E;
if (key_len > BLAKE2B_BLOCKBYTES) {
if ((ret = wc_InitBlake2b(&state, BLAKE2B_OUTBYTES)) != 0)
return ret;
if ((ret = wc_Blake2bUpdate(&state, key, (word32)key_len)) != 0)
return ret;
if ((ret = wc_Blake2bFinal(&state, x_key, 0)) != 0)
return ret;
ret = wc_InitBlake2b(b2b, BLAKE2B_OUTBYTES);
if (ret == 0)
ret = wc_Blake2bUpdate(b2b, key, (word32)key_len);
if (ret == 0)
ret = wc_Blake2bFinal(b2b, x_key, 0);
} else {
XMEMCPY(x_key, key, key_len);
XMEMSET(x_key + key_len, 0, BLAKE2B_BLOCKBYTES - key_len);
@@ -548,32 +540,82 @@ int wc_Blake2bHmac(const byte * in, size_t in_len,
for (i = 0; i < BLAKE2B_BLOCKBYTES; ++i)
x_key[i] ^= 0x36U;
if ((ret = wc_InitBlake2b(&state, BLAKE2B_OUTBYTES)) != 0)
return ret;
if ((ret = wc_Blake2bUpdate(&state, x_key, BLAKE2B_BLOCKBYTES)) != 0)
return ret;
if ((ret = wc_Blake2bUpdate(&state, in, (word32)in_len)) != 0)
return ret;
if ((ret = wc_Blake2bFinal(&state, i_hash, 0)) != 0)
return ret;
if (ret == 0)
ret = wc_InitBlake2b(b2b, BLAKE2B_OUTBYTES);
if (ret == 0)
ret = wc_Blake2bUpdate(b2b, x_key, BLAKE2B_BLOCKBYTES);
ForceZero(x_key, sizeof(x_key));
return ret;
}
int wc_Blake2bHmacUpdate(Blake2b * b2b, const byte * in, size_t in_len)
{
if (in == NULL)
return BAD_FUNC_ARG;
return wc_Blake2bUpdate(b2b, in, (word32)in_len);
}
int wc_Blake2bHmacFinal(Blake2b * b2b, const byte * key, size_t key_len,
byte * out, size_t out_len)
{
byte x_key[BLAKE2B_BLOCKBYTES];
int i;
int ret = 0;
if (key == NULL)
return BAD_FUNC_ARG;
if (out_len != BLAKE2B_OUTBYTES)
return BUFFER_E;
if (key_len > BLAKE2B_BLOCKBYTES) {
ret = wc_InitBlake2b(b2b, BLAKE2B_OUTBYTES);
if (ret == 0)
ret = wc_Blake2bUpdate(b2b, key, (word32)key_len);
if (ret == 0)
ret = wc_Blake2bFinal(b2b, x_key, 0);
} else {
XMEMCPY(x_key, key, key_len);
XMEMSET(x_key + key_len, 0, BLAKE2B_BLOCKBYTES - key_len);
}
for (i = 0; i < BLAKE2B_BLOCKBYTES; ++i)
x_key[i] ^= (0x5CU ^ 0x36U);
x_key[i] ^= 0x5CU;
if ((ret = wc_InitBlake2b(&state, BLAKE2B_OUTBYTES)) != 0)
return ret;
if ((ret = wc_Blake2bUpdate(&state, x_key, BLAKE2B_BLOCKBYTES)) != 0)
return ret;
if ((ret = wc_Blake2bUpdate(&state, i_hash, BLAKE2B_OUTBYTES)) != 0)
return ret;
if ((ret = wc_Blake2bFinal(&state, i_hash, 0)) != 0)
return ret;
if (ret == 0)
ret = wc_Blake2bFinal(b2b, out, 0);
XMEMCPY(out, i_hash, BLAKE2B_OUTBYTES);
ForceZero(x_key, BLAKE2B_BLOCKBYTES);
ForceZero(i_hash, BLAKE2B_OUTBYTES);
if (ret == 0)
ret = wc_InitBlake2b(b2b, BLAKE2B_OUTBYTES);
if (ret == 0)
ret = wc_Blake2bUpdate(b2b, x_key, BLAKE2B_BLOCKBYTES);
if (ret == 0)
ret = wc_Blake2bUpdate(b2b, out, BLAKE2B_OUTBYTES);
if (ret == 0)
ret = wc_Blake2bFinal(b2b, out, 0);
return 0;
ForceZero(x_key, sizeof(x_key));
return ret;
}
int wc_Blake2bHmac(const byte * in, size_t in_len,
const byte * key, size_t key_len,
byte * out, size_t out_len)
{
Blake2b state;
int ret;
ret = wc_Blake2bHmacInit(&state, key, key_len);
if (ret == 0)
ret = wc_Blake2bHmacUpdate(&state, in, in_len);
if (ret == 0)
ret = wc_Blake2bHmacFinal(&state, key, key_len, out, out_len);
return ret;
}
/* end wolfCrypt API */
+79 -37
View File
@@ -511,29 +511,21 @@ int wc_Blake2sFinal(Blake2s* b2s, byte* final, word32 requestSz)
}
int wc_Blake2sHmac(const byte * in, size_t in_len,
const byte * key, size_t key_len,
byte * out, size_t out_len)
int wc_Blake2sHmacInit(Blake2s * b2s, const byte * key, size_t key_len)
{
byte x_key[BLAKE2S_BLOCKBYTES];
byte i_hash[BLAKE2S_OUTBYTES];
Blake2s state;
int i;
int ret;
int ret = 0;
if (in == NULL || key == NULL || out == NULL)
if (key == NULL)
return BAD_FUNC_ARG;
if (out_len != BLAKE2S_OUTBYTES)
return BUFFER_E;
if (key_len > BLAKE2S_BLOCKBYTES) {
if ((ret = wc_InitBlake2s(&state, BLAKE2S_OUTBYTES)) != 0)
return ret;
if ((ret = wc_Blake2sUpdate(&state, key, (word32)key_len)) != 0)
return ret;
if ((ret = wc_Blake2sFinal(&state, x_key, 0)) != 0)
return ret;
ret = wc_InitBlake2s(b2s, BLAKE2S_OUTBYTES);
if (ret == 0)
ret = wc_Blake2sUpdate(b2s, key, (word32)key_len);
if (ret == 0)
ret = wc_Blake2sFinal(b2s, x_key, 0);
} else {
XMEMCPY(x_key, key, key_len);
XMEMSET(x_key + key_len, 0, BLAKE2S_BLOCKBYTES - key_len);
@@ -542,32 +534,82 @@ int wc_Blake2sHmac(const byte * in, size_t in_len,
for (i = 0; i < BLAKE2S_BLOCKBYTES; ++i)
x_key[i] ^= 0x36U;
if ((ret = wc_InitBlake2s(&state, BLAKE2S_OUTBYTES)) != 0)
return ret;
if ((ret = wc_Blake2sUpdate(&state, x_key, BLAKE2S_BLOCKBYTES)) != 0)
return ret;
if ((ret = wc_Blake2sUpdate(&state, in, (word32)in_len)) != 0)
return ret;
if ((ret = wc_Blake2sFinal(&state, i_hash, 0)) != 0)
return ret;
if (ret == 0)
ret = wc_InitBlake2s(b2s, BLAKE2S_OUTBYTES);
if (ret == 0)
ret = wc_Blake2sUpdate(b2s, x_key, BLAKE2S_BLOCKBYTES);
ForceZero(x_key, sizeof(x_key));
return ret;
}
int wc_Blake2sHmacUpdate(Blake2s * b2s, const byte * in, size_t in_len)
{
if (in == NULL)
return BAD_FUNC_ARG;
return wc_Blake2sUpdate(b2s, in, (word32)in_len);
}
int wc_Blake2sHmacFinal(Blake2s * b2s, const byte * key, size_t key_len,
byte * out, size_t out_len)
{
byte x_key[BLAKE2S_BLOCKBYTES];
int i;
int ret = 0;
if (key == NULL)
return BAD_FUNC_ARG;
if (out_len != BLAKE2S_OUTBYTES)
return BUFFER_E;
if (key_len > BLAKE2S_BLOCKBYTES) {
ret = wc_InitBlake2s(b2s, BLAKE2S_OUTBYTES);
if (ret == 0)
ret = wc_Blake2sUpdate(b2s, key, (word32)key_len);
if (ret == 0)
ret = wc_Blake2sFinal(b2s, x_key, 0);
} else {
XMEMCPY(x_key, key, key_len);
XMEMSET(x_key + key_len, 0, BLAKE2S_BLOCKBYTES - key_len);
}
for (i = 0; i < BLAKE2S_BLOCKBYTES; ++i)
x_key[i] ^= (0x5CU ^ 0x36U);
x_key[i] ^= 0x5CU;
if ((ret = wc_InitBlake2s(&state, BLAKE2S_OUTBYTES)) != 0)
return ret;
if ((ret = wc_Blake2sUpdate(&state, x_key, BLAKE2S_BLOCKBYTES)) != 0)
return ret;
if ((ret = wc_Blake2sUpdate(&state, i_hash, BLAKE2S_OUTBYTES)) != 0)
return ret;
if ((ret = wc_Blake2sFinal(&state, i_hash, 0)) != 0)
return ret;
if (ret == 0)
ret = wc_Blake2sFinal(b2s, out, 0);
XMEMCPY(out, i_hash, BLAKE2S_OUTBYTES);
ForceZero(x_key, BLAKE2S_BLOCKBYTES);
ForceZero(i_hash, BLAKE2S_OUTBYTES);
if (ret == 0)
ret = wc_InitBlake2s(b2s, BLAKE2S_OUTBYTES);
if (ret == 0)
ret = wc_Blake2sUpdate(b2s, x_key, BLAKE2S_BLOCKBYTES);
if (ret == 0)
ret = wc_Blake2sUpdate(b2s, out, BLAKE2S_OUTBYTES);
if (ret == 0)
ret = wc_Blake2sFinal(b2s, out, 0);
return 0;
ForceZero(x_key, sizeof(x_key));
return ret;
}
int wc_Blake2sHmac(const byte * in, size_t in_len,
const byte * key, size_t key_len,
byte * out, size_t out_len)
{
Blake2s state;
int ret;
ret = wc_Blake2sHmacInit(&state, key, key_len);
if (ret == 0)
ret = wc_Blake2sHmacUpdate(&state, in, in_len);
if (ret == 0)
ret = wc_Blake2sHmacFinal(&state, key, key_len, out, out_len);
return ret;
}
/* end wolfCrypt API */
+54 -2
View File
@@ -4702,8 +4702,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_hmac_test(void)
};
byte out[BLAKE2B_OUTBYTES];
int ret;
Blake2b b2b;
ret = wc_Blake2bHmac(message1, sizeof(message1),
key1, sizeof(key1), out, sizeof(out));
@@ -4719,6 +4719,32 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2b_hmac_test(void)
if (XMEMCMP(out, expected2, sizeof(out)) != 0)
return WC_TEST_RET_ENC_NC;
ret = wc_Blake2bHmacInit(&b2b, key1, sizeof(key1));
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2bHmacUpdate(&b2b, message1, sizeof(message1) / 2u);
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2bHmacUpdate(&b2b, &message1[sizeof(message1) / 2u], sizeof(message1) - sizeof(message1) / 2u);
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2bHmacFinal(&b2b, key1, sizeof(key1), out, sizeof(out));
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2bHmacInit(&b2b, key2, sizeof(key2));
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2bHmacUpdate(&b2b, message2, sizeof(message2) / 2u);
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2bHmacUpdate(&b2b, &message2[sizeof(message2) / 2u], sizeof(message2) - sizeof(message2) / 2u);
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2bHmacFinal(&b2b, key2, sizeof(key2), out, sizeof(out));
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
return 0;
}
#endif /* HAVE_BLAKE2 */
@@ -4814,8 +4840,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2s_hmac_test(void)
};
byte out[BLAKE2S_OUTBYTES];
int ret;
Blake2s b2s;
ret = wc_Blake2sHmac(message1, sizeof(message1),
key1, sizeof(key1), out, sizeof(out));
@@ -4831,6 +4857,32 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t blake2s_hmac_test(void)
if (XMEMCMP(out, expected2, sizeof(out)) != 0)
return WC_TEST_RET_ENC_NC;
ret = wc_Blake2sHmacInit(&b2s, key1, sizeof(key1));
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2sHmacUpdate(&b2s, message1, sizeof(message1) / 2u);
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2sHmacUpdate(&b2s, &message1[sizeof(message1) / 2u], sizeof(message1) - sizeof(message1) / 2u);
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2sHmacFinal(&b2s, key1, sizeof(key1), out, sizeof(out));
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2sHmacInit(&b2s, key2, sizeof(key2));
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2sHmacUpdate(&b2s, message2, sizeof(message2) / 2u);
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2sHmacUpdate(&b2s, &message2[sizeof(message2) / 2u], sizeof(message2) - sizeof(message2) / 2u);
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
ret = wc_Blake2sHmacFinal(&b2s, key2, sizeof(key2), out, sizeof(out));
if (ret != 0)
return WC_TEST_RET_ENC_EC(ret);
return 0;
}
#endif /* HAVE_BLAKE2S */
+14
View File
@@ -88,6 +88,13 @@ WOLFSSL_API int wc_InitBlake2b_WithKey(Blake2b* b2b, word32 digestSz,
const byte *key, word32 keylen);
WOLFSSL_API int wc_Blake2bUpdate(Blake2b* b2b, const byte* data, word32 sz);
WOLFSSL_API int wc_Blake2bFinal(Blake2b* b2b, byte* final, word32 requestSz);
WOLFSSL_API int wc_Blake2bHmacInit(Blake2b * b2b,
const byte * key, size_t key_len);
WOLFSSL_API int wc_Blake2bHmacUpdate(Blake2b * b2b,
const byte * in, size_t in_len);
WOLFSSL_API int wc_Blake2bHmacFinal(Blake2b * b2b,
const byte * key, size_t key_len,
byte * out, size_t out_len);
WOLFSSL_API int wc_Blake2bHmac(const byte * in, size_t in_len,
const byte * key, size_t key_len,
byte * out, size_t out_len);
@@ -99,6 +106,13 @@ WOLFSSL_API int wc_InitBlake2s_WithKey(Blake2s* b2s, word32 digestSz,
const byte *key, word32 keylen);
WOLFSSL_API int wc_Blake2sUpdate(Blake2s* b2s, const byte* data, word32 sz);
WOLFSSL_API int wc_Blake2sFinal(Blake2s* b2s, byte* final, word32 requestSz);
WOLFSSL_API int wc_Blake2sHmacInit(Blake2s * b2s,
const byte * key, size_t key_len);
WOLFSSL_API int wc_Blake2sHmacUpdate(Blake2s * b2s,
const byte * in, size_t in_len);
WOLFSSL_API int wc_Blake2sHmacFinal(Blake2s * b2s,
const byte * key, size_t key_len,
byte * out, size_t out_len);
WOLFSSL_API int wc_Blake2sHmac(const byte * in, size_t in_len,
const byte * key, size_t key_len,
byte * out, size_t out_len);