Fix build with LibreSSL 2.8 and constified the ASN1_OBJECTs.

This commit is contained in:
reykfloeter 2018-05-15 23:11:32 +02:00
parent 8c4f6a384b
commit bf8bfd607b
2 changed files with 13 additions and 1 deletions

View file

@ -353,7 +353,11 @@ void cms_DigestAlgorithm_set(X509_ALGOR *alg, const EVP_MD *md)
BIO *cms_DigestAlgorithm_init_bio(X509_ALGOR *digestAlgorithm)
{
BIO *mdbio = NULL;
#if LIBRESSL_VERSION_NUMBER >= 0x2080000fL
const ASN1_OBJECT *digestoid;
#else
ASN1_OBJECT *digestoid;
#endif
const EVP_MD *digest;
X509_ALGOR_get0(&digestoid, NULL, NULL, digestAlgorithm);
digest = EVP_get_digestbyobj(digestoid);
@ -380,7 +384,11 @@ int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
X509_ALGOR *mdalg)
{
int nid;
ASN1_OBJECT *mdoid;
#if LIBRESSL_VERSION_NUMBER >= 0x2080000fL
const ASN1_OBJECT *mdoid;
#else
const ASN1_OBJECT *mdoid;
#endif
X509_ALGOR_get0(&mdoid, NULL, NULL, mdalg);
nid = OBJ_obj2nid(mdoid);
/* Look for digest type to match signature */

View file

@ -328,7 +328,11 @@ CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
/* See if digest is present in digestAlgorithms */
for (i = 0; i < sk_X509_ALGOR_num(sd->digestAlgorithms); i++) {
#if LIBRESSL_VERSION_NUMBER >= 0x2080000fL
const ASN1_OBJECT *aoid;
#else
ASN1_OBJECT *aoid;
#endif
alg = sk_X509_ALGOR_value(sd->digestAlgorithms, i);
X509_ALGOR_get0(&aoid, NULL, NULL, alg);
if (OBJ_obj2nid(aoid) == EVP_MD_type(md))