diff options
author | Matt Caswell <matt@openssl.org> | 2017-03-16 15:09:59 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2017-03-16 15:37:41 +0000 |
commit | 6828358c6565af0e31ac1a9ff9c54c94a04bec75 (patch) | |
tree | ac174ee45f16fa4ee9e95a19d48f3ae17f34abaf | |
parent | 6bc6ca623b1785653ae2e0332957f0355f496509 (diff) | |
download | openssl-6828358c6565af0e31ac1a9ff9c54c94a04bec75.tar.gz |
Handle TLSv1.3 being disabled in clienthello test
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2968)
-rw-r--r-- | test/clienthellotest.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/test/clienthellotest.c b/test/clienthellotest.c index efdea942b7..e72ecc277a 100644 --- a/test/clienthellotest.c +++ b/test/clienthellotest.c @@ -44,7 +44,11 @@ #define F5_WORKAROUND_MIN_MSG_LEN 0xff #define F5_WORKAROUND_MAX_MSG_LEN 0x200 -const char *sessionfile = NULL; +static const char *sessionfile = NULL; +/* Dummy ALPN protocols used to pad out the size of the ClientHello */ +static const char alpn_prots[] = + "0123456789012345678901234567890123456789012345678901234567890123456789" + "0123456789012345678901234567890123456789012345678901234567890123456789"; static int test_client_hello(int currtest) { @@ -62,6 +66,11 @@ static int test_client_hello(int currtest) BIO *sessbio = NULL; SSL_SESSION *sess = NULL; +#ifdef OPENSSL_NO_TLS1_3 + if (currtest == TEST_ADD_PADDING_AND_PSK) + return 1; +#endif + /* * For each test set up an SSL_CTX and SSL and see what ClientHello gets * produced when we try to connect @@ -84,12 +93,16 @@ static int test_client_hello(int currtest) /* * Add lots of ciphersuites so that the ClientHello is at least * F5_WORKAROUND_MIN_MSG_LEN bytes long - meaning padding will be - * needed. + * needed. Also add some dummy ALPN protocols in case we still don't + * have enough. * In the padding not needed case we assume the test will pass, but then * set testresult to 0 if we see the padding extension. */ if (currtest == TEST_ADD_PADDING - && !SSL_CTX_set_cipher_list(ctx, "ALL")) + && (!SSL_CTX_set_cipher_list(ctx, "ALL") + || SSL_CTX_set_alpn_protos(ctx, + (unsigned char *)alpn_prots, + sizeof(alpn_prots) - 1))) goto end; else if (currtest == TEST_PADDING_NOT_NEEDED) testresult = 1; @@ -224,7 +237,7 @@ end: int test_main(int argc, char *argv[]) { if (argc != 2) - return 0; + return EXIT_FAILURE; sessionfile = argv[1]; |