Skip to content

Commit 16e1d33

Browse files
committed
Fix invalid preprocessor guard in PKCS7 with SHA224
Also add missing ForceZero for ECDH shared secret on the heap.
1 parent 5634cfd commit 16e1d33

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

wolfcrypt/src/pkcs7.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7782,7 +7782,7 @@ static int wc_PKCS7_KariGenerateKEK(WC_PKCS7_KARI* kari, WC_RNG* rng,
77827782
kdfType = WC_HASH_TYPE_SHA;
77837783
break;
77847784
#endif
7785-
#ifndef WOLFSSL_SHA224
7785+
#ifdef WOLFSSL_SHA224
77867786
case dhSinglePass_stdDH_sha224kdf_scheme:
77877787
kdfType = WC_HASH_TYPE_SHA224;
77887788
break;
@@ -7804,6 +7804,7 @@ static int wc_PKCS7_KariGenerateKEK(WC_PKCS7_KARI* kari, WC_RNG* rng,
78047804
#endif
78057805
default:
78067806
WOLFSSL_MSG("Unsupported key agreement algorithm");
7807+
ForceZero(secret, secretSz);
78077808
XFREE(secret, kari->heap, DYNAMIC_TYPE_PKCS7);
78087809
return BAD_FUNC_ARG;
78097810
};
@@ -7816,6 +7817,7 @@ static int wc_PKCS7_KariGenerateKEK(WC_PKCS7_KARI* kari, WC_RNG* rng,
78167817
ret = NOT_COMPILED_IN;
78177818
#endif
78187819

7820+
ForceZero(secret, secretSz);
78197821
XFREE(secret, kari->heap, DYNAMIC_TYPE_PKCS7);
78207822
return ret;
78217823
}

0 commit comments

Comments
 (0)