|
|
78ef1d |
diff -up openssl-1.0.1e/ssl/s3_clnt.c.ecdh-downgrade openssl-1.0.1e/ssl/s3_clnt.c
|
|
|
78ef1d |
--- openssl-1.0.1e/ssl/s3_clnt.c.ecdh-downgrade 2015-01-12 16:37:49.978126895 +0100
|
|
|
78ef1d |
+++ openssl-1.0.1e/ssl/s3_clnt.c 2015-01-12 17:02:01.740959687 +0100
|
|
|
78ef1d |
@@ -1287,6 +1287,8 @@ int ssl3_get_key_exchange(SSL *s)
|
|
|
78ef1d |
int encoded_pt_len = 0;
|
|
|
78ef1d |
#endif
|
|
|
78ef1d |
|
|
|
78ef1d |
+ EVP_MD_CTX_init(&md_ctx);
|
|
|
78ef1d |
+
|
|
|
78ef1d |
/* use same message size as in ssl3_get_certificate_request()
|
|
|
78ef1d |
* as ServerKeyExchange message may be skipped */
|
|
|
78ef1d |
n=s->method->ssl_get_message(s,
|
|
|
78ef1d |
@@ -1297,14 +1299,26 @@ int ssl3_get_key_exchange(SSL *s)
|
|
|
78ef1d |
&ok;;
|
|
|
78ef1d |
if (!ok) return((int)n);
|
|
|
78ef1d |
|
|
|
78ef1d |
+ alg_k=s->s3->tmp.new_cipher->algorithm_mkey;
|
|
|
78ef1d |
+
|
|
|
78ef1d |
if (s->s3->tmp.message_type != SSL3_MT_SERVER_KEY_EXCHANGE)
|
|
|
78ef1d |
{
|
|
|
78ef1d |
+ /*
|
|
|
78ef1d |
+ * Can't skip server key exchange if this is an ephemeral
|
|
|
78ef1d |
+ * ciphersuite.
|
|
|
78ef1d |
+ */
|
|
|
78ef1d |
+ if (alg_k & (SSL_kEDH|SSL_kEECDH))
|
|
|
78ef1d |
+ {
|
|
|
78ef1d |
+ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_UNEXPECTED_MESSAGE);
|
|
|
78ef1d |
+ al = SSL_AD_UNEXPECTED_MESSAGE;
|
|
|
78ef1d |
+ goto f_err;
|
|
|
78ef1d |
+ }
|
|
|
78ef1d |
#ifndef OPENSSL_NO_PSK
|
|
|
78ef1d |
/* In plain PSK ciphersuite, ServerKeyExchange can be
|
|
|
78ef1d |
omitted if no identity hint is sent. Set
|
|
|
78ef1d |
session->sess_cert anyway to avoid problems
|
|
|
78ef1d |
later.*/
|
|
|
78ef1d |
- if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)
|
|
|
78ef1d |
+ if (alg_k & SSL_kPSK)
|
|
|
78ef1d |
{
|
|
|
78ef1d |
s->session->sess_cert=ssl_sess_cert_new();
|
|
|
78ef1d |
if (s->ctx->psk_identity_hint)
|
|
|
78ef1d |
@@ -1347,9 +1361,8 @@ int ssl3_get_key_exchange(SSL *s)
|
|
|
78ef1d |
}
|
|
|
78ef1d |
|
|
|
78ef1d |
param_len=0;
|
|
|
78ef1d |
- alg_k=s->s3->tmp.new_cipher->algorithm_mkey;
|
|
|
78ef1d |
+
|
|
|
78ef1d |
alg_a=s->s3->tmp.new_cipher->algorithm_auth;
|
|
|
78ef1d |
- EVP_MD_CTX_init(&md_ctx);
|
|
|
78ef1d |
|
|
|
78ef1d |
#ifndef OPENSSL_NO_PSK
|
|
|
78ef1d |
if (alg_k & SSL_kPSK)
|