diff options
| author | tb <> | 2024-03-26 01:41:06 +0000 |
|---|---|---|
| committer | tb <> | 2024-03-26 01:41:06 +0000 |
| commit | a8e30fcbc007cf9ca032538900879a19999e0c29 (patch) | |
| tree | 32b2ac634a93c4f274cba242ff5c9c4ddb5f3b6e /src | |
| parent | 10d527661f9dc00eb65b21f4523d500aad44ca8d (diff) | |
| download | openbsd-a8e30fcbc007cf9ca032538900879a19999e0c29.tar.gz openbsd-a8e30fcbc007cf9ca032538900879a19999e0c29.tar.bz2 openbsd-a8e30fcbc007cf9ca032538900879a19999e0c29.zip | |
Garbage collect the unused verifyctx() and verifyctx_init()
ok joshua jsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/evp/evp_local.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/evp/m_sigver.c | 22 |
2 files changed, 5 insertions, 23 deletions
diff --git a/src/lib/libcrypto/evp/evp_local.h b/src/lib/libcrypto/evp/evp_local.h index d0335931e5..b1c0c9b14e 100644 --- a/src/lib/libcrypto/evp/evp_local.h +++ b/src/lib/libcrypto/evp/evp_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: evp_local.h,v 1.20 2024/03/24 06:05:41 tb Exp $ */ | 1 | /* $OpenBSD: evp_local.h,v 1.21 2024/03/26 01:41:06 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -307,10 +307,6 @@ struct evp_pkey_method_st { | |||
| 307 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, | 307 | int (*signctx)(EVP_PKEY_CTX *ctx, unsigned char *sig, size_t *siglen, |
| 308 | EVP_MD_CTX *mctx); | 308 | EVP_MD_CTX *mctx); |
| 309 | 309 | ||
| 310 | int (*verifyctx_init)(EVP_PKEY_CTX *ctx, EVP_MD_CTX *mctx); | ||
| 311 | int (*verifyctx)(EVP_PKEY_CTX *ctx, const unsigned char *sig, | ||
| 312 | int siglen, EVP_MD_CTX *mctx); | ||
| 313 | |||
| 314 | int (*encrypt_init)(EVP_PKEY_CTX *ctx); | 310 | int (*encrypt_init)(EVP_PKEY_CTX *ctx); |
| 315 | int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, | 311 | int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen, |
| 316 | const unsigned char *in, size_t inlen); | 312 | const unsigned char *in, size_t inlen); |
diff --git a/src/lib/libcrypto/evp/m_sigver.c b/src/lib/libcrypto/evp/m_sigver.c index f89f6034bf..5fe3cc8964 100644 --- a/src/lib/libcrypto/evp/m_sigver.c +++ b/src/lib/libcrypto/evp/m_sigver.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: m_sigver.c,v 1.18 2024/03/25 11:41:40 joshua Exp $ */ | 1 | /* $OpenBSD: m_sigver.c,v 1.19 2024/03/26 01:41:06 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2006. | 3 | * project 2006. |
| 4 | */ | 4 | */ |
| @@ -95,12 +95,7 @@ do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type, | |||
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | if (ver) { | 97 | if (ver) { |
| 98 | if (ctx->pctx->pmeth->verifyctx_init) { | 98 | if (ctx->pctx->pmeth->digestverify != NULL) { |
| 99 | if (ctx->pctx->pmeth->verifyctx_init(ctx->pctx, | ||
| 100 | ctx) <=0) | ||
| 101 | return 0; | ||
| 102 | ctx->pctx->operation = EVP_PKEY_OP_VERIFYCTX; | ||
| 103 | } else if (ctx->pctx->pmeth->digestverify != NULL) { | ||
| 104 | ctx->pctx->operation = EVP_PKEY_OP_VERIFY; | 99 | ctx->pctx->operation = EVP_PKEY_OP_VERIFY; |
| 105 | ctx->update = update_oneshot_only; | 100 | ctx->update = update_oneshot_only; |
| 106 | } else if (EVP_PKEY_verify_init(ctx->pctx) <= 0) | 101 | } 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) | |||
| 233 | unsigned char md[EVP_MAX_MD_SIZE]; | 228 | unsigned char md[EVP_MAX_MD_SIZE]; |
| 234 | int r; | 229 | int r; |
| 235 | unsigned int mdlen = 0; | 230 | unsigned int mdlen = 0; |
| 236 | int vctx; | ||
| 237 | 231 | ||
| 238 | if (ctx->pctx->pmeth->verifyctx) | ||
| 239 | vctx = 1; | ||
| 240 | else | ||
| 241 | vctx = 0; | ||
| 242 | EVP_MD_CTX_legacy_clear(&tmp_ctx); | 232 | EVP_MD_CTX_legacy_clear(&tmp_ctx); |
| 243 | if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) | 233 | if (!EVP_MD_CTX_copy_ex(&tmp_ctx, ctx)) |
| 244 | return -1; | 234 | return -1; |
| 245 | if (vctx) { | 235 | r = EVP_DigestFinal_ex(&tmp_ctx, md, &mdlen); |
| 246 | r = tmp_ctx.pctx->pmeth->verifyctx(tmp_ctx.pctx, sig, | ||
| 247 | siglen, &tmp_ctx); | ||
| 248 | } else | ||
| 249 | r = EVP_DigestFinal_ex(&tmp_ctx, md, &mdlen); | ||
| 250 | EVP_MD_CTX_cleanup(&tmp_ctx); | 236 | EVP_MD_CTX_cleanup(&tmp_ctx); |
| 251 | if (vctx || !r) | 237 | if (!r) |
| 252 | return r; | 238 | return r; |
| 253 | return EVP_PKEY_verify(ctx->pctx, sig, siglen, md, mdlen); | 239 | return EVP_PKEY_verify(ctx->pctx, sig, siglen, md, mdlen); |
| 254 | } | 240 | } |
