mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 09:02:55 +00:00
openssl: use ASN1_STRING_get0_data when compiling against 1.1
For older versions we can fall back on the deprecated ASN1_STRING_data.
This commit is contained in:
parent
f15eedb3a3
commit
2f3adf9513
@ -357,7 +357,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
|
||||
num = sk_GENERAL_NAME_num(alts);
|
||||
for (i = 0; i < num && matched != 1; i++) {
|
||||
const GENERAL_NAME *gn = sk_GENERAL_NAME_value(alts, i);
|
||||
const char *name = (char *) ASN1_STRING_data(gn->d.ia5);
|
||||
const char *name = (char *) ASN1_STRING_get0_data(gn->d.ia5);
|
||||
size_t namelen = (size_t) ASN1_STRING_length(gn->d.ia5);
|
||||
|
||||
/* Skip any names of a type we're not looking for */
|
||||
@ -412,7 +412,7 @@ static int verify_server_cert(SSL *ssl, const char *host)
|
||||
if (size > 0) {
|
||||
peer_cn = OPENSSL_malloc(size + 1);
|
||||
GITERR_CHECK_ALLOC(peer_cn);
|
||||
memcpy(peer_cn, ASN1_STRING_data(str), size);
|
||||
memcpy(peer_cn, ASN1_STRING_get0_data(str), size);
|
||||
peer_cn[size] = '\0';
|
||||
} else {
|
||||
goto cert_fail_name;
|
||||
|
@ -108,6 +108,11 @@ GIT_INLINE(void*) BIO_get_data(BIO *a)
|
||||
return a->ptr;
|
||||
}
|
||||
|
||||
GIT_INLINE(const unsigned char *) ASN1_STRING_get0_data(const ASN1_STRING *x)
|
||||
{
|
||||
return ASN1_STRING_data((ASN1_STRING *)x);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user