diff options
author | Jon Spillett <jon.spillett@oracle.com> | 2021-03-15 14:26:09 +1000 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-06-01 12:16:27 +0200 |
commit | 169eca602c67f37abf0a44e1605998d5e7f04fa6 (patch) | |
tree | 221d3097ca04a1549d0cb93442c1c2d00f954928 /test/recipes/04-test_encoder_decoder.t | |
parent | 8ee66a092c07e618191ef49c8912f8235b08bb95 (diff) |
Enhance the encoder/decoder tests to allow testing with a non-default library context and configurable providers
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14587)
Diffstat (limited to 'test/recipes/04-test_encoder_decoder.t')
-rw-r--r-- | test/recipes/04-test_encoder_decoder.t | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/test/recipes/04-test_encoder_decoder.t b/test/recipes/04-test_encoder_decoder.t index 0152519716..19541610a9 100644 --- a/test/recipes/04-test_encoder_decoder.t +++ b/test/recipes/04-test_encoder_decoder.t @@ -1,5 +1,5 @@ #! /usr/bin/env perl -# Copyright 2020 The OpenSSL Project Authors. All Rights Reserved. +# Copyright 2020-2021 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 @@ -9,18 +9,43 @@ use strict; use warnings; -use OpenSSL::Test::Simple; -use OpenSSL::Test qw/:DEFAULT srctop_file bldtop_dir/; -use Cwd qw(abs_path); +use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file bldtop_dir bldtop_file/; +use OpenSSL::Test::Utils; -setup("test_encoder_decoder"); +BEGIN { + setup("test_encoder_decoder"); +} -plan tests => 1; +use lib srctop_dir('Configurations'); +use lib bldtop_dir('.'); +use platform; -$ENV{OPENSSL_MODULES} = abs_path(bldtop_dir("providers")); -$ENV{OPENSSL_CONF} = abs_path(srctop_file("test", "default-and-legacy.cnf")); +my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0); my $rsa_key = srctop_file("test", "certs", "ee-key.pem"); my $pss_key = srctop_file("test", "certs", "ca-pss-key.pem"); -ok(run(test(["endecode_test", $rsa_key, $pss_key]))); +plan tests => ($no_fips ? 0 : 1) + 2; # FIPS install test + test + +my $conf = srctop_file("test", "default.cnf"); +ok(run(test(["endecode_test", "-rsa", $rsa_key, + "-pss", $pss_key, + "-config", $conf, + "-provider", "default"]))); + +# Run with non-default library context +ok(run(test(["endecode_test", "-rsa", $rsa_key, + "-pss", $pss_key, + "-context", + "-config", $conf, + "-provider", "default"]))); + +unless ($no_fips) { + # Run with fips library context + my $conf = srctop_file("test", "fips-and-base.cnf"); + ok(run(test(["endecode_test", "-rsa", $rsa_key, + "-pss", $pss_key, + "-config", $conf, + "-provider", "fips"]))); +} + |