xref: /freebsd/crypto/openssl/test/recipes/30-test_slh_dsa.t (revision e7be843b4a162e68651d3911f0357ed464915629)
1#! /usr/bin/env perl
2# Copyright 2024-2025 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
9use strict;
10use warnings;
11
12use OpenSSL::Test qw(:DEFAULT srctop_dir bldtop_dir srctop_file);
13use OpenSSL::Test::Utils;
14
15BEGIN {
16    setup("test_slh_dsa");
17}
18
19my $provconf = srctop_file("test", "fips-and-base.cnf");
20my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
21
22use lib srctop_dir('Configurations');
23use lib bldtop_dir('.');
24
25plan skip_all => 'SLH-DSA is not supported in this build' if disabled('slh-dsa');
26plan tests => 2;
27
28ok(run(test(["slh_dsa_test"])), "running slh_dsa_test");
29
30SKIP: {
31    skip "Skipping FIPS tests", 1
32        if $no_fips;
33
34    # SLH-DSA is only present after OpenSSL 3.5
35    run(test(["fips_version_test", "-config", $provconf, ">=3.5.0"]),
36             capture => 1, statusvar => \my $exit);
37    skip "FIPS provider version is too old for SLH_DSA test", 1
38        if !$exit;
39
40    ok(run(test(["slh_dsa_test", "-config",  $provconf])),
41           "running slh_dsa_test with FIPS");
42}
43