diff options
Diffstat (limited to '')
-rw-r--r-- | src/lib/libcrypto/evp/p_verify.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/libcrypto/evp/p_verify.c b/src/lib/libcrypto/evp/p_verify.c index ed9b3700fe..04b7c39c65 100644 --- a/src/lib/libcrypto/evp/p_verify.c +++ b/src/lib/libcrypto/evp/p_verify.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: p_verify.c,v 1.19 2024/02/18 15:45:42 tb Exp $ */ | 1 | /* $OpenBSD: p_verify.c,v 1.20 2024/03/26 05:50:49 joshua Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -71,16 +71,16 @@ EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, | |||
71 | { | 71 | { |
72 | unsigned char m[EVP_MAX_MD_SIZE]; | 72 | unsigned char m[EVP_MAX_MD_SIZE]; |
73 | unsigned int m_len; | 73 | unsigned int m_len; |
74 | EVP_MD_CTX tmp_ctx; | 74 | EVP_MD_CTX *md_ctx; |
75 | EVP_PKEY_CTX *pkctx = NULL; | 75 | EVP_PKEY_CTX *pkctx = NULL; |
76 | int ret = 0; | 76 | int ret = 0; |
77 | 77 | ||
78 | EVP_MD_CTX_legacy_clear(&tmp_ctx); | 78 | if ((md_ctx = EVP_MD_CTX_new()) == NULL) |
79 | if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) | ||
80 | goto err; | 79 | goto err; |
81 | if (!EVP_DigestFinal_ex(&tmp_ctx, &(m[0]), &m_len)) | 80 | if (!EVP_MD_CTX_copy_ex(md_ctx, ctx)) |
81 | goto err; | ||
82 | if (!EVP_DigestFinal_ex(md_ctx, &(m[0]), &m_len)) | ||
82 | goto err; | 83 | goto err; |
83 | EVP_MD_CTX_cleanup(&tmp_ctx); | ||
84 | 84 | ||
85 | ret = -1; | 85 | ret = -1; |
86 | if ((pkctx = EVP_PKEY_CTX_new(pkey, NULL)) == NULL) | 86 | if ((pkctx = EVP_PKEY_CTX_new(pkey, NULL)) == NULL) |
@@ -92,6 +92,7 @@ EVP_VerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sigbuf, | |||
92 | ret = EVP_PKEY_verify(pkctx, sigbuf, siglen, m, m_len); | 92 | ret = EVP_PKEY_verify(pkctx, sigbuf, siglen, m, m_len); |
93 | 93 | ||
94 | err: | 94 | err: |
95 | EVP_MD_CTX_free(md_ctx); | ||
95 | EVP_PKEY_CTX_free(pkctx); | 96 | EVP_PKEY_CTX_free(pkctx); |
96 | return ret; | 97 | return ret; |
97 | } | 98 | } |