X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=ssl%2Ft1_lib.c;h=e21b8a2f039ea142dc93f8f44a45e3304952da46;hp=741f10283112c01db15b15aca76659e4e6c72f32;hb=e02614417d41380c7ccc612375352aac2fab079c;hpb=29b490a45886b409fd402c233acda9659e3f2094 diff --git a/ssl/t1_lib.c b/ssl/t1_lib.c index 741f102831..e21b8a2f03 100644 --- a/ssl/t1_lib.c +++ b/ssl/t1_lib.c @@ -539,7 +539,7 @@ int tls1_set_curves(unsigned char **pext, size_t *pextlen, return 1; } -#define MAX_CURVELIST 25 +#define MAX_CURVELIST 28 typedef struct { @@ -1472,6 +1472,35 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *p, unsigned cha s2n(TLSEXT_TYPE_encrypt_then_mac,ret); s2n(0,ret); #endif +#ifdef TLSEXT_TYPE_padding + /* Add padding to workaround bugs in F5 terminators. + * See https://tools.ietf.org/html/draft-agl-tls-padding-02 + * + * NB: because this code works out the length of all existing + * extensions it MUST always appear last. + */ + { + 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; + } + } +#endif if ((extdatalen = ret-p-2) == 0) return p; @@ -2420,8 +2449,10 @@ static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p, unsigned char { if (tls1_alpn_handle_client_hello(s, data, size, al) != 0) return 0; +#ifndef OPENSSL_NO_NEXTPROTONEG /* ALPN takes precedence over NPN. */ s->s3->next_proto_neg_seen = 0; +#endif } /* session ticket processed earlier */