The record version for ClientHello2 should be TLS1.2
authorMatt Caswell <matt@openssl.org>
Thu, 15 Feb 2018 14:29:45 +0000 (14:29 +0000)
committerMatt Caswell <matt@openssl.org>
Mon, 19 Feb 2018 14:02:33 +0000 (14:02 +0000)
According to TLSv1.3 draft-24 the record version for ClientHello2 should
be TLS1.2, and not TLS1.0 as it is now.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5377)

ssl/record/rec_layer_s3.c
test/tls13ccstest.c

index ea70258..0953d2b 100644 (file)
@@ -839,7 +839,9 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
          * and record version number > TLS 1.0
          */
         if (SSL_get_state(s) == TLS_ST_CW_CLNT_HELLO
          * and record version number > TLS 1.0
          */
         if (SSL_get_state(s) == TLS_ST_CW_CLNT_HELLO
-            && !s->renegotiate && TLS1_get_version(s) > TLS1_VERSION)
+                && !s->renegotiate
+                && TLS1_get_version(s) > TLS1_VERSION
+                && s->hello_retry_request == SSL_HRR_NONE)
             version = TLS1_VERSION;
 
         maxcomplen = pipelens[j];
             version = TLS1_VERSION;
 
         maxcomplen = pipelens[j];
index c51c2ce..db9bfe5 100644 (file)
@@ -118,7 +118,7 @@ static int watchccs_write(BIO *bio, const char *in, int inl)
                 return 0;
             if (msgtype == SSL3_MT_CLIENT_HELLO) {
                 chseen++;
                 return 0;
             if (msgtype == SSL3_MT_CLIENT_HELLO) {
                 chseen++;
-                expectedrecvers = TLS1_VERSION;
+
                 /*
                  * Skip legacy_version (2 bytes) and Random (32 bytes) to read
                  * session_id.
                 /*
                  * Skip legacy_version (2 bytes) and Random (32 bytes) to read
                  * session_id.
@@ -128,6 +128,8 @@ static int watchccs_write(BIO *bio, const char *in, int inl)
                     return 0;
 
                 if (chseen == 1) {
                     return 0;
 
                 if (chseen == 1) {
+                    expectedrecvers = TLS1_VERSION;
+
                     /* Save the session id for later */
                     chsessidlen = PACKET_remaining(&sessionid);
                     if (!PACKET_copy_bytes(&sessionid, chsessid, chsessidlen))
                     /* Save the session id for later */
                     chsessidlen = PACKET_remaining(&sessionid);
                     if (!PACKET_copy_bytes(&sessionid, chsessid, chsessidlen))