test/recipes/80-test_pkcs12.t: handle lack of Win32::API.
[oweals/openssl.git] / test / clienthellotest.c
index 88e0a1c66aa00932f9b8b9ad76d6c2428ea163d4..4f6bd40c9baab066f75bb279f763f4c93f1f30f8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the OpenSSL license (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -81,12 +81,26 @@ static int test_client_hello(int currtest)
 
     switch(currtest) {
     case TEST_SET_SESSION_TICK_DATA_VER_NEG:
+#if !defined(OPENSSL_NO_TLS1_3) && defined(OPENSSL_NO_TLS1_2)
+        /* TLSv1.3 is enabled and TLSv1.2 is disabled so can't do this test */
+        return 1;
+#else
         /* Testing for session tickets <= TLS1.2; not relevant for 1.3 */
         if (!TEST_true(SSL_CTX_set_max_proto_version(ctx, TLS1_2_VERSION)))
             goto end;
+#endif
         break;
 
     case TEST_ADD_PADDING_AND_PSK:
+        /*
+         * In this case we're doing TLSv1.3 and we're sending a PSK so the
+         * ClientHello is already going to be quite long. To avoid getting one
+         * that is too long for this test we use a restricted ciphersuite list
+         */
+        if (!TEST_true(SSL_CTX_set_cipher_list(ctx,
+                                               "TLS13-AES-128-GCM-SHA256")))
+            goto end;
+         /* Fall through */
     case TEST_ADD_PADDING:
     case TEST_PADDING_NOT_NEEDED:
         SSL_CTX_set_options(ctx, SSL_OP_TLSEXT_PADDING);