Skip to content

Commit fd3947d

Browse files
committed
openssl: Don't use functions deprecated with OpenSSL 1.1.0
1 parent 0e80eb2 commit fd3947d

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/libstrongswan/plugins/openssl/openssl_crl.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ static inline void X509_CRL_get0_signature(const X509_CRL *crl, ASN1_BIT_STRING
5757
#define X509_REVOKED_get0_serialNumber(r) ({ (r)->serialNumber; })
5858
#define X509_REVOKED_get0_revocationDate(r) ({ (r)->revocationDate; })
5959
#define X509_CRL_get0_extensions(c) ({ (c)->crl->extensions; })
60+
#define ASN1_STRING_get0_data(a) ASN1_STRING_data(a)
61+
#define X509_CRL_get0_lastUpdate(c) X509_CRL_get_lastUpdate(c)
62+
#define X509_CRL_get0_nextUpdate(c) X509_CRL_get_nextUpdate(c)
6063
#endif
6164

6265
typedef struct private_openssl_crl_t private_openssl_crl_t;
@@ -193,7 +196,7 @@ METHOD(enumerator_t, crl_enumerate, bool,
193196
if (ASN1_STRING_type(crlrsn) == V_ASN1_ENUMERATED &&
194197
ASN1_STRING_length(crlrsn) == 1)
195198
{
196-
*reason = *ASN1_STRING_data(crlrsn);
199+
*reason = *ASN1_STRING_get0_data(crlrsn);
197200
}
198201
ASN1_STRING_free(crlrsn);
199202
}
@@ -588,8 +591,8 @@ static bool parse_crl(private_openssl_crl_t *this)
588591
{
589592
return FALSE;
590593
}
591-
this->thisUpdate = openssl_asn1_to_time(X509_CRL_get_lastUpdate(this->crl));
592-
this->nextUpdate = openssl_asn1_to_time(X509_CRL_get_nextUpdate(this->crl));
594+
this->thisUpdate = openssl_asn1_to_time(X509_CRL_get0_lastUpdate(this->crl));
595+
this->nextUpdate = openssl_asn1_to_time(X509_CRL_get0_nextUpdate(this->crl));
593596

594597
return parse_extensions(this);
595598
}

src/libstrongswan/plugins/openssl/openssl_util.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#if OPENSSL_VERSION_NUMBER < 0x10100000L
2727
#define OBJ_get0_data(o) ((o)->data)
2828
#define OBJ_length(o) ((o)->length)
29+
#define ASN1_STRING_get0_data(a) ASN1_STRING_data(a)
2930
#endif
3031

3132
/**
@@ -168,7 +169,8 @@ chunk_t openssl_asn1_str2chunk(ASN1_STRING *asn1)
168169
{
169170
if (asn1)
170171
{
171-
return chunk_create(ASN1_STRING_data(asn1), ASN1_STRING_length(asn1));
172+
return chunk_create((u_char*)ASN1_STRING_get0_data(asn1),
173+
ASN1_STRING_length(asn1));
172174
}
173175
return chunk_empty;
174176
}

0 commit comments

Comments
 (0)