Home | History | Annotate | Line # | Download | only in recipes
      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 
      9 use strict;
     10 use warnings;
     11 
     12 use OpenSSL::Test qw(:DEFAULT srctop_dir bldtop_dir srctop_file);
     13 use OpenSSL::Test::Utils;
     14 
     15 BEGIN {
     16     setup("test_slh_dsa");
     17 }
     18 
     19 my $provconf = srctop_file("test", "fips-and-base.cnf");
     20 my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
     21 
     22 use lib srctop_dir('Configurations');
     23 use lib bldtop_dir('.');
     24 
     25 plan skip_all => 'SLH-DSA is not supported in this build' if disabled('slh-dsa');
     26 plan tests => 2;
     27 
     28 ok(run(test(["slh_dsa_test"])), "running slh_dsa_test");
     29 
     30 SKIP: {
     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