summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-10-14 16:19:16 +0100
committerMatt Caswell <matt@openssl.org>2020-11-18 14:14:52 +0000
commit936d5657680bba3315aec6d7cdc04ea8cab9050e (patch)
tree923363f613840abef9623f1ba92f97c34e8455f5
parent184280971c4db38d7001983569bacca2a50b50f1 (diff)
downloadopenssl-new-936d5657680bba3315aec6d7cdc04ea8cab9050e.tar.gz
Remove DH usage from tls_process_cke_dhe
We instead set the encoded public key directly in the EVP_PKEY object. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13368)
-rw-r--r--ssl/statem/statem_srvr.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c
index 9d0d8c9ed4..b6baff28ea 100644
--- a/ssl/statem/statem_srvr.c
+++ b/ssl/statem/statem_srvr.c
@@ -2962,11 +2962,8 @@ static int tls_process_cke_rsa(SSL *s, PACKET *pkt)
static int tls_process_cke_dhe(SSL *s, PACKET *pkt)
{
-#ifndef OPENSSL_NO_DH
EVP_PKEY *skey = NULL;
- DH *cdh;
unsigned int i;
- BIGNUM *pub_key;
const unsigned char *data;
EVP_PKEY *ckey = NULL;
int ret = 0;
@@ -2996,11 +2993,8 @@ static int tls_process_cke_dhe(SSL *s, PACKET *pkt)
goto err;
}
- cdh = EVP_PKEY_get0_DH(ckey);
- pub_key = BN_bin2bn(data, i, NULL);
- if (pub_key == NULL || cdh == NULL || !DH_set0_key(cdh, pub_key, NULL)) {
+ if (!EVP_PKEY_set1_encoded_public_key(ckey, data, i)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
- BN_free(pub_key);
goto err;
}
@@ -3015,11 +3009,6 @@ static int tls_process_cke_dhe(SSL *s, PACKET *pkt)
err:
EVP_PKEY_free(ckey);
return ret;
-#else
- /* Should never happen */
- SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
- return 0;
-#endif
}
static int tls_process_cke_ecdhe(SSL *s, PACKET *pkt)