diff options
| author | Jakub Zelenka <bukka@php.net> | 2015-08-25 20:26:11 +0100 |
|---|---|---|
| committer | Jakub Zelenka <bukka@php.net> | 2015-08-25 20:26:11 +0100 |
| commit | c39336d1d866866de629695fbd9971fb48f27ea9 (patch) | |
| tree | e000f6a5c0789f7aa9eb52133134ea9017e535d5 /ext/openssl/openssl.c | |
| parent | e5adf2b427915ff070ddcba24d7c4ed3014743e9 (diff) | |
| download | php-git-c39336d1d866866de629695fbd9971fb48f27ea9.tar.gz | |
Fix bug #55259 (openssl extension does not get the DH parameters from DH key resource)
Diffstat (limited to 'ext/openssl/openssl.c')
| -rw-r--r-- | ext/openssl/openssl.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index ef5162283b..0421524d64 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -3597,13 +3597,10 @@ PHP_FUNCTION(openssl_pkey_new) OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, g); OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, priv_key); OPENSSL_PKEY_SET_BN(Z_ARRVAL_PP(data), dh, pub_key); - if (dh->p && dh->g) { - if (!dh->pub_key) { - DH_generate_key(dh); - } - if (EVP_PKEY_assign_DH(pkey, dh)) { - RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC)); - } + if (dh->p && dh->g && + (dh->pub_key || DH_generate_key(dh)) && + EVP_PKEY_assign_DH(pkey, dh)) { + RETURN_RESOURCE(zend_list_insert(pkey, le_key TSRMLS_CC)); } DH_free(dh); } |
