summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/Symbols.list2
-rw-r--r--src/lib/libcrypto/cms/cms.h5
-rw-r--r--src/lib/libcrypto/cms/cms_lib.c45
-rw-r--r--src/lib/libcrypto/hidden/openssl/cms.h4
4 files changed, 53 insertions, 3 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list
index b9ce49b277..f9f1b10c22 100644
--- a/src/lib/libcrypto/Symbols.list
+++ b/src/lib/libcrypto/Symbols.list
@@ -557,6 +557,7 @@ CMS_SignerInfo_get0_md_ctx
557CMS_SignerInfo_get0_pkey_ctx 557CMS_SignerInfo_get0_pkey_ctx
558CMS_SignerInfo_get0_signature 558CMS_SignerInfo_get0_signature
559CMS_SignerInfo_get0_signer_id 559CMS_SignerInfo_get0_signer_id
560CMS_SignerInfo_get_version
560CMS_SignerInfo_set1_signer_cert 561CMS_SignerInfo_set1_signer_cert
561CMS_SignerInfo_sign 562CMS_SignerInfo_sign
562CMS_SignerInfo_verify 563CMS_SignerInfo_verify
@@ -597,6 +598,7 @@ CMS_get0_type
597CMS_get1_ReceiptRequest 598CMS_get1_ReceiptRequest
598CMS_get1_certs 599CMS_get1_certs
599CMS_get1_crls 600CMS_get1_crls
601CMS_get_version
600CMS_is_detached 602CMS_is_detached
601CMS_set1_eContentType 603CMS_set1_eContentType
602CMS_set1_signers_certs 604CMS_set1_signers_certs
diff --git a/src/lib/libcrypto/cms/cms.h b/src/lib/libcrypto/cms/cms.h
index 3c92be34f7..76672af097 100644
--- a/src/lib/libcrypto/cms/cms.h
+++ b/src/lib/libcrypto/cms/cms.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms.h,v 1.15 2019/08/11 10:15:30 jsing Exp $ */ 1/* $OpenBSD: cms.h,v 1.16 2023/07/28 10:28:02 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -128,6 +128,9 @@ int CMS_ContentInfo_print_ctx(BIO *out, CMS_ContentInfo *x, int indent, const AS
128 128
129const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms); 129const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
130 130
131int CMS_get_version(const CMS_ContentInfo *cms, long *version);
132int CMS_SignerInfo_get_version(const CMS_SignerInfo *si, long *version);
133
131BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont); 134BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
132int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio); 135int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
133 136
diff --git a/src/lib/libcrypto/cms/cms_lib.c b/src/lib/libcrypto/cms/cms_lib.c
index fa62e61e96..37a11ba007 100644
--- a/src/lib/libcrypto/cms/cms_lib.c
+++ b/src/lib/libcrypto/cms/cms_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms_lib.c,v 1.18 2023/07/08 08:26:26 beck Exp $ */ 1/* $OpenBSD: cms_lib.c,v 1.19 2023/07/28 10:28:02 tb Exp $ */
2/* 2/*
3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 3 * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
4 * project. 4 * project.
@@ -237,6 +237,49 @@ CMS_dataFinal(CMS_ContentInfo *cms, BIO *cmsbio)
237} 237}
238LCRYPTO_ALIAS(CMS_dataFinal); 238LCRYPTO_ALIAS(CMS_dataFinal);
239 239
240int
241CMS_get_version(const CMS_ContentInfo *cms, long *version)
242{
243 switch (OBJ_obj2nid(cms->contentType)) {
244 case NID_pkcs7_signed:
245 *version = cms->d.signedData->version;
246 return 1;
247
248 case NID_pkcs7_enveloped:
249 *version = cms->d.envelopedData->version;
250 return 1;
251
252 case NID_pkcs7_digest:
253 *version = cms->d.digestedData->version;
254 return 1;
255
256 case NID_pkcs7_encrypted:
257 *version = cms->d.encryptedData->version;
258 return 1;
259
260 case NID_id_smime_ct_authData:
261 *version = cms->d.authenticatedData->version;
262 return 1;
263
264 case NID_id_smime_ct_compressedData:
265 *version = cms->d.compressedData->version;
266 return 1;
267
268 default:
269 CMSerror(CMS_R_UNSUPPORTED_TYPE);
270 return 0;
271 }
272}
273LCRYPTO_ALIAS(CMS_get_version);
274
275int
276CMS_SignerInfo_get_version(const CMS_SignerInfo *si, long *version)
277{
278 *version = si->version;
279 return 1;
280}
281LCRYPTO_ALIAS(CMS_SignerInfo_get_version);
282
240/* 283/*
241 * Return an OCTET STRING pointer to content. This allows it to be accessed 284 * Return an OCTET STRING pointer to content. This allows it to be accessed
242 * or set later. 285 * or set later.
diff --git a/src/lib/libcrypto/hidden/openssl/cms.h b/src/lib/libcrypto/hidden/openssl/cms.h
index c777e857d8..0f450e603c 100644
--- a/src/lib/libcrypto/hidden/openssl/cms.h
+++ b/src/lib/libcrypto/hidden/openssl/cms.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms.h,v 1.1 2023/07/08 08:26:26 beck Exp $ */ 1/* $OpenBSD: cms.h,v 1.2 2023/07/28 10:28:02 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Bob Beck <beck@openbsd.org> 3 * Copyright (c) 2023 Bob Beck <beck@openbsd.org>
4 * 4 *
@@ -35,6 +35,8 @@ LCRYPTO_USED(d2i_CMS_ReceiptRequest);
35LCRYPTO_USED(i2d_CMS_ReceiptRequest); 35LCRYPTO_USED(i2d_CMS_ReceiptRequest);
36LCRYPTO_USED(CMS_ContentInfo_print_ctx); 36LCRYPTO_USED(CMS_ContentInfo_print_ctx);
37LCRYPTO_USED(CMS_get0_type); 37LCRYPTO_USED(CMS_get0_type);
38LCRYPTO_USED(CMS_get_version);
39LCRYPTO_USED(CMS_SignerInfo_get_version);
38LCRYPTO_USED(CMS_dataInit); 40LCRYPTO_USED(CMS_dataInit);
39LCRYPTO_USED(CMS_dataFinal); 41LCRYPTO_USED(CMS_dataFinal);
40LCRYPTO_USED(CMS_is_detached); 42LCRYPTO_USED(CMS_is_detached);