diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_item.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_item.c b/src/lib/libcrypto/asn1/asn1_item.c index aeba46656a..3b02b6664a 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.13 2023/06/15 13:48:15 tb Exp $ */ | 1 | /* $OpenBSD: asn1_item.c,v 1.14 2023/06/15 13:58:56 tb 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 | * |
| @@ -399,35 +399,26 @@ ASN1_item_verify(const ASN1_ITEM *it, X509_ALGOR *a, | |||
| 399 | 399 | ||
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | in_len = ASN1_item_i2d(asn, &in, it); | 402 | if ((in_len = ASN1_item_i2d(asn, &in, it)) <= 0) { |
| 403 | |||
| 404 | if (in == NULL) { | ||
| 405 | ASN1error(ERR_R_MALLOC_FAILURE); | 403 | ASN1error(ERR_R_MALLOC_FAILURE); |
| 404 | in_len = 0; | ||
| 406 | goto err; | 405 | goto err; |
| 407 | } | 406 | } |
| 408 | 407 | ||
| 409 | if (!EVP_DigestVerifyUpdate(&ctx, in, in_len)) { | 408 | if (EVP_DigestVerify(&ctx, signature->data, signature->length, |
| 409 | in, in_len) <= 0) { | ||
| 410 | ASN1error(ERR_R_EVP_LIB); | 410 | ASN1error(ERR_R_EVP_LIB); |
| 411 | ret = 0; | 411 | ret = 0; |
| 412 | goto err; | 412 | goto err; |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | freezero(in, (unsigned int)in_len); | ||
| 416 | |||
| 417 | if (EVP_DigestVerifyFinal(&ctx, signature->data, | ||
| 418 | (size_t)signature->length) <= 0) { | ||
| 419 | ASN1error(ERR_R_EVP_LIB); | ||
| 420 | ret = 0; | ||
| 421 | goto err; | ||
| 422 | } | ||
| 423 | /* we don't need to zero the 'ctx' because we just checked | ||
| 424 | * public information */ | ||
| 425 | /* memset(&ctx,0,sizeof(ctx)); */ | ||
| 426 | ret = 1; | 415 | ret = 1; |
| 427 | 416 | ||
| 428 | err: | 417 | err: |
| 429 | EVP_MD_CTX_cleanup(&ctx); | 418 | EVP_MD_CTX_cleanup(&ctx); |
| 430 | return (ret); | 419 | freezero(in, in_len); |
| 420 | |||
| 421 | return ret; | ||
| 431 | } | 422 | } |
| 432 | 423 | ||
| 433 | #define HEADER_SIZE 8 | 424 | #define HEADER_SIZE 8 |
