summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/pkcs7/pk7_doit.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/libcrypto/pkcs7/pk7_doit.c b/src/lib/libcrypto/pkcs7/pk7_doit.c
index 1fcc37a983..d5edaedbd0 100644
--- a/src/lib/libcrypto/pkcs7/pk7_doit.c
+++ b/src/lib/libcrypto/pkcs7/pk7_doit.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pk7_doit.c,v 1.51 2023/02/16 08:38:17 tb Exp $ */ 1/* $OpenBSD: pk7_doit.c,v 1.52 2023/03/09 18:20:10 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 *
@@ -112,6 +112,7 @@ PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg)
112{ 112{
113 BIO *btmp; 113 BIO *btmp;
114 const EVP_MD *md; 114 const EVP_MD *md;
115
115 if ((btmp = BIO_new(BIO_f_md())) == NULL) { 116 if ((btmp = BIO_new(BIO_f_md())) == NULL) {
116 PKCS7error(ERR_R_BIO_LIB); 117 PKCS7error(ERR_R_BIO_LIB);
117 goto err; 118 goto err;
@@ -123,7 +124,11 @@ PKCS7_bio_add_digest(BIO **pbio, X509_ALGOR *alg)
123 goto err; 124 goto err;
124 } 125 }
125 126
126 BIO_set_md(btmp, md); 127 if (BIO_set_md(btmp, md) <= 0) {
128 PKCS7error(ERR_R_BIO_LIB);
129 goto err;
130 }
131
127 if (*pbio == NULL) 132 if (*pbio == NULL)
128 *pbio = btmp; 133 *pbio = btmp;
129 else if (!BIO_push(*pbio, btmp)) { 134 else if (!BIO_push(*pbio, btmp)) {
@@ -497,7 +502,10 @@ PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert)
497 goto err; 502 goto err;
498 } 503 }
499 504
500 BIO_set_md(btmp, evp_md); 505 if (BIO_set_md(btmp, evp_md) <= 0) {
506 PKCS7error(ERR_R_BIO_LIB);
507 goto err;
508 }
501 if (out == NULL) 509 if (out == NULL)
502 out = btmp; 510 out = btmp;
503 else 511 else