Add accessors for the syntax versions of ContentInfo and SignerInfo.
These will be used soon in rpki-client for some more compliance checks.
ok job jsing
CMS_SignerInfo_get0_pkey_ctx
CMS_SignerInfo_get0_signature
CMS_SignerInfo_get0_signer_id
+CMS_SignerInfo_get_version
CMS_SignerInfo_set1_signer_cert
CMS_SignerInfo_sign
CMS_SignerInfo_verify
CMS_get1_ReceiptRequest
CMS_get1_certs
CMS_get1_crls
+CMS_get_version
CMS_is_detached
CMS_set1_eContentType
CMS_set1_signers_certs
-/* $OpenBSD: cms.h,v 1.15 2019/08/11 10:15:30 jsing Exp $ */
+/* $OpenBSD: cms.h,v 1.16 2023/07/28 10:28:02 tb Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
+int CMS_get_version(const CMS_ContentInfo *cms, long *version);
+int CMS_SignerInfo_get_version(const CMS_SignerInfo *si, long *version);
+
BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
-/* $OpenBSD: cms_lib.c,v 1.18 2023/07/08 08:26:26 beck Exp $ */
+/* $OpenBSD: cms_lib.c,v 1.19 2023/07/28 10:28:02 tb Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
}
LCRYPTO_ALIAS(CMS_dataFinal);
+int
+CMS_get_version(const CMS_ContentInfo *cms, long *version)
+{
+ switch (OBJ_obj2nid(cms->contentType)) {
+ case NID_pkcs7_signed:
+ *version = cms->d.signedData->version;
+ return 1;
+
+ case NID_pkcs7_enveloped:
+ *version = cms->d.envelopedData->version;
+ return 1;
+
+ case NID_pkcs7_digest:
+ *version = cms->d.digestedData->version;
+ return 1;
+
+ case NID_pkcs7_encrypted:
+ *version = cms->d.encryptedData->version;
+ return 1;
+
+ case NID_id_smime_ct_authData:
+ *version = cms->d.authenticatedData->version;
+ return 1;
+
+ case NID_id_smime_ct_compressedData:
+ *version = cms->d.compressedData->version;
+ return 1;
+
+ default:
+ CMSerror(CMS_R_UNSUPPORTED_TYPE);
+ return 0;
+ }
+}
+LCRYPTO_ALIAS(CMS_get_version);
+
+int
+CMS_SignerInfo_get_version(const CMS_SignerInfo *si, long *version)
+{
+ *version = si->version;
+ return 1;
+}
+LCRYPTO_ALIAS(CMS_SignerInfo_get_version);
+
/*
* Return an OCTET STRING pointer to content. This allows it to be accessed
* or set later.
-/* $OpenBSD: cms.h,v 1.1 2023/07/08 08:26:26 beck Exp $ */
+/* $OpenBSD: cms.h,v 1.2 2023/07/28 10:28:02 tb Exp $ */
/*
* Copyright (c) 2023 Bob Beck <beck@openbsd.org>
*
LCRYPTO_USED(i2d_CMS_ReceiptRequest);
LCRYPTO_USED(CMS_ContentInfo_print_ctx);
LCRYPTO_USED(CMS_get0_type);
+LCRYPTO_USED(CMS_get_version);
+LCRYPTO_USED(CMS_SignerInfo_get_version);
LCRYPTO_USED(CMS_dataInit);
LCRYPTO_USED(CMS_dataFinal);
LCRYPTO_USED(CMS_is_detached);