Skip to content

Commit 7a5715a

Browse files
committed
Code review changes
1 parent aadb707 commit 7a5715a

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

ext/openssl/openssl.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static void php_openssl_request_free_obj(zend_object *object)
199199

200200
/* OpenSSLAsymmetricKey class */
201201

202-
typedef struct _openssl_key_object {
202+
typedef struct _php_openssl_pkey_object {
203203
EVP_PKEY *pkey;
204204
zend_object std;
205205
} php_openssl_pkey_object;
@@ -388,6 +388,10 @@ static int X509_get_signature_nid(const X509 *x)
388388
return OBJ_obj2nid(x->sig_alg->algorithm);
389389
}
390390

391+
#endif
392+
393+
#if PHP_OPENSSL_API_VERSION < 0x10100
394+
391395
static int EVP_PKEY_up_ref(EVP_PKEY *pkey)
392396
{
393397
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
14601464

14611465
static X509 *php_openssl_x509_from_zval(zval *val, bool *free_cert)
14621466
{
1463-
*free_cert = 1;
1464-
14651467
if (Z_TYPE_P(val) == IS_OBJECT && Z_OBJCE_P(val) == php_openssl_certificate_ce) {
14661468
*free_cert = 0;
14671469

14681470
return php_openssl_certificate_from_obj(Z_OBJ_P(val))->x509;
14691471
}
14701472

1473+
*free_cert = 1;
1474+
14711475
if (!try_convert_to_string(val)) {
14721476
return NULL;
14731477
}
@@ -1616,17 +1620,10 @@ PHP_FUNCTION(openssl_spki_new)
16161620
if (spki != NULL) {
16171621
NETSCAPE_SPKI_free(spki);
16181622
}
1619-
if (free_pkey && pkey != NULL) {
1620-
EVP_PKEY_free(pkey);
1621-
}
16221623

16231624
if (s && ZSTR_LEN(s) <= 0) {
16241625
RETVAL_FALSE;
16251626
}
1626-
1627-
if (free_pkey && s != NULL) {
1628-
zend_string_release_ex(s, 0);
1629-
}
16301627
}
16311628
/* }}} */
16321629

0 commit comments

Comments
 (0)