diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_item.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_item.c b/src/lib/libcrypto/asn1/asn1_item.c index 3f67e3fc36..18da77433e 100644 --- a/src/lib/libcrypto/asn1/asn1_item.c +++ b/src/lib/libcrypto/asn1/asn1_item.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: asn1_item.c,v 1.18 2023/11/09 11:36:39 tb Exp $ */ | 1 | /* $OpenBSD: asn1_item.c,v 1.19 2024/01/13 13:59:18 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 | * |
| @@ -222,13 +222,20 @@ int | |||
| 222 | ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, | 222 | ASN1_item_sign(const ASN1_ITEM *it, X509_ALGOR *algor1, X509_ALGOR *algor2, |
| 223 | ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey, const EVP_MD *type) | 223 | ASN1_BIT_STRING *signature, void *asn, EVP_PKEY *pkey, const EVP_MD *type) |
| 224 | { | 224 | { |
| 225 | EVP_MD_CTX ctx; | 225 | EVP_MD_CTX *md_ctx = NULL; |
| 226 | EVP_MD_CTX_init(&ctx); | 226 | int ret = 0; |
| 227 | if (!EVP_DigestSignInit(&ctx, NULL, type, NULL, pkey)) { | 227 | |
| 228 | EVP_MD_CTX_cleanup(&ctx); | 228 | if ((md_ctx = EVP_MD_CTX_new()) == NULL) |
| 229 | return 0; | 229 | goto err; |
| 230 | } | 230 | if (!EVP_DigestSignInit(md_ctx, NULL, type, NULL, pkey)) |
| 231 | return ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, &ctx); | 231 | goto err; |
| 232 | |||
| 233 | ret = ASN1_item_sign_ctx(it, algor1, algor2, signature, asn, md_ctx); | ||
| 234 | |||
| 235 | err: | ||
| 236 | EVP_MD_CTX_free(md_ctx); | ||
| 237 | |||
| 238 | return ret; | ||
| 232 | } | 239 | } |
| 233 | 240 | ||
| 234 | static int | 241 | static int |
