@@ -199,7 +199,7 @@ static void php_openssl_request_free_obj(zend_object *object)
199
199
200
200
/* OpenSSLAsymmetricKey class */
201
201
202
- typedef struct _openssl_key_object {
202
+ typedef struct _php_openssl_pkey_object {
203
203
EVP_PKEY * pkey ;
204
204
zend_object std ;
205
205
} php_openssl_pkey_object ;
@@ -388,6 +388,10 @@ static int X509_get_signature_nid(const X509 *x)
388
388
return OBJ_obj2nid (x -> sig_alg -> algorithm );
389
389
}
390
390
391
+ #endif
392
+
393
+ #if PHP_OPENSSL_API_VERSION < 0x10100
394
+
391
395
static int EVP_PKEY_up_ref (EVP_PKEY * pkey )
392
396
{
393
397
return CRYPTO_add (& pkey -> references , 1 , CRYPTO_LOCK_EVP_PKEY );
@@ -1460,14 +1464,14 @@ static X509 *php_openssl_x509_from_param(zend_object *cert_obj, zend_string *cer
1460
1464
1461
1465
static X509 * php_openssl_x509_from_zval (zval * val , bool * free_cert )
1462
1466
{
1463
- * free_cert = 1 ;
1464
-
1465
1467
if (Z_TYPE_P (val ) == IS_OBJECT && Z_OBJCE_P (val ) == php_openssl_certificate_ce ) {
1466
1468
* free_cert = 0 ;
1467
1469
1468
1470
return php_openssl_certificate_from_obj (Z_OBJ_P (val ))-> x509 ;
1469
1471
}
1470
1472
1473
+ * free_cert = 1 ;
1474
+
1471
1475
if (!try_convert_to_string (val )) {
1472
1476
return NULL ;
1473
1477
}
@@ -1616,17 +1620,10 @@ PHP_FUNCTION(openssl_spki_new)
1616
1620
if (spki != NULL ) {
1617
1621
NETSCAPE_SPKI_free (spki );
1618
1622
}
1619
- if (free_pkey && pkey != NULL ) {
1620
- EVP_PKEY_free (pkey );
1621
- }
1622
1623
1623
1624
if (s && ZSTR_LEN (s ) <= 0 ) {
1624
1625
RETVAL_FALSE ;
1625
1626
}
1626
-
1627
- if (free_pkey && s != NULL ) {
1628
- zend_string_release_ex (s , 0 );
1629
- }
1630
1627
}
1631
1628
/* }}} */
1632
1629
0 commit comments