OLD | NEW |
(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/t1_lib.c b/ssl/t1_lib.c |
| 14 index 5578056..f9ad9d9 100644 |
| 15 --- a/ssl/t1_lib.c |
| 16 +++ b/ssl/t1_lib.c |
| 17 @@ -695,6 +695,31 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned
char *p, unsigned cha |
| 18 } |
| 19 #endif |
| 20 |
| 21 + /* Add padding to workaround bugs in F5 terminators. |
| 22 + * See https://tools.ietf.org/html/draft-agl-tls-padding-02 */ |
| 23 + { |
| 24 + int hlen = ret - (unsigned char *)s->init_buf->data; |
| 25 + /* The code in s23_clnt.c to build ClientHello messages includes the |
| 26 + * 5-byte record header in the buffer, while the code in s3_clnt.c does |
| 27 + * not. */ |
| 28 + if (s->state == SSL23_ST_CW_CLNT_HELLO_A) |
| 29 + hlen -= 5; |
| 30 + if (hlen > 0xff && hlen < 0x200) |
| 31 + { |
| 32 + hlen = 0x200 - hlen; |
| 33 + if (hlen >= 4) |
| 34 + hlen -= 4; |
| 35 + else |
| 36 + hlen = 0; |
| 37 + |
| 38 + s2n(TLSEXT_TYPE_padding, ret); |
| 39 + s2n(hlen, ret); |
| 40 + memset(ret, 0, hlen); |
| 41 + ret += hlen; |
| 42 + } |
| 43 + } |
| 44 + |
| 45 + |
| 46 if ((extdatalen = ret-p-2)== 0) |
| 47 return p; |
| 48 |
| 49 diff --git a/ssl/tls1.h b/ssl/tls1.h |
| 50 index ecf5da7..df8f482 100644 |
| 51 --- a/ssl/tls1.h |
| 52 +++ b/ssl/tls1.h |
| 53 @@ -255,6 +255,10 @@ extern "C" { |
| 54 #define TLSEXT_TYPE_channel_id 30031 |
| 55 #define TLSEXT_TYPE_channel_id_new 30032 |
| 56 |
| 57 +/* See https://tools.ietf.org/html/draft-agl-tls-padding-02 |
| 58 + * Number not yet IANA assigned. */ |
| 59 +#define TLSEXT_TYPE_padding 35655 |
| 60 + |
| 61 /* NameType value from RFC 3546 */ |
| 62 #define TLSEXT_NAMETYPE_host_name 0 |
| 63 /* status request value from RFC 3546 */ |
| 64 -- |
| 65 1.8.5.1 |
OLD | NEW |