diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-03-16 16:41:52 +0100 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-04-28 14:10:47 +0200 |
commit | 4189dc3782c5989dbaa7d247e41a96a25b27c940 (patch) | |
tree | 1da5209296b9f40a026fbdefc4ab906b52a552dd /crypto/ess/ess_asn1.c | |
parent | 176a9a682a22d556037b0a959911e6020c8d2ecd (diff) |
CMS ESS: Move four internal aux function to where they belong in crypto/cms
Also constify and slightly refactor them.
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14601)
Diffstat (limited to 'crypto/ess/ess_asn1.c')
-rw-r--r-- | crypto/ess/ess_asn1.c | 64 |
1 files changed, 2 insertions, 62 deletions
diff --git a/crypto/ess/ess_asn1.c b/crypto/ess/ess_asn1.c index 681ac4e727..68bc854c99 100644 --- a/crypto/ess/ess_asn1.c +++ b/crypto/ess/ess_asn1.c @@ -13,7 +13,6 @@ #include <openssl/ess.h> #include <openssl/x509v3.h> #include "crypto/ess.h" -#include "crypto/cms.h" /* ASN1 stuff for ESS Structure */ @@ -36,7 +35,7 @@ IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID) ASN1_SEQUENCE(ESS_SIGNING_CERT) = { ASN1_SEQUENCE_OF(ESS_SIGNING_CERT, cert_ids, ESS_CERT_ID), ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT, policy_info, POLICYINFO) -} static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT) +} ASN1_SEQUENCE_END(ESS_SIGNING_CERT) IMPLEMENT_ASN1_FUNCTIONS(ESS_SIGNING_CERT) IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT) @@ -53,66 +52,7 @@ IMPLEMENT_ASN1_DUP_FUNCTION(ESS_CERT_ID_V2) ASN1_SEQUENCE(ESS_SIGNING_CERT_V2) = { ASN1_SEQUENCE_OF(ESS_SIGNING_CERT_V2, cert_ids, ESS_CERT_ID_V2), ASN1_SEQUENCE_OF_OPT(ESS_SIGNING_CERT_V2, policy_info, POLICYINFO) -} static_ASN1_SEQUENCE_END(ESS_SIGNING_CERT_V2) +} ASN1_SEQUENCE_END(ESS_SIGNING_CERT_V2) IMPLEMENT_ASN1_FUNCTIONS(ESS_SIGNING_CERT_V2) IMPLEMENT_ASN1_DUP_FUNCTION(ESS_SIGNING_CERT_V2) - -/* TODO the following two functions should be moved to ../cms/ */ -/* No cms support means no CMS_SignerInfo* definitions */ -#ifndef OPENSSL_NO_CMS - -/* - * Returns 0 if attribute is not found, 1 if found, - * or -1 on attribute parsing failure. - */ -int ossl_cms_signerinfo_get_signing_cert_v2(const CMS_SignerInfo *si, - ESS_SIGNING_CERT_V2 **psc) -{ - ASN1_STRING *str; - ESS_SIGNING_CERT_V2 *sc; - ASN1_OBJECT *obj = OBJ_nid2obj(NID_id_smime_aa_signingCertificateV2); - - if (psc != NULL) - *psc = NULL; - str = CMS_signed_get0_data_by_OBJ(si, obj, -3, V_ASN1_SEQUENCE); - if (str == NULL) - return 0; - - sc = ASN1_item_unpack(str, ASN1_ITEM_rptr(ESS_SIGNING_CERT_V2)); - if (sc == NULL) - return -1; - if (psc != NULL) - *psc = sc; - else - ESS_SIGNING_CERT_V2_free(sc); - return 1; -} - -/* - * Returns 0 if attribute is not found, 1 if found, - * or -1 on attribute parsing failure. - */ -int ossl_cms_signerinfo_get_signing_cert(const CMS_SignerInfo *si, - ESS_SIGNING_CERT **psc) -{ - ASN1_STRING *str; - ESS_SIGNING_CERT *sc; - ASN1_OBJECT *obj = OBJ_nid2obj(NID_id_smime_aa_signingCertificate); - - if (psc != NULL) - *psc = NULL; - str = CMS_signed_get0_data_by_OBJ(si, obj, -3, V_ASN1_SEQUENCE); - if (str == NULL) - return 0; - - sc = ASN1_item_unpack(str, ASN1_ITEM_rptr(ESS_SIGNING_CERT)); - if (sc == NULL) - return -1; - if (psc != NULL) - *psc = sc; - else - ESS_SIGNING_CERT_free(sc); - return 1; -} -#endif /* !OPENSSL_NO_CMS */ |