70-test_sslcertstatus.t 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #! /usr/bin/env perl
  2. # Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  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
  8. use strict;
  9. use OpenSSL::Test qw/:DEFAULT cmdstr srctop_file bldtop_dir/;
  10. use OpenSSL::Test::Utils;
  11. use TLSProxy::Proxy;
  12. my $test_name = "test_sslcertstatus";
  13. setup($test_name);
  14. plan skip_all => "TLSProxy isn't usable on $^O"
  15. if $^O =~ /^(VMS)$/;
  16. plan skip_all => "$test_name needs the dynamic engine feature enabled"
  17. if disabled("engine") || disabled("dynamic-engine");
  18. plan skip_all => "$test_name needs the sock feature enabled"
  19. if disabled("sock");
  20. plan skip_all => "$test_name needs the ocsp feature enabled"
  21. if disabled("ocsp");
  22. plan skip_all => "$test_name needs TLS enabled"
  23. if alldisabled(available_protocols("tls"))
  24. || (!disabled("tls1_3") && disabled("tls1_2"));
  25. $ENV{OPENSSL_ia32cap} = '~0x200000200000000';
  26. my $proxy = TLSProxy::Proxy->new(
  27. \&certstatus_filter,
  28. cmdstr(app(["openssl"]), display => 1),
  29. srctop_file("apps", "server.pem"),
  30. (!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
  31. );
  32. #Test 1: Sending a status_request extension in both ClientHello and
  33. #ServerHello but then omitting the CertificateStatus message is valid
  34. $proxy->clientflags("-status -no_tls1_3");
  35. $proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
  36. plan tests => 1;
  37. ok(TLSProxy::Message->success, "Missing CertificateStatus message");
  38. sub certstatus_filter
  39. {
  40. my $proxy = shift;
  41. # We're only interested in the initial ServerHello
  42. if ($proxy->flight != 1) {
  43. return;
  44. }
  45. foreach my $message (@{$proxy->message_list}) {
  46. if ($message->mt == TLSProxy::Message::MT_SERVER_HELLO) {
  47. #Add the status_request to the ServerHello even though we are not
  48. #going to send a CertificateStatus message
  49. $message->set_extension(TLSProxy::Message::EXT_STATUS_REQUEST,
  50. "");
  51. $message->repack();
  52. }
  53. }
  54. }