#! /usr/bin/env perl
-# Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2015-2021 The OpenSSL Project Authors. All Rights Reserved.
#
-# Licensed under the OpenSSL license (the "License"). You may not use
+# Licensed under the Apache License 2.0 (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
NO_EXTENSION => 3,
EMPTY_EXTENSION => 4,
TLS1_1_AND_1_0_ONLY => 5,
- WITH_TLS1_4 => 6
+ WITH_TLS1_4 => 6,
+ BAD_LEGACY_VERSION => 7
};
my $testtype;
if disabled("sock");
plan skip_all => "$test_name needs TLS1.3, TLS1.2 and TLS1.1 enabled"
- if disabled("tls1_3") || disabled("tls1_2") || disabled("tls1_1");
-
-$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
+ if disabled("tls1_3")
+ || (disabled("ec") && disabled("dh"))
+ || disabled("tls1_2")
+ || disabled("tls1_1");
my $proxy = TLSProxy::Proxy->new(
undef,
);
#We're just testing various negative and unusual scenarios here. ssltest with
-#02-protocol-version.conf should check all the various combinations of normal
+#02-protocol-version.cnf should check all the various combinations of normal
#version neg
#Test 1: An empty supported_versions extension should not succeed
$testtype = EMPTY_EXTENSION;
$proxy->filter(\&modify_supported_versions_filter);
$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
-plan tests => 7;
+plan tests => 8;
ok(TLSProxy::Message->fail(), "Empty supported versions");
#Test 2: supported_versions extension with no recognised versions should not
#Test 6: no TLSv1.3 or TLSv1.2 version in supported versions extension, but
#TLSv1.1 and TLSv1.0 are present. Should just use TLSv1.1 and succeed
$proxy->clear();
+$proxy->clientflags("-cipher DEFAULT:\@SECLEVEL=0");
+$proxy->ciphers("AES128-SHA:\@SECLEVEL=0");
$testtype = TLS1_1_AND_1_0_ONLY;
$proxy->start();
$record = pop @{$proxy->record_list};
&& TLSProxy::Proxy->is_tls13(),
"TLS1.4 in supported versions extension");
+#Test 8: Set the legacy version to SSLv3 with supported versions. Should fail
+$proxy->clear();
+$testtype = BAD_LEGACY_VERSION;
+$proxy->start();
+ok(TLSProxy::Message->fail(), "Legacy version is SSLv3 with supported versions");
+
sub modify_supported_versions_filter
{
my $proxy = shift;
} elsif ($testtype == EMPTY_EXTENSION) {
$message->set_extension(
TLSProxy::Message::EXT_SUPPORTED_VERSIONS, "");
- } else {
+ } elsif ($testtype == NO_EXTENSION) {
$message->delete_extension(
TLSProxy::Message::EXT_SUPPORTED_VERSIONS);
+ } else {
+ # BAD_LEGACY_VERSION
+ $message->client_version(TLSProxy::Record::VERS_SSL_3_0);
}
$message->repack();
}
}
}
-
-