Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: openssl/patches/paddingext.patch

Issue 112933006: OpenSSL: add support for the TLS padding extension. Base URL: https://chromium.googlesource.com/chromium/deps/openssl.git@master
Patch Set: Add comments at ClientHello construction sites Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « openssl/openssl.config ('k') | openssl/ssl/s23_clnt.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 From 61a9671951205d66382556b2502993ffc9201f59 Mon Sep 17 00:00:00 2001
2 From: Adam Langley <agl@chromium.org>
3 Date: Wed, 11 Dec 2013 16:25:17 -0500
4 Subject: [PATCH 57/57] Add padding extension.
5
6 This change adds a padding extension, when needed, in order to work
7 around bugs in F5 terminators.
8 ---
9 ssl/t1_lib.c | 20 ++++++++++++++++++++
10 ssl/tls1.h | 4 ++++
11 2 files changed, 24 insertions(+)
12
13 diff --git a/ssl/s23_clnt.c b/ssl/s23_clnt.c
14 index 47673e7..94e9692 100644
15 --- a/ssl/s23_clnt.c
16 +++ b/ssl/s23_clnt.c
17 @@ -466,7 +466,10 @@ static int ssl23_client_hello(SSL *s)
18 {
19 /* create Client Hello in SSL 3.0/TLS 1.0 format */
20
21 - /* do the record header (5 bytes) and handshake message header (4 bytes) last */
22 + /* do the record header (5 bytes) and handshake message
23 + * header (4 bytes) last. Note: the code to add the
24 + * padding extension in t1_lib.c depends on the size of
25 + * this prefix. */
26 d = p = &(buf[9]);
27
28 *(p++) = version_major;
29 diff --git a/ssl/s3_clnt.c b/ssl/s3_clnt.c
30 index a657360..faa8d36 100644
31 --- a/ssl/s3_clnt.c
32 +++ b/ssl/s3_clnt.c
33 @@ -752,7 +752,9 @@ int ssl3_client_hello(SSL *s)
34 if (RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0)
35 goto err;
36
37 - /* Do the message type and length last */
38 + /* Do the message type and length last.
39 + * Note: the code to add the padding extension in t1_lib.c
40 + * depends on the size of this prefix. */
41 d=p= &(buf[4]);
42
43 /* version indicates the negotiated version: for example from
44 diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c
45 index 5578056..f9ad9d9 100644
46 --- a/ssl/t1_lib.c
47 +++ b/ssl/t1_lib.c
48 @@ -695,6 +695,31 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha
49 }
50 #endif
51
52 + /* Add padding to workaround bugs in F5 terminators.
53 + * See https://tools.ietf.org/html/draft-agl-tls-padding-02 */
54 + {
55 + int hlen = ret - (unsigned char *)s->init_buf->data;
56 + /* The code in s23_clnt.c to build ClientHello messages includes the
57 + * 5-byte record header in the buffer, while the code in s3_clnt.c does
58 + * not. */
59 + if (s->state == SSL23_ST_CW_CLNT_HELLO_A)
60 + hlen -= 5;
61 + if (hlen > 0xff && hlen < 0x200)
62 + {
63 + hlen = 0x200 - hlen;
64 + if (hlen >= 4)
65 + hlen -= 4;
66 + else
67 + hlen = 0;
68 +
69 + s2n(TLSEXT_TYPE_padding, ret);
70 + s2n(hlen, ret);
71 + memset(ret, 0, hlen);
72 + ret += hlen;
73 + }
74 + }
75 +
76 +
77 if ((extdatalen = ret-p-2)== 0)
78 return p;
79
80 diff --git a/ssl/tls1.h b/ssl/tls1.h
81 index ecf5da7..df8f482 100644
82 --- a/ssl/tls1.h
83 +++ b/ssl/tls1.h
84 @@ -255,6 +255,10 @@ extern "C" {
85 #define TLSEXT_TYPE_channel_id 30031
86 #define TLSEXT_TYPE_channel_id_new 30032
87
88 +/* See https://tools.ietf.org/html/draft-agl-tls-padding-02
89 + * Number not yet IANA assigned. */
90 +#define TLSEXT_TYPE_padding 35655
91 +
92 /* NameType value from RFC 3546 */
93 #define TLSEXT_NAMETYPE_host_name 0
94 /* status request value from RFC 3546 */
95 --
96 1.8.5.1
OLDNEW
« no previous file with comments | « openssl/openssl.config ('k') | openssl/ssl/s23_clnt.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698