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

Unified Diff: openssl/ssl/t1_lib.c

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « openssl/ssl/s3_clnt.c ('k') | openssl/ssl/tls1.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: openssl/ssl/t1_lib.c
diff --git a/openssl/ssl/t1_lib.c b/openssl/ssl/t1_lib.c
index f447f227c295294f94f9b1d8cf3e160f1d89ad7c..7a507f974e9d34b7c70bab8045e00f17dce14971 100644
--- a/openssl/ssl/t1_lib.c
+++ b/openssl/ssl/t1_lib.c
@@ -661,6 +661,31 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha
}
#endif
+ /* Add padding to workaround bugs in F5 terminators.
+ * See https://tools.ietf.org/html/draft-agl-tls-padding-02 */
+ {
+ int hlen = ret - (unsigned char *)s->init_buf->data;
+ /* The code in s23_clnt.c to build ClientHello messages includes the
+ * 5-byte record header in the buffer, while the code in s3_clnt.c does
+ * not. */
+ if (s->state == SSL23_ST_CW_CLNT_HELLO_A)
+ hlen -= 5;
+ if (hlen > 0xff && hlen < 0x200)
+ {
+ hlen = 0x200 - hlen;
+ if (hlen >= 4)
+ hlen -= 4;
+ else
+ hlen = 0;
+
+ s2n(TLSEXT_TYPE_padding, ret);
+ s2n(hlen, ret);
+ memset(ret, 0, hlen);
+ ret += hlen;
+ }
+ }
+
+
if ((extdatalen = ret-p-2)== 0)
return p;
« no previous file with comments | « openssl/ssl/s3_clnt.c ('k') | openssl/ssl/tls1.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698