2016-04-22 11:21:51 +00:00
|
|
|
#! /usr/bin/env perl
|
|
|
|
# Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
2015-11-05 14:08:54 +00:00
|
|
|
#
|
2016-04-22 11:21:51 +00: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 14:08:54 +00:00
|
|
|
|
|
|
|
use strict;
|
2016-01-30 00:05:33 +00:00
|
|
|
use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
|
2016-01-16 23:25:44 +00:00
|
|
|
use OpenSSL::Test::Utils;
|
2015-11-05 14:08:54 +00:00
|
|
|
use TLSProxy::Proxy;
|
|
|
|
|
|
|
|
my $test_name = "test_sslcertstatus";
|
|
|
|
setup($test_name);
|
|
|
|
|
2016-01-13 02:53:47 +00:00
|
|
|
plan skip_all => "TLSProxy isn't usable on $^O"
|
2016-03-05 18:59:30 +00:00
|
|
|
if $^O =~ /^(VMS|MSWin32)$/;
|
2016-01-13 02:53:47 +00:00
|
|
|
|
2016-02-19 21:13:11 +00:00
|
|
|
plan skip_all => "$test_name needs the dynamic engine feature enabled"
|
2016-02-22 01:06:05 +00:00
|
|
|
if disabled("engine") || disabled("dynamic-engine");
|
2015-11-05 14:08:54 +00:00
|
|
|
|
2016-03-21 15:32:40 +00:00
|
|
|
plan skip_all => "$test_name needs the sock feature enabled"
|
|
|
|
if disabled("sock");
|
|
|
|
|
2016-03-21 16:54:53 +00:00
|
|
|
plan skip_all => "$test_name needs the ocsp feature enabled"
|
|
|
|
if disabled("ocsp");
|
|
|
|
|
2016-05-04 09:13:15 +00:00
|
|
|
plan skip_all => "$test_name needs TLS enabled"
|
|
|
|
if alldisabled(available_protocols("tls"));
|
|
|
|
|
2015-11-05 14:08:54 +00:00
|
|
|
$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
|
|
|
|
my $proxy = TLSProxy::Proxy->new(
|
|
|
|
\&certstatus_filter,
|
2016-04-01 13:09:28 +00:00
|
|
|
cmdstr(app(["openssl"]), display => 1),
|
2016-02-12 17:26:16 +00:00
|
|
|
srctop_file("apps", "server.pem"),
|
|
|
|
(!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
|
2015-11-05 14:08:54 +00:00
|
|
|
);
|
|
|
|
|
2016-06-14 13:35:26 +00:00
|
|
|
#Test 1: Sending a status_request extension in both ClientHello and
|
|
|
|
#ServerHello but then omitting the CertificateStatus message is valid
|
2015-11-05 14:08:54 +00:00
|
|
|
$proxy->clientflags("-status");
|
2016-06-14 13:35:26 +00:00
|
|
|
$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
|
|
|
|
plan tests => 1;
|
2015-11-05 14:08:54 +00: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-19 16:24:44 +00:00
|
|
|
$message->set_extension(TLSProxy::Message::EXT_STATUS_REQUEST,
|
2015-11-05 14:08:54 +00:00
|
|
|
"");
|
|
|
|
|
|
|
|
$message->repack();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|