summaryrefslogtreecommitdiffstats
path: root/ssl/record
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2017-10-13 11:41:50 +0100
committerMatt Caswell <matt@openssl.org>2017-10-16 15:52:18 +0100
commita2b97bdf3dbbd255ee24aa8a74cf88d4f7034898 (patch)
tree0f9d0b6480413aceaa00c2789da69d137684fd33 /ssl/record
parentaeb3e4abb6abab64342df44b2a7dc407f6508a11 (diff)
Don't do version neg on an HRR
Previously if a client received an HRR then we would do version negotiation immediately - because we know we are going to get TLSv1.3. However this causes a problem when we emit the 2nd ClientHello because we start changing a whole load of stuff to ommit things that aren't relevant for < TLSv1.3. The spec requires that the 2nd ClientHello is the same except for changes required from the HRR. Therefore the simplest thing to do is to defer the version negotiation until we receive the ServerHello. Fixes #4292 Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Ben Kaduk <kaduk@mit.edu> (Merged from https://github.com/openssl/openssl/pull/4527)
Diffstat (limited to 'ssl/record')
-rw-r--r--ssl/record/ssl3_record.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c
index ee026228eb..e17b2f001a 100644
--- a/ssl/record/ssl3_record.c
+++ b/ssl/record/ssl3_record.c
@@ -271,8 +271,13 @@ int ssl3_get_record(SSL *s)
thisrr->type = type;
thisrr->rec_version = version;
- /* Lets check version. In TLSv1.3 we ignore this field */
+ /*
+ * Lets check version. In TLSv1.3 we ignore this field. For an
+ * HRR we haven't actually selected TLSv1.3 yet, but we still
+ * treat it as TLSv1.3, so we must check for that explicitly
+ */
if (!s->first_packet && !SSL_IS_TLS13(s)
+ && !s->hello_retry_request
&& version != (unsigned int)s->version) {
SSLerr(SSL_F_SSL3_GET_RECORD, SSL_R_WRONG_VERSION_NUMBER);
if ((s->version & 0xFF00) == (version & 0xFF00)