2016-04-22 19:21:51 +08:00
|
|
|
#! /usr/bin/env perl
|
|
|
|
# Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2015-11-05 22:08:54 +08:00
|
|
|
#
|
2016-04-22 19:21:51 +08:00
|
|
|
# Licensed under the OpenSSL license (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
|
2015-11-05 22:08:54 +08:00
|
|
|
|
|
|
|
use strict;
|
2016-01-30 08:05:33 +08:00
|
|
|
use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
|
2016-01-17 07:25:44 +08:00
|
|
|
use OpenSSL::Test::Utils;
|
2015-11-05 22:08:54 +08:00
|
|
|
use TLSProxy::Proxy;
|
|
|
|
|
|
|
|
my $test_name = "test_sslcertstatus";
|
|
|
|
setup($test_name);
|
|
|
|
|
2016-01-13 10:53:47 +08:00
|
|
|
plan skip_all => "TLSProxy isn't usable on $^O"
|
2018-01-17 17:39:28 +08:00
|
|
|
if $^O =~ /^(VMS)$/;
|
2016-01-13 10:53:47 +08:00
|
|
|
|
2016-02-20 05:13:11 +08:00
|
|
|
plan skip_all => "$test_name needs the dynamic engine feature enabled"
|
2016-02-22 09:06:05 +08:00
|
|
|
if disabled("engine") || disabled("dynamic-engine");
|
2015-11-05 22:08:54 +08:00
|
|
|
|
2016-03-21 23:32:40 +08:00
|
|
|
plan skip_all => "$test_name needs the sock feature enabled"
|
|
|
|
if disabled("sock");
|
|
|
|
|
2016-03-22 00:54:53 +08:00
|
|
|
plan skip_all => "$test_name needs the ocsp feature enabled"
|
|
|
|
if disabled("ocsp");
|
|
|
|
|
2016-05-04 17:13:15 +08:00
|
|
|
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-05-04 17:13:15 +08:00
|
|
|
|
2015-11-05 22:08:54 +08:00
|
|
|
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
|
|
|
my $proxy = TLSProxy::Proxy->new(
|
|
|
|
\&certstatus_filter,
|
2016-04-01 21:09:28 +08:00
|
|
|
cmdstr(app(["openssl"]), display => 1),
|
2016-02-13 01:26:16 +08:00
|
|
|
srctop_file("apps", "server.pem"),
|
|
|
|
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
2015-11-05 22:08:54 +08:00
|
|
|
);
|
|
|
|
|
2016-06-14 21:35:26 +08:00
|
|
|
#Test 1: Sending a status_request extension in both ClientHello and
|
|
|
|
#ServerHello but then omitting the CertificateStatus message is valid
|
2016-11-29 00:45:52 +08:00
|
|
|
#TODO(TLS1.3): Temporarily disabling this test in TLS1.3 until we've completed
|
|
|
|
#the move the status request extension to the Certificate message.
|
|
|
|
$proxy->clientflags("-status -no_tls1_3");
|
2016-06-14 21:35:26 +08:00
|
|
|
$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
|
|
|
|
plan tests => 1;
|
2015-11-05 22:08:54 +08:00
|
|
|
ok(TLSProxy::Message->success, "Missing CertificateStatus message");
|
|
|
|
|
|
|
|
sub certstatus_filter
|
|
|
|
{
|
|
|
|
my $proxy = shift;
|
|
|
|
|
|
|
|
# We're only interested in the initial ServerHello
|
|
|
|
if ($proxy->flight != 1) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach my $message (@{$proxy->message_list}) {
|
|
|
|
if ($message->mt == TLSProxy::Message::MT_SERVER_HELLO) {
|
|
|
|
#Add the status_request to the ServerHello even though we are not
|
|
|
|
#going to send a CertificateStatus message
|
2016-02-20 00:24:44 +08:00
|
|
|
$message->set_extension(TLSProxy::Message::EXT_STATUS_REQUEST,
|
2015-11-05 22:08:54 +08:00
|
|
|
"");
|
|
|
|
|
|
|
|
$message->repack();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|