]>
Commit | Line | Data |
---|---|---|
596d6b7e RS |
1 | #! /usr/bin/env perl |
2 | # Copyright 2015-2016 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 | |
9 | use strict; | |
42e0ccdf | 10 | use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/; |
3f22ed2f | 11 | use OpenSSL::Test::Utils; |
ef96e4a2 MC |
12 | use TLSProxy::Proxy; |
13 | ||
14 | my $test_name = "test_sslcertstatus"; | |
15 | setup($test_name); | |
16 | ||
60f9f1e1 | 17 | plan skip_all => "TLSProxy isn't usable on $^O" |
2d32d3be | 18 | if $^O =~ /^(VMS|MSWin32)$/; |
60f9f1e1 | 19 | |
2dd400bd | 20 | plan skip_all => "$test_name needs the dynamic engine feature enabled" |
19ab5790 | 21 | if disabled("engine") || disabled("dynamic-engine"); |
ef96e4a2 | 22 | |
f9e55034 MC |
23 | plan skip_all => "$test_name needs the sock feature enabled" |
24 | if disabled("sock"); | |
25 | ||
3e41ac35 MC |
26 | plan skip_all => "$test_name needs the ocsp feature enabled" |
27 | if disabled("ocsp"); | |
28 | ||
ef96e4a2 MC |
29 | $ENV{OPENSSL_ia32cap} = '~0x200000200000000'; |
30 | my $proxy = TLSProxy::Proxy->new( | |
31 | \&certstatus_filter, | |
25c78440 | 32 | cmdstr(app(["openssl"]), display => 1), |
b44b935e RL |
33 | srctop_file("apps", "server.pem"), |
34 | (!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE}) | |
ef96e4a2 MC |
35 | ); |
36 | ||
37 | plan tests => 1; | |
38 | ||
39 | #Test 1: Sending a status_request extension in both ClientHello and ServerHello | |
40 | #but then omitting the CertificateStatus message is valid | |
41 | $proxy->clientflags("-status"); | |
42 | $proxy->start(); | |
43 | ok(TLSProxy::Message->success, "Missing CertificateStatus message"); | |
44 | ||
45 | sub certstatus_filter | |
46 | { | |
47 | my $proxy = shift; | |
48 | ||
49 | # We're only interested in the initial ServerHello | |
50 | if ($proxy->flight != 1) { | |
51 | return; | |
52 | } | |
53 | ||
54 | foreach my $message (@{$proxy->message_list}) { | |
55 | if ($message->mt == TLSProxy::Message::MT_SERVER_HELLO) { | |
56 | #Add the status_request to the ServerHello even though we are not | |
57 | #going to send a CertificateStatus message | |
aa474d1f | 58 | $message->set_extension(TLSProxy::Message::EXT_STATUS_REQUEST, |
ef96e4a2 MC |
59 | ""); |
60 | ||
61 | $message->repack(); | |
62 | } | |
63 | } | |
64 | } |