Skip to content

Commit bf14ecc

Browse files
committed
use the new API for opaque symbol in OpenSSL 1.1.x
1 parent df1e1fd commit bf14ecc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

ext/openssl/xp_ssl.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,11 @@ static int win_cert_verify_callback(X509_STORE_CTX *x509_store_ctx, void *arg) /
585585
{
586586
PCCERT_CONTEXT cert_ctx = NULL;
587587
PCCERT_CHAIN_CONTEXT cert_chain_ctx = NULL;
588+
#if OPENSSL_VERSION_NUMBER < 0x10100000L
589+
X509 *cert = x509_store_ctx->cert;
590+
#else
591+
X509 *cert = X509_STORE_CTX_get0_cert(x509_store_ctx);
592+
#endif
588593

589594
php_stream *stream;
590595
php_openssl_netstream_data_t *sslsock;
@@ -599,7 +604,7 @@ static int win_cert_verify_callback(X509_STORE_CTX *x509_store_ctx, void *arg) /
599604
unsigned char *der_buf = NULL;
600605
int der_len;
601606

602-
der_len = i2d_X509(x509_store_ctx->cert, &der_buf);
607+
der_len = i2d_X509(cert, &der_buf);
603608
if (der_len < 0) {
604609
unsigned long err_code, e;
605610
char err_buf[512];
@@ -676,7 +681,7 @@ static int win_cert_verify_callback(X509_STORE_CTX *x509_store_ctx, void *arg) /
676681
int index, cert_name_utf8_len;
677682
DWORD num_wchars;
678683

679-
cert_name = X509_get_subject_name(x509_store_ctx->cert);
684+
cert_name = X509_get_subject_name(cert);
680685
index = X509_NAME_get_index_by_NID(cert_name, NID_commonName, -1);
681686
if (index < 0) {
682687
php_error_docref(NULL, E_WARNING, "Unable to locate certificate CN");

0 commit comments

Comments
 (0)