From 3bf01072d859f1844e7db8cd0b1d8448bcb02f52 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Wed, 17 Apr 2019 14:04:00 -0700 Subject: [PATCH] EVP Init Fix When calling wolfSSL_EVP_DigestInit() with an unsupported string, the macType should be set to NONE, rather than ignored. In a particular build combination, functions using that EVP could false the type because of memory garbage. Just set it in the else case. --- src/ssl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ssl.c b/src/ssl.c index b3d46dcc4..900cfb948 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -14251,8 +14251,10 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md) ret = wolfSSL_SHA_Init(&(ctx->hash.digest.sha)); } #endif /* NO_SHA */ - else + else { + ctx->macType = WC_HASH_TYPE_NONE; return BAD_FUNC_ARG; + } return ret; }