2016-11-23 00:16:11 +08:00
|
|
|
#! /usr/bin/env perl
|
2018-02-13 20:51:29 +08:00
|
|
|
# Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
|
2016-11-23 00:16:11 +08:00
|
|
|
#
|
2018-12-06 20:05:25 +08:00
|
|
|
# Licensed under the Apache License 2.0 (the "License"). You may not use
|
2016-11-23 00:16:11 +08:00
|
|
|
# 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
|
|
|
|
|
|
|
|
use strict;
|
2016-11-30 01:34:10 +08:00
|
|
|
use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file srctop_dir bldtop_dir/;
|
2016-11-23 00:16:11 +08:00
|
|
|
use OpenSSL::Test::Utils;
|
|
|
|
use File::Temp qw(tempfile);
|
|
|
|
use TLSProxy::Proxy;
|
2016-12-08 08:03:53 +08:00
|
|
|
use checkhandshake qw(checkhandshake @handmessages @extensions);
|
2016-11-30 01:34:10 +08:00
|
|
|
|
2016-12-08 08:03:53 +08:00
|
|
|
my $test_name = "test_sslmessages";
|
|
|
|
setup($test_name);
|
2016-11-30 01:34:10 +08:00
|
|
|
|
2016-11-23 00:16:11 +08:00
|
|
|
plan skip_all => "TLSProxy isn't usable on $^O"
|
2018-01-17 17:39:28 +08:00
|
|
|
if $^O =~ /^(VMS)$/;
|
2016-11-23 00:16:11 +08:00
|
|
|
|
|
|
|
plan skip_all => "$test_name needs the dynamic engine feature enabled"
|
|
|
|
if disabled("engine") || disabled("dynamic-engine");
|
|
|
|
|
|
|
|
plan skip_all => "$test_name needs the sock feature enabled"
|
|
|
|
if disabled("sock");
|
|
|
|
|
|
|
|
plan skip_all => "$test_name needs TLS enabled"
|
2018-02-09 18:19:14 +08:00
|
|
|
if alldisabled(available_protocols("tls"))
|
|
|
|
|| (!disabled("tls1_3") && disabled("tls1_2"));
|
2016-11-23 00:16:11 +08:00
|
|
|
|
|
|
|
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
2016-11-30 20:04:34 +08:00
|
|
|
$ENV{CTLOG_FILE} = srctop_file("test", "ct", "log_list.conf");
|
2016-11-29 23:57:42 +08:00
|
|
|
|
2016-11-23 00:16:11 +08:00
|
|
|
my $proxy = TLSProxy::Proxy->new(
|
|
|
|
undef,
|
|
|
|
cmdstr(app(["openssl"]), display => 1),
|
|
|
|
srctop_file("apps", "server.pem"),
|
|
|
|
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
|
|
|
);
|
|
|
|
|
2016-11-30 01:34:10 +08:00
|
|
|
@handmessages = (
|
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALL_HANDSHAKES],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALL_HANDSHAKES],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CERTIFICATE,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALL_HANDSHAKES
|
|
|
|
& ~checkhandshake::RESUME_HANDSHAKE],
|
2016-12-28 23:01:57 +08:00
|
|
|
(disabled("ec") ? () :
|
|
|
|
[TLSProxy::Message::MT_SERVER_KEY_EXCHANGE,
|
|
|
|
checkhandshake::EC_HANDSHAKE]),
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CERTIFICATE_STATUS,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::OCSP_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
#ServerKeyExchange handshakes not currently supported by TLSProxy
|
|
|
|
[TLSProxy::Message::MT_CERTIFICATE_REQUEST,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::CLIENT_AUTH_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO_DONE,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALL_HANDSHAKES
|
|
|
|
& ~checkhandshake::RESUME_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CERTIFICATE,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::CLIENT_AUTH_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_KEY_EXCHANGE,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALL_HANDSHAKES
|
|
|
|
& ~checkhandshake::RESUME_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CERTIFICATE_VERIFY,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::CLIENT_AUTH_HANDSHAKE],
|
2016-11-30 20:04:34 +08:00
|
|
|
[TLSProxy::Message::MT_NEXT_PROTO,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::NPN_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_FINISHED,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALL_HANDSHAKES],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_NEW_SESSION_TICKET,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALL_HANDSHAKES
|
|
|
|
& ~checkhandshake::RESUME_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_FINISHED,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALL_HANDSHAKES],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::RENEG_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::RENEG_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CERTIFICATE,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::RENEG_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO_DONE,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::RENEG_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_KEY_EXCHANGE,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::RENEG_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_FINISHED,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::RENEG_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_NEW_SESSION_TICKET,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::RENEG_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_FINISHED,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::RENEG_HANDSHAKE],
|
2016-11-30 01:34:10 +08:00
|
|
|
[0, 0]
|
|
|
|
);
|
|
|
|
|
|
|
|
@extensions = (
|
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SERVER_NAME,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::SERVER_NAME_CLI_EXTENSION],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_STATUS_REQUEST,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::STATUS_REQUEST_CLI_EXTENSION],
|
2016-12-28 23:01:57 +08:00
|
|
|
(disabled("ec") ? () :
|
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO,
|
|
|
|
TLSProxy::Message::EXT_SUPPORTED_GROUPS,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-28 23:01:57 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS]),
|
|
|
|
(disabled("ec") ? () :
|
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO,
|
|
|
|
TLSProxy::Message::EXT_EC_POINT_FORMATS,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-28 23:01:57 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS]),
|
2016-12-26 00:55:57 +08:00
|
|
|
(disabled("tls1_2") ? () :
|
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SIG_ALGS,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-26 00:55:57 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS]),
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_ALPN,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALPN_CLI_EXTENSION],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SCT,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::SCT_CLI_EXTENSION],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_ENCRYPT_THEN_MAC,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_EXTENDED_MASTER_SECRET,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SESSION_TICKET,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_RENEGOTIATE,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::RENEGOTIATE_CLI_EXTENSION],
|
2016-11-30 20:04:34 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_NPN,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::NPN_CLI_EXTENSION],
|
2016-11-30 20:04:34 +08:00
|
|
|
[TLSProxy::Message::MT_CLIENT_HELLO, TLSProxy::Message::EXT_SRP,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::CLIENT,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::SRP_CLI_EXTENSION],
|
2016-11-30 01:34:10 +08:00
|
|
|
|
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_RENEGOTIATE,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_ENCRYPT_THEN_MAC,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_EXTENDED_MASTER_SECRET,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_SESSION_TICKET,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::SESSION_TICKET_SRV_EXTENSION],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_SERVER_NAME,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::SERVER_NAME_SRV_EXTENSION],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_STATUS_REQUEST,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::STATUS_REQUEST_SRV_EXTENSION],
|
2016-11-30 01:34:10 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_ALPN,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::ALPN_SRV_EXTENSION],
|
2016-11-30 20:04:34 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_SCT,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::SCT_SRV_EXTENSION],
|
2016-11-30 20:04:34 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_NPN,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake::NPN_SRV_EXTENSION],
|
2016-12-28 23:01:57 +08:00
|
|
|
[TLSProxy::Message::MT_SERVER_HELLO, TLSProxy::Message::EXT_EC_POINT_FORMATS,
|
2019-09-05 23:21:56 +08:00
|
|
|
TLSProxy::Message::SERVER,
|
2016-12-28 23:01:57 +08:00
|
|
|
checkhandshake::EC_POINT_FORMAT_SRV_EXTENSION],
|
2019-09-05 23:21:56 +08:00
|
|
|
[0,0,0,0]
|
2016-11-30 01:34:10 +08:00
|
|
|
);
|
2016-11-23 00:16:11 +08:00
|
|
|
|
|
|
|
#Test 1: Check we get all the right messages for a default handshake
|
|
|
|
(undef, my $session) = tempfile();
|
|
|
|
$proxy->serverconnects(2);
|
|
|
|
$proxy->clientflags("-no_tls1_3 -sess_out ".$session);
|
|
|
|
$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
|
2016-12-28 23:01:57 +08:00
|
|
|
plan tests => 21;
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS,
|
2016-11-30 01:34:10 +08:00
|
|
|
"Default handshake test");
|
2016-11-23 00:16:11 +08:00
|
|
|
|
|
|
|
#Test 2: Resumption handshake
|
|
|
|
$proxy->clearClient();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -sess_in ".$session);
|
|
|
|
$proxy->clientstart();
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::RESUME_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
2017-11-14 21:43:42 +08:00
|
|
|
& ~checkhandshake::SESSION_TICKET_SRV_EXTENSION,
|
2016-11-30 01:34:10 +08:00
|
|
|
"Resumption handshake test");
|
2016-11-23 00:16:11 +08:00
|
|
|
unlink $session;
|
|
|
|
|
2017-01-04 16:16:29 +08:00
|
|
|
SKIP: {
|
|
|
|
skip "No OCSP support in this OpenSSL build", 3
|
|
|
|
if disabled("ocsp");
|
2016-11-30 20:04:34 +08:00
|
|
|
|
2017-01-04 16:16:29 +08:00
|
|
|
#Test 3: A status_request handshake (client request only)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -status");
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::STATUS_REQUEST_CLI_EXTENSION,
|
|
|
|
"status_request handshake test (client)");
|
2016-11-30 20:04:34 +08:00
|
|
|
|
2017-01-04 16:16:29 +08:00
|
|
|
#Test 4: A status_request handshake (server support only)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3");
|
|
|
|
$proxy->serverflags("-status_file "
|
|
|
|
.srctop_file("test", "recipes", "ocsp-response.der"));
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS,
|
|
|
|
"status_request handshake test (server)");
|
|
|
|
|
|
|
|
#Test 5: A status_request handshake (client and server)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -status");
|
|
|
|
$proxy->serverflags("-status_file "
|
|
|
|
.srctop_file("test", "recipes", "ocsp-response.der"));
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::OCSP_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::STATUS_REQUEST_CLI_EXTENSION
|
|
|
|
| checkhandshake::STATUS_REQUEST_SRV_EXTENSION,
|
|
|
|
"status_request handshake test");
|
|
|
|
}
|
2016-11-23 00:16:11 +08:00
|
|
|
|
2016-11-30 20:04:34 +08:00
|
|
|
#Test 6: A client auth handshake
|
2016-11-23 00:16:11 +08:00
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -cert ".srctop_file("apps", "server.pem"));
|
|
|
|
$proxy->serverflags("-Verify 5");
|
|
|
|
$proxy->start();
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::CLIENT_AUTH_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS,
|
2016-11-30 01:34:10 +08:00
|
|
|
"Client auth handshake test");
|
2016-11-23 00:16:11 +08:00
|
|
|
|
2016-11-30 20:04:34 +08:00
|
|
|
#Test 7: A handshake with a renegotiation
|
2016-11-23 00:16:11 +08:00
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3");
|
|
|
|
$proxy->reneg(1);
|
|
|
|
$proxy->start();
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::RENEG_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS,
|
2017-11-12 08:03:10 +08:00
|
|
|
"Renegotiation handshake test");
|
2016-11-30 01:34:10 +08:00
|
|
|
|
2017-02-13 21:26:37 +08:00
|
|
|
#Test 8: Server name handshake (no client request)
|
2016-11-30 20:04:34 +08:00
|
|
|
$proxy->clear();
|
2017-02-13 21:26:37 +08:00
|
|
|
$proxy->clientflags("-no_tls1_3 -noservername");
|
2016-11-30 20:04:34 +08:00
|
|
|
$proxy->start();
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
2017-02-13 21:26:37 +08:00
|
|
|
& ~checkhandshake::SERVER_NAME_CLI_EXTENSION,
|
2016-12-08 17:44:06 +08:00
|
|
|
"Server name handshake test (client)");
|
2016-11-30 20:04:34 +08:00
|
|
|
|
|
|
|
#Test 9: Server name handshake (server support only)
|
|
|
|
$proxy->clear();
|
2017-02-13 21:26:37 +08:00
|
|
|
$proxy->clientflags("-no_tls1_3 -noservername");
|
2016-11-30 20:04:34 +08:00
|
|
|
$proxy->serverflags("-servername testhost");
|
|
|
|
$proxy->start();
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
2017-02-13 21:26:37 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
& ~checkhandshake::SERVER_NAME_CLI_EXTENSION,
|
2016-12-08 17:44:06 +08:00
|
|
|
"Server name handshake test (server)");
|
2016-11-30 20:04:34 +08:00
|
|
|
|
|
|
|
#Test 10: Server name handshake (client and server)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -servername testhost");
|
|
|
|
$proxy->serverflags("-servername testhost");
|
|
|
|
$proxy->start();
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
2016-12-08 17:44:06 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::SERVER_NAME_SRV_EXTENSION,
|
|
|
|
"Server name handshake test");
|
2016-11-30 20:04:34 +08:00
|
|
|
|
|
|
|
#Test 11: ALPN handshake (client request only)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -alpn test");
|
|
|
|
$proxy->start();
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::ALPN_CLI_EXTENSION,
|
2016-12-08 17:44:06 +08:00
|
|
|
"ALPN handshake test (client)");
|
2016-11-30 01:34:10 +08:00
|
|
|
|
2016-11-30 20:04:34 +08:00
|
|
|
#Test 12: ALPN handshake (server support only)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3");
|
|
|
|
$proxy->serverflags("-alpn test");
|
|
|
|
$proxy->start();
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS,
|
2016-12-08 17:44:06 +08:00
|
|
|
"ALPN handshake test (server)");
|
2016-11-30 21:46:11 +08:00
|
|
|
|
2016-11-30 20:04:34 +08:00
|
|
|
#Test 13: ALPN handshake (client and server)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -alpn test");
|
|
|
|
$proxy->serverflags("-alpn test");
|
|
|
|
$proxy->start();
|
2016-12-08 08:03:53 +08:00
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
2016-12-08 17:44:06 +08:00
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::ALPN_CLI_EXTENSION
|
|
|
|
| checkhandshake::ALPN_SRV_EXTENSION,
|
|
|
|
"ALPN handshake test");
|
2016-11-30 20:04:34 +08:00
|
|
|
|
2016-12-16 17:29:43 +08:00
|
|
|
SKIP: {
|
2017-01-04 16:16:29 +08:00
|
|
|
skip "No CT, EC or OCSP support in this OpenSSL build", 1
|
|
|
|
if disabled("ct") || disabled("ec") || disabled("ocsp");
|
2016-12-16 17:29:43 +08:00
|
|
|
|
|
|
|
#Test 14: SCT handshake (client request only)
|
|
|
|
$proxy->clear();
|
|
|
|
#Note: -ct also sends status_request
|
|
|
|
$proxy->clientflags("-no_tls1_3 -ct");
|
|
|
|
$proxy->serverflags("-status_file "
|
|
|
|
.srctop_file("test", "recipes", "ocsp-response.der"));
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::OCSP_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::SCT_CLI_EXTENSION
|
|
|
|
| checkhandshake::STATUS_REQUEST_CLI_EXTENSION
|
|
|
|
| checkhandshake::STATUS_REQUEST_SRV_EXTENSION,
|
|
|
|
"SCT handshake test (client)");
|
|
|
|
}
|
2016-11-30 20:04:34 +08:00
|
|
|
|
2017-01-04 16:16:29 +08:00
|
|
|
SKIP: {
|
|
|
|
skip "No OCSP support in this OpenSSL build", 1
|
|
|
|
if disabled("ocsp");
|
|
|
|
|
|
|
|
#Test 15: SCT handshake (server support only)
|
|
|
|
$proxy->clear();
|
|
|
|
#Note: -ct also sends status_request
|
|
|
|
$proxy->clientflags("-no_tls1_3");
|
|
|
|
$proxy->serverflags("-status_file "
|
|
|
|
.srctop_file("test", "recipes", "ocsp-response.der"));
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS,
|
|
|
|
"SCT handshake test (server)");
|
|
|
|
}
|
2016-11-30 20:04:34 +08:00
|
|
|
|
2016-12-16 17:29:43 +08:00
|
|
|
SKIP: {
|
2017-01-04 16:16:29 +08:00
|
|
|
skip "No CT, EC or OCSP support in this OpenSSL build", 1
|
|
|
|
if disabled("ct") || disabled("ec") || disabled("ocsp");
|
2016-12-16 17:29:43 +08:00
|
|
|
|
|
|
|
#Test 16: SCT handshake (client and server)
|
|
|
|
#There is no built-in server side support for this so we are actually also
|
|
|
|
#testing custom extensions here
|
|
|
|
$proxy->clear();
|
|
|
|
#Note: -ct also sends status_request
|
|
|
|
$proxy->clientflags("-no_tls1_3 -ct");
|
|
|
|
$proxy->serverflags("-status_file "
|
|
|
|
.srctop_file("test", "recipes", "ocsp-response.der")
|
|
|
|
." -serverinfo ".srctop_file("test", "serverinfo.pem"));
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::OCSP_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::SCT_CLI_EXTENSION
|
|
|
|
| checkhandshake::SCT_SRV_EXTENSION
|
|
|
|
| checkhandshake::STATUS_REQUEST_CLI_EXTENSION
|
|
|
|
| checkhandshake::STATUS_REQUEST_SRV_EXTENSION,
|
|
|
|
"SCT handshake test");
|
|
|
|
}
|
2016-11-30 20:04:34 +08:00
|
|
|
|
|
|
|
|
2017-01-04 15:28:43 +08:00
|
|
|
SKIP: {
|
|
|
|
skip "No NPN support in this OpenSSL build", 3
|
|
|
|
if disabled("nextprotoneg");
|
2016-11-30 20:04:34 +08:00
|
|
|
|
2017-01-04 15:28:43 +08:00
|
|
|
#Test 17: NPN handshake (client request only)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -nextprotoneg test");
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::NPN_CLI_EXTENSION,
|
|
|
|
"NPN handshake test (client)");
|
2016-11-30 21:46:11 +08:00
|
|
|
|
2017-01-04 15:28:43 +08:00
|
|
|
#Test 18: NPN handshake (server support only)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3");
|
|
|
|
$proxy->serverflags("-nextprotoneg test");
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS,
|
|
|
|
"NPN handshake test (server)");
|
|
|
|
|
|
|
|
#Test 19: NPN handshake (client and server)
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -nextprotoneg test");
|
|
|
|
$proxy->serverflags("-nextprotoneg test");
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::NPN_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::NPN_CLI_EXTENSION
|
|
|
|
| checkhandshake::NPN_SRV_EXTENSION,
|
|
|
|
"NPN handshake test");
|
|
|
|
}
|
2016-11-30 20:04:34 +08:00
|
|
|
|
2017-01-04 15:47:05 +08:00
|
|
|
SKIP: {
|
|
|
|
skip "No SRP support in this OpenSSL build", 1
|
|
|
|
if disabled("srp");
|
|
|
|
|
|
|
|
#Test 20: SRP extension
|
|
|
|
#Note: We are not actually going to perform an SRP handshake (TLSProxy
|
|
|
|
#does not support it). However it is sufficient for us to check that the
|
|
|
|
#SRP extension gets added on the client side. There is no SRP extension
|
|
|
|
#generated on the server side anyway.
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3 -srpuser user -srppass pass:pass");
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::DEFAULT_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::SRP_CLI_EXTENSION,
|
|
|
|
"SRP extension test");
|
|
|
|
}
|
2016-12-28 23:01:57 +08:00
|
|
|
|
|
|
|
#Test 21: EC handshake
|
|
|
|
SKIP: {
|
|
|
|
skip "No EC support in this OpenSSL build", 1 if disabled("ec");
|
|
|
|
$proxy->clear();
|
|
|
|
$proxy->clientflags("-no_tls1_3");
|
2017-04-26 18:28:20 +08:00
|
|
|
$proxy->serverflags("-no_tls1_3");
|
2016-12-28 23:01:57 +08:00
|
|
|
$proxy->ciphers("ECDHE-RSA-AES128-SHA");
|
|
|
|
$proxy->start();
|
|
|
|
checkhandshake($proxy, checkhandshake::EC_HANDSHAKE,
|
|
|
|
checkhandshake::DEFAULT_EXTENSIONS
|
|
|
|
| checkhandshake::EC_POINT_FORMAT_SRV_EXTENSION,
|
|
|
|
"EC handshake test");
|
|
|
|
}
|