]> git.ipfire.org Git - thirdparty/openssl.git/blame - test/recipes/70-test_sslcertstatus.t
Update copyright year
[thirdparty/openssl.git] / test / recipes / 70-test_sslcertstatus.t
CommitLineData
596d6b7e 1#! /usr/bin/env perl
6738bf14 2# Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
ef96e4a2 3#
596d6b7e
RS
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
ef96e4a2
MC
8
9use strict;
42e0ccdf 10use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
3f22ed2f 11use OpenSSL::Test::Utils;
ef96e4a2
MC
12use TLSProxy::Proxy;
13
14my $test_name = "test_sslcertstatus";
15setup($test_name);
16
60f9f1e1 17plan skip_all => "TLSProxy isn't usable on $^O"
c5856878 18 if $^O =~ /^(VMS)$/;
60f9f1e1 19
2dd400bd 20plan skip_all => "$test_name needs the dynamic engine feature enabled"
19ab5790 21 if disabled("engine") || disabled("dynamic-engine");
ef96e4a2 22
f9e55034
MC
23plan skip_all => "$test_name needs the sock feature enabled"
24 if disabled("sock");
25
3e41ac35
MC
26plan skip_all => "$test_name needs the ocsp feature enabled"
27 if disabled("ocsp");
28
b273fcc5 29plan skip_all => "$test_name needs TLS enabled"
c423ecaa
MC
30 if alldisabled(available_protocols("tls"))
31 || (!disabled("tls1_3") && disabled("tls1_2"));
b273fcc5 32
ef96e4a2
MC
33$ENV{OPENSSL_ia32cap} = '~0x200000200000000';
34my $proxy = TLSProxy::Proxy->new(
35 \&certstatus_filter,
25c78440 36 cmdstr(app(["openssl"]), display => 1),
b44b935e
RL
37 srctop_file("apps", "server.pem"),
38 (!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
ef96e4a2
MC
39);
40
b02b5743
MC
41#Test 1: Sending a status_request extension in both ClientHello and
42#ServerHello but then omitting the CertificateStatus message is valid
3434f40b
MC
43#TODO(TLS1.3): Temporarily disabling this test in TLS1.3 until we've completed
44#the move the status request extension to the Certificate message.
45$proxy->clientflags("-status -no_tls1_3");
b02b5743
MC
46$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
47plan tests => 1;
ef96e4a2
MC
48ok(TLSProxy::Message->success, "Missing CertificateStatus message");
49
50sub certstatus_filter
51{
52 my $proxy = shift;
53
54 # We're only interested in the initial ServerHello
55 if ($proxy->flight != 1) {
56 return;
57 }
58
59 foreach my $message (@{$proxy->message_list}) {
60 if ($message->mt == TLSProxy::Message::MT_SERVER_HELLO) {
61 #Add the status_request to the ServerHello even though we are not
62 #going to send a CertificateStatus message
aa474d1f 63 $message->set_extension(TLSProxy::Message::EXT_STATUS_REQUEST,
ef96e4a2
MC
64 "");
65
66 $message->repack();
67 }
68 }
69}