mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Merge pull request #6647 from gojimmypi/SM4_Hash_fix
WOLFSSL_NO_HASH_RAW Hmac_UpdateFinal() properties for SM3
This commit is contained in:
12
src/tls.c
12
src/tls.c
@ -1052,7 +1052,7 @@ static int Hmac_UpdateFinal(Hmac* hmac, byte* digest, const byte* in,
|
|||||||
word32 sz, byte* header)
|
word32 sz, byte* header)
|
||||||
{
|
{
|
||||||
byte dummy[WC_MAX_BLOCK_SIZE] = {0};
|
byte dummy[WC_MAX_BLOCK_SIZE] = {0};
|
||||||
int ret;
|
int ret = 0;
|
||||||
word32 msgSz, blockSz, macSz, padSz, maxSz, realSz;
|
word32 msgSz, blockSz, macSz, padSz, maxSz, realSz;
|
||||||
word32 offset = 0;
|
word32 offset = 0;
|
||||||
int msgBlocks, blocks, blockBits;
|
int msgBlocks, blocks, blockBits;
|
||||||
@ -1104,7 +1104,17 @@ static int Hmac_UpdateFinal(Hmac* hmac, byte* digest, const byte* in,
|
|||||||
break;
|
break;
|
||||||
#endif /* HAVE_BLAKE2 */
|
#endif /* HAVE_BLAKE2 */
|
||||||
|
|
||||||
|
#ifdef WOLFSSL_SM3
|
||||||
|
case WC_SM3:
|
||||||
|
blockSz = WC_SM3_BLOCK_SIZE;
|
||||||
|
blockBits = 6;
|
||||||
|
macSz = WC_SM3_DIGEST_SIZE;
|
||||||
|
padSz = WC_SM3_BLOCK_SIZE - WC_SM3_PAD_SIZE + 1;
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
WOLFSSL_MSG("ERROR: Hmac_UpdateFinal failed, no hmac->macType");
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user