com php-src: Set DSA or DH key only if pub key supplied: ext/openssl/openssl.c
| From: | Jakub Zelenka | Date: | Sun, 14 Aug 2016 19:42:56 +0000 |
| Subject: | com php-src: Set DSA or DH key only if pub key supplied: ext/openssl/openssl.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93783@lists.php.net to get a copy of this message | ||
Commit: 427c8c809d250e0569678135b245d459446ccd47
Author: Jakub Zelenka <bukka@php.net> Sun, 14 Aug 2016 20:42:56 +0100
Parents: b783952cb18c576f3deb31f02d9b47020a496229
Branches: PHP-7.1
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=427c8c809d250e0569678135b245d459446ccd47
Log:
Set DSA or DH key only if pub key supplied
Changed paths:
M ext/openssl/openssl.c
Diff:
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index 6c9204d..9198530 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -4060,11 +4060,8 @@ zend_bool php_openssl_pkey_init_dsa(DSA *dsa, zval *data)
OPENSSL_PKEY_SET_BN(data, pub_key);
OPENSSL_PKEY_SET_BN(data, priv_key);
- if (priv_key || pub_key) {
- return 1;
- }
- if (!DSA_set0_key(dsa, pub_key, priv_key)) {
- return 0;
+ if (pub_key) {
+ return DSA_set0_key(dsa, pub_key, priv_key);
}
/* generate key */
@@ -4099,11 +4096,8 @@ zend_bool php_openssl_pkey_init_dh(DH *dh, zval *data)
OPENSSL_PKEY_SET_BN(data, priv_key);
OPENSSL_PKEY_SET_BN(data, pub_key);
- if (priv_key || pub_key) {
- return 1;
- }
- if (!DH_set0_key(dh, pub_key, priv_key)) {
- return 0;
+ if (pub_key) {
+ return DH_set0_key(dh, pub_key, priv_key);
}
/* generate key */