diff options
Diffstat (limited to 'src/libstrongswan/plugins/openssl/openssl_pkcs7.c')
-rw-r--r-- | src/libstrongswan/plugins/openssl/openssl_pkcs7.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libstrongswan/plugins/openssl/openssl_pkcs7.c b/src/libstrongswan/plugins/openssl/openssl_pkcs7.c index 891e829ae..5752d96de 100644 --- a/src/libstrongswan/plugins/openssl/openssl_pkcs7.c +++ b/src/libstrongswan/plugins/openssl/openssl_pkcs7.c @@ -29,6 +29,10 @@ #include <openssl/cms.h> +#if OPENSSL_VERSION_NUMBER < 0x10100000L +#define X509_ATTRIBUTE_get0_object(attr) ({ (attr)->object; }) +#endif + typedef struct private_openssl_pkcs7_t private_openssl_pkcs7_t; /** @@ -432,11 +436,11 @@ METHOD(pkcs7_t, get_attribute, bool, for (i = 0; i < CMS_signed_get_attr_count(si); i++) { attr = CMS_signed_get_attr(si, i); - if (!attr->single && sk_ASN1_TYPE_num(attr->value.set) == 1 && - openssl_asn1_known_oid(attr->object) == oid) + if (X509_ATTRIBUTE_count(attr) == 1 && + openssl_asn1_known_oid(X509_ATTRIBUTE_get0_object(attr)) == oid) { /* get first value in SET */ - type = sk_ASN1_TYPE_value(attr->value.set, 0); + type = X509_ATTRIBUTE_get0_type(attr, 0); chunk = wrapped = openssl_i2chunk(ASN1_TYPE, type); if (asn1_unwrap(&chunk, &chunk) != 0x100 /* ASN1_INVALID */) { @@ -503,7 +507,7 @@ static bool decrypt_symmetric(private_openssl_pkcs7_t *this, chunk_t key, chunk_t iv; size_t key_size; - /* read encryption algorithm from interal structures; TODO fixup */ + /* read encryption algorithm from internal structures; TODO fixup */ alg = this->cms->envelopedData->encryptedContentInfo-> contentEncryptionAlgorithm; encr = encryption_algorithm_from_oid(openssl_asn1_known_oid(alg->algorithm), |