mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-28 06:02:22 +01:00
wolfcrypt/src/hmac.c and wolfssl/wolfcrypt/hmac.h: implement WOLFSSL_API wc_HmacCopy(), and remove the WOLFSSL_HMAC_COPY_HASH gate on HmacKeyCopyHash().
This commit is contained in:
@@ -248,7 +248,6 @@ int _InitHmac(Hmac* hmac, int type, void* heap)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_HMAC_COPY_HASH
|
||||
static int HmacKeyCopyHash(byte macType, wc_HmacHash* src, wc_HmacHash* dst)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -323,7 +322,21 @@ static int HmacKeyCopyHash(byte macType, wc_HmacHash* src, wc_HmacHash* dst)
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
int wc_HmacCopy(Hmac* src, Hmac* dst) {
|
||||
int ret;
|
||||
|
||||
if ((src == NULL) || (dst == NULL))
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
XMEMCPY(dst, src, sizeof(*dst));
|
||||
|
||||
ret = HmacKeyCopyHash(src->macType, &src->hash, &dst->hash);
|
||||
|
||||
if (ret != 0)
|
||||
XMEMSET(dst, 0, sizeof(*dst));
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int HmacKeyHashUpdate(byte macType, wc_HmacHash* hash, byte* pad)
|
||||
{
|
||||
|
||||
@@ -190,6 +190,7 @@ WOLFSSL_API int wc_HmacInit_Id(Hmac* hmac, byte* id, int len, void* heap,
|
||||
WOLFSSL_API int wc_HmacInit_Label(Hmac* hmac, const char* label, void* heap,
|
||||
int devId);
|
||||
#endif
|
||||
WOLFSSL_API int wc_HmacCopy(Hmac* src, Hmac* dst);
|
||||
WOLFSSL_API void wc_HmacFree(Hmac* hmac);
|
||||
|
||||
WOLFSSL_API int wolfSSL_GetHmacMaxSize(void);
|
||||
|
||||
Reference in New Issue
Block a user