@@ -541,18 +541,14 @@ X509 *php_openssl_x509_from_str(
541541 php_openssl_store_errors ();
542542 return NULL ;
543543 }
544- cert = PEM_read_bio_X509 (in , NULL , NULL , NULL );
544+ cert = php_openssl_pem_read_bio_x509 (in );
545545 } else {
546546 in = BIO_new_mem_buf (ZSTR_VAL (cert_str ), (int ) ZSTR_LEN (cert_str ));
547547 if (in == NULL ) {
548548 php_openssl_store_errors ();
549549 return NULL ;
550550 }
551- #ifdef TYPEDEF_D2I_OF
552- cert = (X509 * ) PEM_ASN1_read_bio ((d2i_of_void * )d2i_X509 , PEM_STRING_X509 , in , NULL , NULL , NULL );
553- #else
554- cert = (X509 * ) PEM_ASN1_read_bio ((char * (* )())d2i_X509 , PEM_STRING_X509 , in , NULL , NULL , NULL );
555- #endif
551+ cert = php_openssl_pem_read_asn1_bio_x509 (in );
556552 }
557553
558554 if (!BIO_free (in )) {
@@ -1127,7 +1123,7 @@ X509_REQ *php_openssl_csr_from_str(zend_string *csr_str, uint32_t arg_num)
11271123 return NULL ;
11281124 }
11291125
1130- csr = PEM_read_bio_X509_REQ (in , NULL , NULL , NULL );
1126+ csr = php_openssl_pem_read_bio_x509_req (in );
11311127 if (csr == NULL ) {
11321128 php_openssl_store_errors ();
11331129 }
@@ -1158,7 +1154,7 @@ EVP_PKEY *php_openssl_extract_public_key(EVP_PKEY *priv_key)
11581154 return NULL ;
11591155 }
11601156
1161- EVP_PKEY * pub_key = PEM_read_bio_PUBKEY (bio , NULL , NULL , NULL );
1157+ EVP_PKEY * pub_key = php_openssl_pem_read_bio_public_key (bio );
11621158 BIO_free (bio );
11631159 return pub_key ;
11641160}
@@ -1290,7 +1286,7 @@ EVP_PKEY *php_openssl_pkey_from_zval(
12901286 zend_string_release_ex (val_str , false);
12911287 TMP_CLEAN ;
12921288 }
1293- key = PEM_read_bio_PUBKEY (in , NULL , NULL , NULL );
1289+ key = php_openssl_pem_read_bio_public_key (in );
12941290 BIO_free (in );
12951291 }
12961292 } else {
@@ -1308,12 +1304,12 @@ EVP_PKEY *php_openssl_pkey_from_zval(
13081304 TMP_CLEAN ;
13091305 }
13101306 if (passphrase == NULL ) {
1311- key = PEM_read_bio_PrivateKey (in , NULL , NULL , NULL );
1307+ key = php_openssl_pem_read_bio_private_key (in , NULL , NULL );
13121308 } else {
13131309 struct php_openssl_pem_password password ;
13141310 password .key = passphrase ;
13151311 password .len = passphrase_len ;
1316- key = PEM_read_bio_PrivateKey (in , NULL , php_openssl_pem_password_cb , & password );
1312+ key = php_openssl_pem_read_bio_private_key (in , php_openssl_pem_password_cb , & password );
13171313 }
13181314 BIO_free (in );
13191315 }
0 commit comments