2
0

80-test_policy_tree.t 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #! /usr/bin/env perl
  2. # Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
  3. #
  4. # Licensed under the Apache License 2.0 (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 warnings;
  10. use POSIX;
  11. use OpenSSL::Test qw/:DEFAULT srctop_file with data_file/;
  12. use OpenSSL::Test::Utils;
  13. use OpenSSL::Glob;
  14. setup("test_policy_tree");
  15. plan skip_all => "No EC support" if disabled("ec");
  16. plan tests => 2;
  17. # The small pathological tree is expected to work
  18. my $small_chain = srctop_file("test", "recipes", "80-test_policy_tree_data",
  19. "small_policy_tree.pem");
  20. my $small_leaf = srctop_file("test", "recipes", "80-test_policy_tree_data",
  21. "small_leaf.pem");
  22. ok(run(app(["openssl", "verify", "-CAfile", $small_chain,
  23. "-policy_check", $small_leaf])),
  24. "test small policy tree");
  25. # The large pathological tree is expected to fail
  26. my $large_chain = srctop_file("test", "recipes", "80-test_policy_tree_data",
  27. "large_policy_tree.pem");
  28. my $large_leaf = srctop_file("test", "recipes", "80-test_policy_tree_data",
  29. "large_leaf.pem");
  30. ok(!run(app(["openssl", "verify", "-CAfile", $large_chain,
  31. "-policy_check", $large_leaf])),
  32. "test large policy tree");