Skip to content

Commit 31dfdf8

Browse files
author
gojimmypi
committed
TLS SM2, SM3, SM4-CBC: hash details for SM3
1 parent 746802b commit 31dfdf8

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/tls.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ static int Hmac_UpdateFinal(Hmac* hmac, byte* digest, const byte* in,
10521052
word32 sz, byte* header)
10531053
{
10541054
byte dummy[WC_MAX_BLOCK_SIZE] = {0};
1055-
int ret;
1055+
int ret = 0;
10561056
word32 msgSz, blockSz, macSz, padSz, maxSz, realSz;
10571057
word32 offset = 0;
10581058
int msgBlocks, blocks, blockBits;
@@ -1104,7 +1104,17 @@ static int Hmac_UpdateFinal(Hmac* hmac, byte* digest, const byte* in,
11041104
break;
11051105
#endif /* HAVE_BLAKE2 */
11061106

1107+
#ifdef WOLFSSL_SM3
1108+
case WC_SM3:
1109+
blockSz = WC_SM3_BLOCK_SIZE;
1110+
blockBits = 6;
1111+
macSz = WC_SM3_DIGEST_SIZE;
1112+
padSz = WC_SM3_BLOCK_SIZE - WC_SM3_PAD_SIZE + 1;
1113+
break;
1114+
#endif
1115+
11071116
default:
1117+
WOLFSSL_MSG("ERROR: Hmac_UpdateFinal failed, no hmac->macType");
11081118
return BAD_FUNC_ARG;
11091119
}
11101120

0 commit comments

Comments
 (0)