mirror of
https://github.com/php/php-src.git
synced 2024-09-22 02:17:32 +00:00
Clean up and fix php_openssl_dh_pub_from_priv
This commit is contained in:
parent
461add8adf
commit
0f4216298f
@ -4092,7 +4092,7 @@ zend_bool php_openssl_pkey_init_dsa(DSA *dsa, zval *data)
|
|||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ php_openssl_dh_pub_from_priv */
|
/* {{{ php_openssl_dh_pub_from_priv */
|
||||||
static BIGNUM *php_openssl_dh_pub_from_priv(DH *dh, BIGNUM *priv_key, BIGNUM *g, BIGNUM *p)
|
static BIGNUM *php_openssl_dh_pub_from_priv(BIGNUM *priv_key, BIGNUM *g, BIGNUM *p)
|
||||||
{
|
{
|
||||||
BIGNUM *pub_key, *priv_key_const_time;
|
BIGNUM *pub_key, *priv_key_const_time;
|
||||||
BN_CTX *ctx;
|
BN_CTX *ctx;
|
||||||
@ -4110,7 +4110,7 @@ static BIGNUM *php_openssl_dh_pub_from_priv(DH *dh, BIGNUM *priv_key, BIGNUM *g,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ctx = BN_CTX_new();
|
ctx = BN_CTX_new();
|
||||||
if (priv_key_const_time == NULL) {
|
if (ctx == NULL) {
|
||||||
BN_free(pub_key);
|
BN_free(pub_key);
|
||||||
BN_free(priv_key_const_time);
|
BN_free(priv_key_const_time);
|
||||||
php_openssl_store_errors();
|
php_openssl_store_errors();
|
||||||
@ -4150,7 +4150,7 @@ zend_bool php_openssl_pkey_init_dh(DH *dh, zval *data)
|
|||||||
return DH_set0_key(dh, pub_key, priv_key);
|
return DH_set0_key(dh, pub_key, priv_key);
|
||||||
}
|
}
|
||||||
if (priv_key) {
|
if (priv_key) {
|
||||||
pub_key = php_openssl_dh_pub_from_priv(dh, priv_key, g, p);
|
pub_key = php_openssl_dh_pub_from_priv(priv_key, g, p);
|
||||||
if (pub_key == NULL) {
|
if (pub_key == NULL) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user