Skip to content

Commit f55ebd5

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

wolfcrypt/src/pkcs7.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7771,7 +7771,7 @@ static int wc_PKCS7_KariGenerateKEK(WC_PKCS7_KARI* kari, WC_RNG* rng,
77717771
kdfType = WC_HASH_TYPE_SHA;
77727772
break;
77737773
#endif
7774-
#ifndef WOLFSSL_SHA224
7774+
#ifdef WOLFSSL_SHA224
77757775
case dhSinglePass_stdDH_sha224kdf_scheme:
77767776
kdfType = WC_HASH_TYPE_SHA224;
77777777
break;
@@ -7793,6 +7793,7 @@ static int wc_PKCS7_KariGenerateKEK(WC_PKCS7_KARI* kari, WC_RNG* rng,
77937793
#endif
77947794
default:
77957795
WOLFSSL_MSG("Unsupported key agreement algorithm");
7796+
ForceZero(secret, secretSz);
77967797
XFREE(secret, kari->heap, DYNAMIC_TYPE_PKCS7);
77977798
return BAD_FUNC_ARG;
77987799
};
@@ -7805,6 +7806,7 @@ static int wc_PKCS7_KariGenerateKEK(WC_PKCS7_KARI* kari, WC_RNG* rng,
78057806
ret = NOT_COMPILED_IN;
78067807
#endif
78077808

7809+
ForceZero(secret, secretSz);
78087810
XFREE(secret, kari->heap, DYNAMIC_TYPE_PKCS7);
78097811
return ret;
78107812
}

0 commit comments

Comments
 (0)