sync code with last fixes and improvements from OpenBSD

This commit is contained in:
purplerain 2023-07-30 17:58:45 +00:00
parent f960599e67
commit 691f97cc10
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
215 changed files with 1520 additions and 11518 deletions

View file

@ -1,4 +1,4 @@
/* $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.
@ -128,6 +128,9 @@ int CMS_ContentInfo_print_ctx(BIO *out, CMS_ContentInfo *x, int indent, const AS
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);

View file

@ -1,4 +1,4 @@
/* $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.
@ -237,6 +237,49 @@ CMS_dataFinal(CMS_ContentInfo *cms, BIO *cmsbio)
}
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.