aboutsummaryrefslogtreecommitdiff
path: root/crypto/cms/cms_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/cms/cms_lib.c')
-rw-r--r--crypto/cms/cms_lib.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c
index 1fd542d2375c..0738da3da280 100644
--- a/crypto/cms/cms_lib.c
+++ b/crypto/cms/cms_lib.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2008-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -432,7 +432,7 @@ BIO *ossl_cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm,
(void)ERR_pop_to_mark();
mdbio = BIO_new(BIO_f_md());
- if (mdbio == NULL || !BIO_set_md(mdbio, digest)) {
+ if (mdbio == NULL || BIO_set_md(mdbio, digest) <= 0) {
ERR_raise(ERR_LIB_CMS, CMS_R_MD_BIO_INIT_ERROR);
goto err;
}
@@ -615,11 +615,12 @@ int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl)
int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl)
{
- int r;
- r = CMS_add0_crl(cms, crl);
- if (r > 0)
- X509_CRL_up_ref(crl);
- return r;
+ if (!X509_CRL_up_ref(crl))
+ return 0;
+ if (CMS_add0_crl(cms, crl))
+ return 1;
+ X509_CRL_free(crl);
+ return 0;
}
STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms)