diff options
| author | tb <> | 2023-07-28 10:28:02 +0000 |
|---|---|---|
| committer | tb <> | 2023-07-28 10:28:02 +0000 |
| commit | 3c8d1e1cf9bb15a3ea986b0fa3f53d33663d6c55 (patch) | |
| tree | 4805fc669f5e6c6056eecb84f7c45e854cea9dd8 /src/lib/libcrypto/cms/cms_lib.c | |
| parent | 2bca7fcf4242f1f10d0b696c606387ec84d6ccd0 (diff) | |
| download | openbsd-3c8d1e1cf9bb15a3ea986b0fa3f53d33663d6c55.tar.gz openbsd-3c8d1e1cf9bb15a3ea986b0fa3f53d33663d6c55.tar.bz2 openbsd-3c8d1e1cf9bb15a3ea986b0fa3f53d33663d6c55.zip | |
Provide CMS{,_SignerInfo}_get_version
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
Diffstat (limited to 'src/lib/libcrypto/cms/cms_lib.c')
| -rw-r--r-- | src/lib/libcrypto/cms/cms_lib.c | 45 |
1 files changed, 44 insertions, 1 deletions
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 | } |
| 238 | LCRYPTO_ALIAS(CMS_dataFinal); | 238 | LCRYPTO_ALIAS(CMS_dataFinal); |
| 239 | 239 | ||
| 240 | int | ||
| 241 | CMS_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 | } | ||
| 273 | LCRYPTO_ALIAS(CMS_get_version); | ||
| 274 | |||
| 275 | int | ||
| 276 | CMS_SignerInfo_get_version(const CMS_SignerInfo *si, long *version) | ||
| 277 | { | ||
| 278 | *version = si->version; | ||
| 279 | return 1; | ||
| 280 | } | ||
| 281 | LCRYPTO_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. |
