2 # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
10 use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
11 use OpenSSL::Test::Utils;
14 my $test_name = "test_sslextension";
17 plan skip_all => "TLSProxy isn't usable on $^O"
18 if $^O =~ /^(VMS|MSWin32)$/;
20 plan skip_all => "$test_name needs the dynamic engine feature enabled"
21 if disabled("engine") || disabled("dynamic-engine");
23 plan skip_all => "$test_name needs the sock feature enabled"
26 $ENV{OPENSSL_ia32cap} = '~0x200000200000000';
27 my $proxy = TLSProxy::Proxy->new(
28 \&vers_tolerance_filter,
29 cmdstr(app(["openssl"]), display => 1),
30 srctop_file("apps", "server.pem"),
31 (!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
36 #Test 1: Asking for TLS1.3 should pass
37 my $client_version = TLSProxy::Record::VERS_TLS_1_3;
39 ok(TLSProxy::Message->success(), "Version tolerance test, TLS 1.3");
41 #Test 2: Testing something below SSLv3 should fail
42 $client_version = TLSProxy::Record::VERS_SSL_3_0 - 1;
45 ok(TLSProxy::Message->fail(), "Version tolerance test, SSL < 3.0");
47 sub vers_tolerance_filter
51 # We're only interested in the initial ClientHello
52 if ($proxy->flight != 0) {
56 foreach my $message (@{$proxy->message_list}) {
57 if ($message->mt == TLSProxy::Message::MT_CLIENT_HELLO) {
58 #Set the client version
59 #Anything above the max supported version (TLS1.2) should succeed
60 #Anything below SSLv3 should fail
61 $message->client_version($client_version);