openssl: Don't use functions deprecated with OpenSSL 1.1.0

This commit is contained in:
Tobias Brunner
2018-10-31 15:50:36 +01:00
parent 0e80eb235d
commit fd3947d9e5
2 changed files with 9 additions and 4 deletions
@@ -57,6 +57,9 @@ static inline void X509_CRL_get0_signature(const X509_CRL *crl, ASN1_BIT_STRING
#define X509_REVOKED_get0_serialNumber(r) ({ (r)->serialNumber; }) #define X509_REVOKED_get0_serialNumber(r) ({ (r)->serialNumber; })
#define X509_REVOKED_get0_revocationDate(r) ({ (r)->revocationDate; }) #define X509_REVOKED_get0_revocationDate(r) ({ (r)->revocationDate; })
#define X509_CRL_get0_extensions(c) ({ (c)->crl->extensions; }) #define X509_CRL_get0_extensions(c) ({ (c)->crl->extensions; })
#define ASN1_STRING_get0_data(a) ASN1_STRING_data(a)
#define X509_CRL_get0_lastUpdate(c) X509_CRL_get_lastUpdate(c)
#define X509_CRL_get0_nextUpdate(c) X509_CRL_get_nextUpdate(c)
#endif #endif
typedef struct private_openssl_crl_t private_openssl_crl_t; typedef struct private_openssl_crl_t private_openssl_crl_t;
@@ -193,7 +196,7 @@ METHOD(enumerator_t, crl_enumerate, bool,
if (ASN1_STRING_type(crlrsn) == V_ASN1_ENUMERATED && if (ASN1_STRING_type(crlrsn) == V_ASN1_ENUMERATED &&
ASN1_STRING_length(crlrsn) == 1) ASN1_STRING_length(crlrsn) == 1)
{ {
*reason = *ASN1_STRING_data(crlrsn); *reason = *ASN1_STRING_get0_data(crlrsn);
} }
ASN1_STRING_free(crlrsn); ASN1_STRING_free(crlrsn);
} }
@@ -588,8 +591,8 @@ static bool parse_crl(private_openssl_crl_t *this)
{ {
return FALSE; return FALSE;
} }
this->thisUpdate = openssl_asn1_to_time(X509_CRL_get_lastUpdate(this->crl)); this->thisUpdate = openssl_asn1_to_time(X509_CRL_get0_lastUpdate(this->crl));
this->nextUpdate = openssl_asn1_to_time(X509_CRL_get_nextUpdate(this->crl)); this->nextUpdate = openssl_asn1_to_time(X509_CRL_get0_nextUpdate(this->crl));
return parse_extensions(this); return parse_extensions(this);
} }
@@ -26,6 +26,7 @@
#if OPENSSL_VERSION_NUMBER < 0x10100000L #if OPENSSL_VERSION_NUMBER < 0x10100000L
#define OBJ_get0_data(o) ((o)->data) #define OBJ_get0_data(o) ((o)->data)
#define OBJ_length(o) ((o)->length) #define OBJ_length(o) ((o)->length)
#define ASN1_STRING_get0_data(a) ASN1_STRING_data(a)
#endif #endif
/** /**
@@ -168,7 +169,8 @@ chunk_t openssl_asn1_str2chunk(ASN1_STRING *asn1)
{ {
if (asn1) if (asn1)
{ {
return chunk_create(ASN1_STRING_data(asn1), ASN1_STRING_length(asn1)); return chunk_create((u_char*)ASN1_STRING_get0_data(asn1),
ASN1_STRING_length(asn1));
} }
return chunk_empty; return chunk_empty;
} }