Commit aad0409a authored by eroen's avatar eroen Committed by Timothy B. Terriberry

Use ASN1_STRING_get0_data for openssl-1.1.0

This fixes a build failure from undefined references to ASN1_STRING_data in
libopusurl.so.

ASN1_STRING_data is deprecated in openssl-1.1.0. The new ASN1_STRING_get0_data
is identical, except the returned string may not be modified, which we don't
do anyway.

Also include missing asn1.h header to silence compiler warnings.

X-Gentoo-Bug: 592456
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=592456
parent 6a08376d
...@@ -214,6 +214,7 @@ static const char *op_parse_file_url(const char *_src){ ...@@ -214,6 +214,7 @@ static const char *op_parse_file_url(const char *_src){
# include <winsock2.h> # include <winsock2.h>
# include <ws2tcpip.h> # include <ws2tcpip.h>
# include <openssl/ssl.h> # include <openssl/ssl.h>
# include <openssl/asn1.h>
# include "winerrno.h" # include "winerrno.h"
typedef SOCKET op_sock; typedef SOCKET op_sock;
...@@ -344,6 +345,7 @@ int SSL_CTX_set_default_verify_paths_win32(SSL_CTX *_ssl_ctx); ...@@ -344,6 +345,7 @@ int SSL_CTX_set_default_verify_paths_win32(SSL_CTX *_ssl_ctx);
# include <poll.h> # include <poll.h>
# include <unistd.h> # include <unistd.h>
# include <openssl/ssl.h> # include <openssl/ssl.h>
# include <openssl/asn1.h>
typedef int op_sock; typedef int op_sock;
...@@ -1531,6 +1533,7 @@ static long op_bio_retry_ctrl(BIO *_b,int _cmd,long _num,void *_ptr){ ...@@ -1531,6 +1533,7 @@ static long op_bio_retry_ctrl(BIO *_b,int _cmd,long _num,void *_ptr){
# if OPENSSL_VERSION_NUMBER<0x10100000L # if OPENSSL_VERSION_NUMBER<0x10100000L
# define BIO_set_data(_b,_ptr) ((_b)->ptr=(_ptr)) # define BIO_set_data(_b,_ptr) ((_b)->ptr=(_ptr))
# define BIO_set_init(_b,_init) ((_b)->init=(_init)) # define BIO_set_init(_b,_init) ((_b)->init=(_init))
# define ASN1_STRING_get0_data ASN1_STRING_data
# endif # endif
static int op_bio_retry_new(BIO *_b){ static int op_bio_retry_new(BIO *_b){
...@@ -1632,7 +1635,7 @@ static int op_http_hostname_match(const char *_host,size_t _host_len, ...@@ -1632,7 +1635,7 @@ static int op_http_hostname_match(const char *_host,size_t _host_len,
size_t pattern_prefix_len; size_t pattern_prefix_len;
size_t pattern_suffix_len; size_t pattern_suffix_len;
if(OP_UNLIKELY(_host_len>(size_t)INT_MAX))return 0; if(OP_UNLIKELY(_host_len>(size_t)INT_MAX))return 0;
pattern=(const char *)ASN1_STRING_data(_pattern); pattern=(const char *)ASN1_STRING_get0_data(_pattern);
pattern_len=strlen(pattern); pattern_len=strlen(pattern);
/*Check the pattern for embedded NULs.*/ /*Check the pattern for embedded NULs.*/
if(OP_UNLIKELY(pattern_len!=(size_t)ASN1_STRING_length(_pattern)))return 0; if(OP_UNLIKELY(pattern_len!=(size_t)ASN1_STRING_length(_pattern)))return 0;
...@@ -1805,7 +1808,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){ ...@@ -1805,7 +1808,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){
} }
} }
else if(name->type==GEN_IPADD){ else if(name->type==GEN_IPADD){
unsigned char *cert_ip; unsigned const char *cert_ip;
/*If we do have an IP address, compare it directly. /*If we do have an IP address, compare it directly.
RFC 6125: "When the reference identity is an IP address, the identity RFC 6125: "When the reference identity is an IP address, the identity
MUST be converted to the 'network byte order' octet string MUST be converted to the 'network byte order' octet string
...@@ -1818,7 +1821,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){ ...@@ -1818,7 +1821,7 @@ static int op_http_verify_hostname(OpusHTTPStream *_stream,SSL *_ssl_conn){
type iPAddress. type iPAddress.
A match occurs if the reference identity octet string and the value A match occurs if the reference identity octet string and the value
octet strings are identical."*/ octet strings are identical."*/
cert_ip=ASN1_STRING_data(name->d.iPAddress); cert_ip=ASN1_STRING_get0_data(name->d.iPAddress);
if(ip_len==ASN1_STRING_length(name->d.iPAddress) if(ip_len==ASN1_STRING_length(name->d.iPAddress)
&&memcmp(ip,cert_ip,ip_len)==0){ &&memcmp(ip,cert_ip,ip_len)==0){
ret=1; ret=1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment