summaryrefslogtreecommitdiffstats
path: root/crypto/cms
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2022-08-31 10:27:42 +0200
committerDr. David von Oheimb <dev@ddvo.net>2022-09-02 21:29:38 +0200
commitf69ec4b484c08e67e863707eab4af4a4e6f4fc95 (patch)
treee930c23b446a7b1b0a67613c7b50910313fdc9e5 /crypto/cms
parentcae1d08f2c967cba960163075bda39f33d41c156 (diff)
PKCS7: add notes to pkcs7.h.in and minor code cleanup in crypto/{pkcs7,cms}/
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/18915)
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms_sd.c2
-rw-r--r--crypto/cms/cms_smime.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index 07cb8b51c6..63f90f1173 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -660,7 +660,7 @@ int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *scerts,
for (j = 0; j < sk_CMS_CertificateChoices_num(certs); j++) {
cch = sk_CMS_CertificateChoices_value(certs, j);
- if (cch->type != 0)
+ if (cch->type != CMS_CERTCHOICE_CERT)
continue;
x = cch->d.certificate;
if (CMS_SignerInfo_cert_cmp(si, x) == 0) {
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c
index b9d43c7204..ea40873e6a 100644
--- a/crypto/cms/cms_smime.c
+++ b/crypto/cms/cms_smime.c
@@ -259,7 +259,7 @@ CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
static int cms_signerinfo_verify_cert(CMS_SignerInfo *si,
X509_STORE *store,
- STACK_OF(X509) *certs,
+ STACK_OF(X509) *untrusted,
STACK_OF(X509_CRL) *crls,
STACK_OF(X509) **chain,
const CMS_CTX *cms_ctx)
@@ -275,7 +275,7 @@ static int cms_signerinfo_verify_cert(CMS_SignerInfo *si,
goto err;
}
CMS_SignerInfo_get0_algs(si, NULL, &signer, NULL, NULL);
- if (!X509_STORE_CTX_init(ctx, store, signer, certs)) {
+ if (!X509_STORE_CTX_init(ctx, store, signer, untrusted)) {
ERR_raise(ERR_LIB_CMS, CMS_R_STORE_INIT_ERROR);
goto err;
}
@@ -301,6 +301,7 @@ static int cms_signerinfo_verify_cert(CMS_SignerInfo *si,
}
+/* This strongly overlaps with PKCS7_verify() */
int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags)
{
@@ -336,7 +337,7 @@ int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
for (i = 0; i < sk_CMS_SignerInfo_num(sinfos); i++) {
si = sk_CMS_SignerInfo_value(sinfos, i);
CMS_SignerInfo_get0_algs(si, NULL, &signer, NULL, NULL);
- if (signer)
+ if (signer != NULL)
scount++;
}