[openssl] master update
Dr. Paul Dale
pauli at openssl.org
Thu Nov 4 23:23:51 UTC 2021
The branch master has been updated
via 10cf46c4ef93e22f999b7b6d2c3aadc4db965e5a (commit)
from 3a069c1b0b4857b838186aeb55378195dfa50823 (commit)
- Log -----------------------------------------------------------------
commit 10cf46c4ef93e22f999b7b6d2c3aadc4db965e5a
Author: Pauli <pauli at openssl.org>
Date: Wed Nov 3 09:21:46 2021 +1000
Remove redundant tests
Removed the three checks of type against NULL since type cannot be NULL for
any of them.
Moved a check of ->engine inside a CPP guard for engines.
Didn't address the teardown and rebuild of the provider context.
Partially fixes #16947
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16952)
-----------------------------------------------------------------------
Summary of changes:
crypto/evp/digest.c | 31 ++++++++++++++++---------------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 1f2910bc69..ebee9d8d76 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -180,21 +180,20 @@ static int evp_md_init_internal(EVP_MD_CTX *ctx, const EVP_MD *type,
* previous handle, re-querying for an ENGINE, and having a
* reinitialisation, when it may all be unnecessary.
*/
- if (ctx->engine && ctx->digest &&
- (type == NULL || (type->type == ctx->digest->type)))
+ if (ctx->engine != NULL
+ && ctx->digest != NULL
+ && type->type == ctx->digest->type)
goto skip_to_init;
- if (type != NULL) {
- /*
- * Ensure an ENGINE left lying around from last time is cleared (the
- * previous check attempted to avoid this if the same ENGINE and
- * EVP_MD could be used).
- */
- ENGINE_finish(ctx->engine);
- ctx->engine = NULL;
- }
+ /*
+ * Ensure an ENGINE left lying around from last time is cleared (the
+ * previous check attempted to avoid this if the same ENGINE and
+ * EVP_MD could be used).
+ */
+ ENGINE_finish(ctx->engine);
+ ctx->engine = NULL;
- if (type != NULL && impl == NULL)
+ if (impl == NULL)
tmpimpl = ENGINE_get_digest_engine(type->type);
#endif
@@ -202,10 +201,12 @@ static int evp_md_init_internal(EVP_MD_CTX *ctx, const EVP_MD *type,
* If there are engines involved or EVP_MD_CTX_FLAG_NO_INIT is set then we
* should use legacy handling for now.
*/
- if (ctx->engine != NULL
- || impl != NULL
-#if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODULE)
+ if (impl != NULL
+#if !defined(OPENSSL_NO_ENGINE)
+ || ctx->engine != NULL
+# if !defined(FIPS_MODULE)
|| tmpimpl != NULL
+# endif
#endif
|| (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) != 0) {
if (ctx->digest == ctx->fetched_digest)
More information about the openssl-commits
mailing list