aboutsummaryrefslogtreecommitdiffstats
path: root/test/recipes/30-test_pairwise_fail.t
blob: a101a26fb184ba4c2d290cbe18bdc7c768c1371a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#! /usr/bin/env perl
# Copyright 2023-2024 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 OpenSSL::Test qw(:DEFAULT bldtop_dir srctop_file srctop_dir data_file);
use OpenSSL::Test::Utils;

BEGIN {
setup("test_pairwise_fail");
}

use lib srctop_dir('Configurations');
use lib bldtop_dir('.');

plan skip_all => "These tests are unsupported in a non fips build"
    if disabled("fips");

plan tests => 6;
my $provconf = srctop_file("test", "fips-and-base.cnf");

run(test(["fips_version_test", "-config", $provconf, ">=3.1.0"]),
    capture => 1, statusvar => \my $fips_exit);

SKIP: {
    skip "Skip RSA test because of no rsa in this build", 1
        if disabled("rsa");
    ok(run(test(["pairwise_fail_test", "-config", $provconf,
                 "-pairwise", "rsa"])),
       "fips provider rsa keygen pairwise failure test");
}

SKIP: {
    skip "Skip EC test because of no ec in this build", 2
        if disabled("ec");
    ok(run(test(["pairwise_fail_test", "-config", $provconf,
                 "-pairwise", "ec"])),
       "fips provider ec keygen pairwise failure test");

    skip "FIPS provider version is too old", 1
        if !$fips_exit;
    ok(run(test(["pairwise_fail_test", "-config", $provconf,
                 "-pairwise", "eckat"])),
       "fips provider ec keygen kat failure test");
}

SKIP: {
    skip "Skip DSA tests because of no dsa in this build", 2
        if disabled("dsa");
    ok(run(test(["pairwise_fail_test", "-config", $provconf,
                 "-pairwise", "dsa", "-dsaparam", data_file("dsaparam.pem")])),
       "fips provider dsa keygen pairwise failure test");

    skip "FIPS provider version is too old", 1
        if !$fips_exit;
    ok(run(test(["pairwise_fail_test", "-config", $provconf,
                 "-pairwise", "dsakat", "-dsaparam", data_file("dsaparam.pem")])),
       "fips provider dsa keygen kat failure test");
}

SKIP: {
    skip "Skip EDDSA test because of no ecx in this build", 1
        if disabled("ecx");

    run(test(["fips_version_test", "-config", $provconf, ">=3.3.0"]),
             capture => 1, statusvar => \my $exit);
    skip "FIPS provider version is too old", 1
        if !$exit;

    ok(run(test(["pairwise_fail_test", "-config", $provconf,
                 "-pairwise", "eddsa"])),
       "fips provider eddsa keygen pairwise failure test");
}