@@ -5527,12 +5527,14 @@ static int KeyAgreeEcdhMlKem_client(WOLFSSH* ssh, byte hashId,
55275527 int ret = WS_SUCCESS;
55285528 byte sharedSecretHashSz = 0;
55295529 byte *sharedSecretHash = NULL;
5530- MlKemKey kem = {0} ;
5530+ MlKemKey kem;
55315531 word32 length_ciphertext = 0;
55325532 word32 length_sharedsecret = 0;
55335533 word32 length_privatekey = 0;
55345534 int mlKemType = WC_ML_KEM_768;
55355535 byte kexId = ssh->handshake->kexId;
5536+
5537+ WMEMSET(&kem, 0, sizeof(kem));
55365538#if !defined(WOLFSSH_NO_NISTP256_MLKEM768_SHA256) || \
55375539 !defined(WOLFSSH_NO_NISTP384_MLKEM1024_SHA384)
55385540 ecc_key *key_ptr = NULL;
@@ -5694,7 +5696,7 @@ static int KeyAgreeEcdhMlKem_client(WOLFSSH* ssh, byte hashId,
56945696 /* Replace the concatenated shared secrets with the hash. That
56955697 * will become the new shared secret. */
56965698 if (ret == 0) {
5697- sharedSecretHashSz = wc_HashGetDigestSize(hashId);
5699+ sharedSecretHashSz = wc_HashGetDigestSize((enum wc_HashType) hashId);
56985700 sharedSecretHash = (byte *)WMALLOC(sharedSecretHashSz,
56995701 ssh->ctx->heap,
57005702 DYNTYPE_PRIVKEY);
@@ -5704,8 +5706,8 @@ static int KeyAgreeEcdhMlKem_client(WOLFSSH* ssh, byte hashId,
57045706 }
57055707
57065708 if (ret == 0) {
5707- ret = wc_Hash(hashId, ssh->k, ssh->kSz, sharedSecretHash ,
5708- sharedSecretHashSz);
5709+ ret = wc_Hash((enum wc_HashType) hashId, ssh->k, ssh->kSz,
5710+ sharedSecretHash, sharedSecretHashSz);
57095711 }
57105712
57115713 if (ret == 0) {
@@ -12144,12 +12146,14 @@ static int KeyAgreeEcdhMlKem_server(WOLFSSH* ssh, byte hashId,
1214412146 int ret = WS_SUCCESS;
1214512147 byte sharedSecretHashSz = 0;
1214612148 byte *sharedSecretHash = NULL;
12147- MlKemKey kem = {0} ;
12149+ MlKemKey kem;
1214812150 word32 length_publickey = 0;
1214912151 word32 length_ciphertext = 0;
1215012152 word32 length_sharedsecret = 0;
1215112153 int mlKemType = WC_ML_KEM_768;
1215212154 byte kexId = ssh->handshake->kexId;
12155+
12156+ WMEMSET(&kem, 0, sizeof(kem));
1215312157#if !defined(WOLFSSH_NO_NISTP256_MLKEM768_SHA256) || \
1215412158 !defined(WOLFSSH_NO_NISTP384_MLKEM1024_SHA384)
1215512159 ecc_key* pubKey = NULL;
@@ -12366,16 +12370,16 @@ static int KeyAgreeEcdhMlKem_server(WOLFSSH* ssh, byte hashId,
1236612370 /* Replace the concatenated shared secrets with the hash. That
1236712371 * will become the new shared secret.*/
1236812372 if (ret == 0) {
12369- sharedSecretHashSz = wc_HashGetDigestSize(hashId);
12373+ sharedSecretHashSz = wc_HashGetDigestSize((enum wc_HashType) hashId);
1237012374 sharedSecretHash = (byte *)WMALLOC(sharedSecretHashSz,
1237112375 ssh->ctx->heap, DYNTYPE_PRIVKEY);
1237212376 if (sharedSecretHash == NULL) {
1237312377 ret = WS_MEMORY_E;
1237412378 }
1237512379 }
1237612380 if (ret == 0) {
12377- ret = wc_Hash(hashId, ssh->k, ssh->kSz, sharedSecretHash ,
12378- sharedSecretHashSz);
12381+ ret = wc_Hash((enum wc_HashType) hashId, ssh->k, ssh->kSz,
12382+ sharedSecretHash, sharedSecretHashSz);
1237912383 }
1238012384 if (ret == 0) {
1238112385 XMEMCPY(ssh->k, sharedSecretHash, sharedSecretHashSz);
@@ -13554,12 +13558,14 @@ int SendKexDhInit(WOLFSSH* ssh)
1355413558 !defined(WOLFSSH_NO_NISTP384_MLKEM1024_SHA384) || \
1355513559 !defined(WOLFSSH_NO_CURVE25519_MLKEM768_SHA256)
1355613560 if (ssh->handshake->useEccMlKem) {
13557- MlKemKey kem = {0} ;
13561+ MlKemKey kem;
1355813562 word32 length_publickey = 0;
1355913563 word32 length_privatekey = 0;
1356013564 int mlKemType = WC_ML_KEM_768;
1356113565 ret = 0;
1356213566
13567+ WMEMSET(&kem, 0, sizeof(kem));
13568+
1356313569#ifndef WOLFSSH_NO_NISTP384_MLKEM1024_SHA384
1356413570 if (ssh->handshake->kexId == ID_NISTP384_MLKEM1024_SHA384) {
1356513571 mlKemType = WC_ML_KEM_1024;
0 commit comments