summaryrefslogtreecommitdiffstats
path: root/crypto/evp/m_sigver.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-09-26 15:31:56 +0200
committerMatt Caswell <matt@openssl.org>2019-10-03 10:47:34 +0200
commit15de965ff04ccecb068f3ce6c643555dce9372c6 (patch)
treeed0bd7181c9c810c1b1e0c876e0ca18a24f4d2fd /crypto/evp/m_sigver.c
parentAdd a test for the newly added md params code (diff)
downloadopenssl-15de965ff04ccecb068f3ce6c643555dce9372c6.tar.xz
openssl-15de965ff04ccecb068f3ce6c643555dce9372c6.zip
Don't call EVP_MD_CTX_reset during EVP_DigestFinal
This resets the fields of the EVP_MD_CTX and means we can no longer make calls using the EVP_MD_CTX, such as to query parameters. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/10013)
Diffstat (limited to 'crypto/evp/m_sigver.c')
-rw-r--r--crypto/evp/m_sigver.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/evp/m_sigver.c b/crypto/evp/m_sigver.c
index 8b7a3e88b3..85272c9516 100644
--- a/crypto/evp/m_sigver.c
+++ b/crypto/evp/m_sigver.c
@@ -31,6 +31,16 @@ static int do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
void *provkey = NULL;
int ret;
+ if (ctx->provctx != NULL) {
+ if (!ossl_assert(ctx->digest != NULL)) {
+ ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
+ return 0;
+ }
+ if (ctx->digest->freectx != NULL)
+ ctx->digest->freectx(ctx->provctx);
+ ctx->provctx = NULL;
+ }
+
if (ctx->pctx == NULL) {
ctx->pctx = EVP_PKEY_CTX_new(pkey, e);
if (ctx->pctx == NULL)