Update Token Binding code to match latest draft draft-ietf-tokbind-protocol-04

BUG=467312

Review URL: https://codereview.chromium.org/1636453004

Cr-Original-Commit-Position: refs/heads/master@{#372198}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 47d408a4847886b442365a41ef8281ca99de0812
diff --git a/README.chromium b/README.chromium
index 3bc992d..7c6b6dd 100644
--- a/README.chromium
+++ b/README.chromium
@@ -42,7 +42,7 @@
 - patches/extended_master_secret.patch: Add server support for extended
   master secret.
 - patches/token_binding_negotiation.patch: Add server support for token
-  binding negotiation TLS extension (draft-ietf-tokbind-negotiation-00)
+  binding negotiation TLS extension (draft-ietf-tokbind-negotiation-02)
 - patches/disable_channel_id.patch: Add flag to HandshakeSettings to allow
   for disabling channel id.
 - patches/exported_keying_material.patch: Add method to Session to get
diff --git a/patches/token_binding_negotiation.patch b/patches/token_binding_negotiation.patch
index 336c11d..6f215b3 100644
--- a/patches/token_binding_negotiation.patch
+++ b/patches/token_binding_negotiation.patch
@@ -65,7 +65,7 @@
 +                        p2 = Parser(tokenBindingBytes)
 +                        ver_minor = p2.get(1)
 +                        ver_major = p2.get(1)
-+                        if (ver_major, ver_minor) >= (0, 2):
++                        if (ver_major, ver_minor) >= (0, 3):
 +                            p2.startLengthCheck(1)
 +                            while not p2.atLengthCheck():
 +                                self.tb_client_params.append(p2.get(1))
@@ -90,7 +90,7 @@
 +            w2.add(4, 2)
 +            # version
 +            w2.add(0, 1)
-+            w2.add(2, 1)
++            w2.add(4, 1)
 +            # length of params (defined as variable length <1..2^8-1>, but in
 +            # this context the server can only send a single value.
 +            w2.add(1, 1)
diff --git a/tlslite/messages.py b/tlslite/messages.py
index ab2be57..f7bb141 100644
--- a/tlslite/messages.py
+++ b/tlslite/messages.py
@@ -194,7 +194,7 @@
                         p2 = Parser(tokenBindingBytes)
                         ver_minor = p2.get(1)
                         ver_major = p2.get(1)
-                        if (ver_major, ver_minor) >= (0, 2):
+                        if (ver_major, ver_minor) >= (0, 3):
                             p2.startLengthCheck(1)
                             while not p2.atLengthCheck():
                                 self.tb_client_params.append(p2.get(1))
@@ -382,7 +382,7 @@
             w2.add(4, 2)
             # version
             w2.add(0, 1)
-            w2.add(2, 1)
+            w2.add(4, 1)
             # length of params (defined as variable length <1..2^8-1>, but in
             # this context the server can only send a single value.
             w2.add(1, 1)