2
0

04-test_encoder_decoder.t 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #! /usr/bin/env perl
  2. # Copyright 2020-2021 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. use strict;
  9. use warnings;
  10. use OpenSSL::Test qw/:DEFAULT srctop_dir srctop_file bldtop_dir bldtop_file/;
  11. use OpenSSL::Test::Utils;
  12. BEGIN {
  13. setup("test_encoder_decoder");
  14. }
  15. use lib srctop_dir('Configurations');
  16. use lib bldtop_dir('.');
  17. use platform;
  18. my $no_fips = disabled('fips') || ($ENV{NO_FIPS} // 0);
  19. my $rsa_key = srctop_file("test", "certs", "ee-key.pem");
  20. my $pss_key = srctop_file("test", "certs", "ca-pss-key.pem");
  21. plan tests => ($no_fips ? 0 : 1) + 2; # FIPS install test + test
  22. my $conf = srctop_file("test", "default.cnf");
  23. ok(run(test(["endecode_test", "-rsa", $rsa_key,
  24. "-pss", $pss_key,
  25. "-config", $conf,
  26. "-provider", "default"])));
  27. # Run with non-default library context
  28. ok(run(test(["endecode_test", "-rsa", $rsa_key,
  29. "-pss", $pss_key,
  30. "-context",
  31. "-config", $conf,
  32. "-provider", "default"])));
  33. unless ($no_fips) {
  34. # Run with fips library context
  35. my $conf = srctop_file("test", "fips-and-base.cnf");
  36. ok(run(test(["endecode_test", "-rsa", $rsa_key,
  37. "-pss", $pss_key,
  38. "-config", $conf,
  39. "-provider", "fips"])));
  40. }