]>
Commit | Line | Data |
---|---|---|
5a23d78c | 1 | #! /usr/bin/env perl |
da1c088f | 2 | # Copyright 2020-2023 The OpenSSL Project Authors. All Rights Reserved. |
5a23d78c RL |
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 | ||
9 | use strict; | |
10 | use warnings; | |
11 | ||
169eca60 JS |
12 | use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file bldtop_dir bldtop_file/; |
13 | use OpenSSL::Test::Utils; | |
5a23d78c | 14 | |
169eca60 JS |
15 | BEGIN { |
16 | setup("test_encoder_decoder"); | |
17 | } | |
a7922e20 | 18 | |
169eca60 JS |
19 | use lib srctop_dir('Configurations'); |
20 | use lib bldtop_dir('.'); | |
21 | use platform; | |
a7922e20 | 22 | |
169eca60 | 23 | my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0); |
a7922e20 | 24 | |
91f2b15f DDO |
25 | my $rsa_key = srctop_file("test", "certs", "ee-key.pem"); |
26 | my $pss_key = srctop_file("test", "certs", "ca-pss-key.pem"); | |
27 | ||
39ed7636 | 28 | plan tests => ($no_fips ? 0 : 3) + 2; # FIPS install test + test |
169eca60 JS |
29 | |
30 | my $conf = srctop_file("test", "default.cnf"); | |
31 | ok(run(test(["endecode_test", "-rsa", $rsa_key, | |
32 | "-pss", $pss_key, | |
33 | "-config", $conf, | |
34 | "-provider", "default"]))); | |
35 | ||
36 | # Run with non-default library context | |
37 | ok(run(test(["endecode_test", "-rsa", $rsa_key, | |
38 | "-pss", $pss_key, | |
39 | "-context", | |
40 | "-config", $conf, | |
41 | "-provider", "default"]))); | |
42 | ||
43 | unless ($no_fips) { | |
44 | # Run with fips library context | |
45 | my $conf = srctop_file("test", "fips-and-base.cnf"); | |
46 | ok(run(test(["endecode_test", "-rsa", $rsa_key, | |
47 | "-pss", $pss_key, | |
48 | "-config", $conf, | |
49 | "-provider", "fips"]))); | |
169eca60 | 50 | |
39ed7636 | 51 | my $no_des = disabled("des"); |
52 | SKIP: { | |
75ac8f04 TM |
53 | skip "MD5 disabled", 2 if disabled("md5"); |
54 | ok(run(app([ 'openssl', 'genrsa', '-aes128', '-out', 'epki.pem', | |
55 | '-traditional', '-passout', 'pass:pass' ])), | |
56 | "rsa encrypted using a non fips algorithm MD5 in pbe"); | |
39ed7636 | 57 | |
58 | my $conf2 = srctop_file("test", "default-and-fips.cnf"); | |
59 | ok(run(test(['decoder_propq_test', '-config', $conf2, | |
60 | '-provider', 'fips', 'epki.pem']))); | |
61 | } | |
62 | } |