evp.c: fix gating in wolfSSL_EVP_CIPHER_CTX_cleanup() to avoid switch-unreachable; also fix indentation.

This commit is contained in:
Daniel Pouzzner
2023-02-01 01:29:36 -06:00
parent 38c057a084
commit a8a61fe6b7

View File

@ -5991,8 +5991,15 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
if (ctx) {
#if (!defined(HAVE_FIPS) && !defined(HAVE_SELFTEST)) || \
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
#if (defined(HAVE_AESGCM) && defined(WOLFSSL_AESGCM_STREAM)) || \
defined(HAVE_AESCCM) || \
defined(HAVE_AESCBC) || \
defined(WOLFSSL_AES_COUNTER) || \
defined(HAVE_AES_ECB) || \
defined(HAVE_AES_CFB) || \
defined(HAVE_AES_OFB) || \
defined(WOLFSSL_AES_XTS)
#ifndef NO_AES
switch (ctx->cipherType) {
#if defined(HAVE_AESGCM) && defined(WOLFSSL_AESGCM_STREAM)
case AES_128_GCM_TYPE:
@ -6041,8 +6048,10 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD* type)
#endif
wc_AesFree(&ctx->cipher.aes);
}
#endif /* !NO_AES */
#endif /* AES */
#endif /* not FIPS or FIPS v2+ */
ctx->cipherType = WOLFSSL_EVP_CIPH_TYPE_INIT; /* not yet initialized */
#if defined(HAVE_CHACHA) && defined(HAVE_POLY1305)
if (ctx->key) {