Fix key exchange

Clients will receive the proper shared secret.

Eliminates error message:
SSL_read: error:05066064:Diffie-Hellman routines:compute_key:no private value

Fixes #1974
This commit is contained in:
eimmot 2017-03-17 02:15:50 -04:00 committed by TingPing
parent 2f0239eb18
commit be6473227b
1 changed files with 2 additions and 1 deletions

View File

@ -189,6 +189,7 @@ dh1080_compute_key (const char *priv_key, const char *pub_key, char **secret_key
char *pub_key_data;
gsize pub_key_len;
BIGNUM *pk;
BIGNUM *temp_pub_key = BN_new();
DH *dh;
g_assert (secret_key != NULL);
@ -217,7 +218,7 @@ dh1080_compute_key (const char *priv_key, const char *pub_key, char **secret_key
#ifndef HAVE_DH_SET0_KEY
dh->priv_key = priv_key_num;
#else
DH_set0_key (dh, NULL, priv_key_num);
DH_set0_key (dh, temp_pub_key, priv_key_num);
#endif
shared_len = DH_compute_key (shared_key, pk, dh);