From 7c54c7664c87e73b5c932631260c133506652927 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 26 Mar 2024 01:41:06 +0000 Subject: [PATCH] Garbage collect the unused verifyctx() and verifyctx_init() ok joshua jsing --- lib/libcrypto/evp/evp_local.h | 6 +----- lib/libcrypto/evp/m_sigver.c | 22 ++++------------------ 2 files changed, 5 insertions(+), 23 deletions(-) diff --git a/lib/libcrypto/evp/evp_local.h b/lib/libcrypto/evp/evp_local.h index d0335931e54..b1c0c9b14ee 100644 --- a/lib/libcrypto/evp/evp_local.h +++ b/lib/libcrypto/evp/evp_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_local.h,v 1.20 2024/03/24 06:05:41 tb Exp $ */ +/* $OpenBSD: evp_local.h,v 1.21 2024/03/26 01:41:06 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2000. */ @@ -307,10 +307,6 @@ struct evp_pkey_method_st { int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, EVP_MD_CTX *mctx); - int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); - int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, - int siglen, EVP_MD_CTX *mctx); - int (*encrypt_init)(EVP_PKEY_CTX *ctx); int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen); diff --git a/lib/libcrypto/evp/m_sigver.c b/lib/libcrypto/evp/m_sigver.c index f89f6034bf5..5fe3cc89641 100644 --- a/lib/libcrypto/evp/m_sigver.c +++ b/lib/libcrypto/evp/m_sigver.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m_sigver.c,v 1.18 2024/03/25 11:41:40 joshua Exp $ */ +/* $OpenBSD: m_sigver.c,v 1.19 2024/03/26 01:41:06 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -95,12 +95,7 @@ do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, } if (ver) { - if (ctx->pctx->pmeth->verifyctx_init) { - if (ctx->pctx->pmeth->verifyctx_init(ctx->pctx, - ctx) <=0) - return 0; - ctx->pctx->operation = EVP_PKEY_OP_VERIFYCTX; - } else if (ctx->pctx->pmeth->digestverify != NULL) { + if (ctx->pctx->pmeth->digestverify != NULL) { ctx->pctx->operation = EVP_PKEY_OP_VERIFY; ctx->update = update_oneshot_only; } else if (EVP_PKEY_verify_init(ctx->pctx) <= 0) @@ -233,22 +228,13 @@ EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const unsigned char *sig, size_t siglen) unsigned char md[EVP_MAX_MD_SIZE]; int r; unsigned int mdlen = 0; - int vctx; - if (ctx->pctx->pmeth->verifyctx) - vctx = 1; - else - vctx = 0; EVP_MD_CTX_legacy_clear(&tmp_ctx); if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) return -1; - if (vctx) { - r = tmp_ctx.pctx->pmeth->verifyctx(tmp_ctx.pctx, sig, - siglen, &tmp_ctx); - } else - r = EVP_DigestFinal_ex(&tmp_ctx, md, &mdlen); + r = EVP_DigestFinal_ex(&tmp_ctx, md, &mdlen); EVP_MD_CTX_cleanup(&tmp_ctx); - if (vctx || !r) + if (!r) return r; return EVP_PKEY_verify(ctx->pctx, sig, siglen, md, mdlen); } -- 2.20.1