Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test cases for the policy resource overuse
These trees have pathological properties with respect to building. The small tree stays within the imposed limit, the large tree doesn't. The large tree would consume over 150Gb of RAM to process. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from #20568)
- Loading branch information
Showing
5 changed files
with
567 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#! /usr/bin/env perl | ||
# Copyright 2023 The OpenSSL Project Authors. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License 2.0 (the "License"). You may not use | ||
# this file except in compliance with the License. You can obtain a copy | ||
# in the file LICENSE in the source distribution or at | ||
# https://www.openssl.org/source/license.html | ||
|
||
|
||
use strict; | ||
use warnings; | ||
|
||
use POSIX; | ||
use OpenSSL::Test qw/:DEFAULT srctop_file with data_file/; | ||
|
||
use OpenSSL::Test::Utils; | ||
use OpenSSL::Glob; | ||
|
||
setup("test_policy_tree"); | ||
|
||
plan tests => 2; | ||
|
||
# The small pathological tree is expected to work | ||
my $small_chain = srctop_file("test", "recipes", "80-test_policy_tree_data", | ||
"small_policy_tree.pem"); | ||
my $small_leaf = srctop_file("test", "recipes", "80-test_policy_tree_data", | ||
"small_leaf.pem"); | ||
|
||
ok(run(app(["openssl", "verify", "-CAfile", $small_chain, | ||
"-policy_check", $small_leaf])), | ||
"test small policy tree"); | ||
|
||
# The large pathological tree is expected to fail | ||
my $large_chain = srctop_file("test", "recipes", "80-test_policy_tree_data", | ||
"large_policy_tree.pem"); | ||
my $large_leaf = srctop_file("test", "recipes", "80-test_policy_tree_data", | ||
"large_leaf.pem"); | ||
|
||
ok(!run(app(["openssl", "verify", "-CAfile", $large_chain, | ||
"-policy_check", $large_leaf])), | ||
"test large policy tree"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIBmTCCAT+gAwIBAgIBADAKBggqhkjOPQQDAjAWMRQwEgYDVQQDEwtQb2xpY3kg | ||
Q0EgMTAgFw0wMDAxMDEwMDAwMDBaGA8yMTAwMDEwMTAwMDAwMFowGjEYMBYGA1UE | ||
AxMPd3d3LmV4YW1wbGUuY29tMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEp6Qe | ||
jrN6A0ZjqaFbX/zO01aVYXH5kthBDTEO/fU4H0CdwqrfyMsFrObwssrTJcsmSFKP | ||
x1FYr8wT2wCACs19lqN4MHYwDgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsG | ||
AQUFBwMBMAwGA1UdEwEB/wQCMAAwGgYDVR0RBBMwEYIPd3d3LmV4YW1wbGUuY29t | ||
MCUGA1UdIAQeMBwwDAYKYIZIAWUDAgEwATAMBgpghkgBZQMCATACMAoGCCqGSM49 | ||
BAMCA0gAMEUCIDGT8SVBkWJEZ2EzXm8M895NrNRmfc8uoheP0KKv+ndHAiEA2Onr | ||
20J+zTaR7vONY/1DleMm7fGY3UxTobSHSvOKbfY= | ||
-----END CERTIFICATE----- |
Oops, something went wrong.