2
0

70-test_sslcertstatus.t 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #! /usr/bin/env perl
  2. # Copyright 2015-2016 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|MSWin32)$/;
  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. $ENV{OPENSSL_ia32cap} = '~0x200000200000000';
  25. my $proxy = TLSProxy::Proxy->new(
  26. \&certstatus_filter,
  27. cmdstr(app(["openssl"]), display => 1),
  28. srctop_file("apps", "server.pem"),
  29. (!$ENV{HARNESS_ACTIVE} || $ENV{HARNESS_VERBOSE})
  30. );
  31. #Test 1: Sending a status_request extension in both ClientHello and
  32. #ServerHello but then omitting the CertificateStatus message is valid
  33. #TODO(TLS1.3): Temporarily disabling this test in TLS1.3 until we've completed
  34. #the move the status request extension to the Certificate message.
  35. $proxy->clientflags("-status -no_tls1_3");
  36. $proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
  37. plan tests => 1;
  38. ok(TLSProxy::Message->success, "Missing CertificateStatus message");
  39. sub certstatus_filter
  40. {
  41. my $proxy = shift;
  42. # We're only interested in the initial ServerHello
  43. if ($proxy->flight != 1) {
  44. return;
  45. }
  46. foreach my $message (@{$proxy->message_list}) {
  47. if ($message->mt == TLSProxy::Message::MT_SERVER_HELLO) {
  48. #Add the status_request to the ServerHello even though we are not
  49. #going to send a CertificateStatus message
  50. $message->set_extension(TLSProxy::Message::EXT_STATUS_REQUEST,
  51. "");
  52. $message->repack();
  53. }
  54. }
  55. }