summaryrefslogtreecommitdiffstats
path: root/crypto/cms
diff options
context:
space:
mode:
authorDr. David von Oheimb <dev@ddvo.net>2023-10-13 22:12:22 +0200
committerDr. David von Oheimb <dev@ddvo.net>2023-10-17 22:02:29 +0200
commit72a99ef665b26fa207c0eee6e7e4842d1e42752c (patch)
treeb3b4a81863bde2f6fca2c4f585673c5fb05b37f5 /crypto/cms
parent2c581eb2fd92e997dfe0761b086eb690271cefc2 (diff)
CMS_add1_signer(): add missing ERR_raise() calls
Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/22390)
Diffstat (limited to 'crypto/cms')
-rw-r--r--crypto/cms/cms_err.c4
-rw-r--r--crypto/cms/cms_sd.c13
2 files changed, 13 insertions, 4 deletions
diff --git a/crypto/cms/cms_err.c b/crypto/cms/cms_err.c
index 40f79eefa9..40aeb7088c 100644
--- a/crypto/cms/cms_err.c
+++ b/crypto/cms/cms_err.c
@@ -1,6 +1,6 @@
/*
* Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2022 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-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
@@ -156,6 +156,8 @@ static const ERR_STRING_DATA CMS_str_reasons[] = {
"unsupported recipientinfo type"},
{ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_RECIPIENT_TYPE),
"unsupported recipient type"},
+ {ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_SIGNATURE_ALGORITHM),
+ "unsupported signature algorithm"},
{ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNSUPPORTED_TYPE), "unsupported type"},
{ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNWRAP_ERROR), "unwrap error"},
{ERR_PACK(ERR_LIB_CMS, 0, CMS_R_UNWRAP_FAILURE), "unwrap failure"},
diff --git a/crypto/cms/cms_sd.c b/crypto/cms/cms_sd.c
index c32e95f10d..43a404da14 100644
--- a/crypto/cms/cms_sd.c
+++ b/crypto/cms/cms_sd.c
@@ -386,11 +386,15 @@ CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
if (md == NULL) {
int def_nid;
- if (EVP_PKEY_get_default_digest_nid(pk, &def_nid) <= 0)
+ if (EVP_PKEY_get_default_digest_nid(pk, &def_nid) <= 0) {
+ ERR_raise_data(ERR_LIB_CMS, CMS_R_NO_DEFAULT_DIGEST,
+ "pkey nid=%d", EVP_PKEY_get_id(pk));
goto err;
+ }
md = EVP_get_digestbynid(def_nid);
if (md == NULL) {
- ERR_raise(ERR_LIB_CMS, CMS_R_NO_DEFAULT_DIGEST);
+ ERR_raise_data(ERR_LIB_CMS, CMS_R_NO_DEFAULT_DIGEST,
+ "default md nid=%d", def_nid);
goto err;
}
}
@@ -422,8 +426,11 @@ CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
}
}
- if (!(flags & CMS_KEY_PARAM) && !cms_sd_asn1_ctrl(si, 0))
+ if (!(flags & CMS_KEY_PARAM) && !cms_sd_asn1_ctrl(si, 0)) {
+ ERR_raise_data(ERR_LIB_CMS, CMS_R_UNSUPPORTED_SIGNATURE_ALGORITHM,
+ "pkey nid=%d", EVP_PKEY_get_id(pk));
goto err;
+ }
if (!(flags & CMS_NOATTR)) {
/*
* Initialize signed attributes structure so other attributes