30-test_pairwise_fail.t 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #! /usr/bin/env perl
  2. # Copyright 2023-2024 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 bldtop_dir srctop_file srctop_dir data_file);
  11. use OpenSSL::Test::Utils;
  12. BEGIN {
  13. setup("test_pairwise_fail");
  14. }
  15. use lib srctop_dir('Configurations');
  16. use lib bldtop_dir('.');
  17. plan skip_all => "These tests are unsupported in a non fips build"
  18. if disabled("fips");
  19. plan tests => 6;
  20. my $provconf = srctop_file("test", "fips-and-base.cnf");
  21. run(test(["fips_version_test", "-config", $provconf, ">=3.1.0"]),
  22. capture => 1, statusvar => \my $fips_exit);
  23. SKIP: {
  24. skip "Skip RSA test because of no rsa in this build", 1
  25. if disabled("rsa");
  26. ok(run(test(["pairwise_fail_test", "-config", $provconf,
  27. "-pairwise", "rsa"])),
  28. "fips provider rsa keygen pairwise failure test");
  29. }
  30. SKIP: {
  31. skip "Skip EC test because of no ec in this build", 2
  32. if disabled("ec");
  33. ok(run(test(["pairwise_fail_test", "-config", $provconf,
  34. "-pairwise", "ec"])),
  35. "fips provider ec keygen pairwise failure test");
  36. skip "FIPS provider version is too old", 1
  37. if !$fips_exit;
  38. ok(run(test(["pairwise_fail_test", "-config", $provconf,
  39. "-pairwise", "eckat"])),
  40. "fips provider ec keygen kat failure test");
  41. }
  42. SKIP: {
  43. skip "Skip DSA tests because of no dsa in this build", 2
  44. if disabled("dsa");
  45. ok(run(test(["pairwise_fail_test", "-config", $provconf,
  46. "-pairwise", "dsa", "-dsaparam", data_file("dsaparam.pem")])),
  47. "fips provider dsa keygen pairwise failure test");
  48. skip "FIPS provider version is too old", 1
  49. if !$fips_exit;
  50. ok(run(test(["pairwise_fail_test", "-config", $provconf,
  51. "-pairwise", "dsakat", "-dsaparam", data_file("dsaparam.pem")])),
  52. "fips provider dsa keygen kat failure test");
  53. }
  54. SKIP: {
  55. skip "Skip EDDSA test because of no ecx in this build", 1
  56. if disabled("ecx");
  57. run(test(["fips_version_test", "-config", $provconf, ">=3.3.0"]),
  58. capture => 1, statusvar => \my $exit);
  59. skip "FIPS provider version is too old", 1
  60. if !$exit;
  61. ok(run(test(["pairwise_fail_test", "-config", $provconf,
  62. "-pairwise", "eddsa"])),
  63. "fips provider eddsa keygen pairwise failure test");
  64. }