diff --git a/src/libcrypto-compat.c b/src/libcrypto-compat.c index 1d1bb10d..d9857463 100644 --- a/src/libcrypto-compat.c +++ b/src/libcrypto-compat.c @@ -12,10 +12,6 @@ #include #include "libcrypto-compat.h" -#ifndef OPENSSL_NO_ENGINE -#include -#endif - int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) { /* If the fields n and e in r are NULL, the corresponding input @@ -234,44 +230,9 @@ EVP_MD_CTX *EVP_MD_CTX_new(void) return ctx; } -static void OPENSSL_clear_free(void *str, size_t num) -{ - if (str == NULL) - return; - if (num) - OPENSSL_cleanse(str, num); - OPENSSL_free(str); -} - -/* This call frees resources associated with the context */ -int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) -{ - if (ctx == NULL) - return 1; - - /* - * Don't assume ctx->md_data was cleaned in EVP_Digest_Final, because - * sometimes only copies of the context are ever finalised. - */ - if (ctx->digest && ctx->digest->cleanup - && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_CLEANED)) - ctx->digest->cleanup(ctx); - if (ctx->digest && ctx->digest->ctx_size && ctx->md_data - && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) { - OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size); - } - EVP_PKEY_CTX_free(ctx->pctx); -#ifndef OPENSSL_NO_ENGINE - ENGINE_finish(ctx->engine); -#endif - OPENSSL_cleanse(ctx, sizeof(*ctx)); - - return 1; -} - void EVP_MD_CTX_free(EVP_MD_CTX *ctx) { - EVP_MD_CTX_reset(ctx); + EVP_MD_CTX_cleanup(ctx); OPENSSL_free(ctx); } diff --git a/src/libcrypto-compat.h b/src/libcrypto-compat.h index 0082e207..31f361e8 100644 --- a/src/libcrypto-compat.h +++ b/src/libcrypto-compat.h @@ -30,7 +30,6 @@ int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s); void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); -int EVP_MD_CTX_reset(EVP_MD_CTX *ctx); EVP_MD_CTX *EVP_MD_CTX_new(void); void EVP_MD_CTX_free(EVP_MD_CTX *ctx);