15-test_ecparam.t 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #! /usr/bin/env perl
  2. # Copyright 2017-2020 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 File::Spec;
  11. use OpenSSL::Glob;
  12. use OpenSSL::Test qw/:DEFAULT data_file/;
  13. use OpenSSL::Test::Utils;
  14. setup("test_ecparam");
  15. plan skip_all => "EC isn't supported in this build"
  16. if disabled("ec") || disabled("ec2m");
  17. my @valid = glob(data_file("valid", "*.pem"));
  18. my @invalid = glob(data_file("invalid", "*.pem"));
  19. my $num_tests = scalar @valid + scalar @invalid;
  20. plan tests => 3 * $num_tests;
  21. SKIP: {
  22. skip "Skipping EC tests", 2 * $num_tests
  23. if disabled('deprecated-3.0');
  24. foreach (@valid) {
  25. ok(run(app([qw{openssl ecparam -noout -check -in}, $_])));
  26. }
  27. foreach (@valid) {
  28. ok(run(app([qw{openssl ecparam -noout -check_named -in}, $_])));
  29. }
  30. foreach (@invalid) {
  31. ok(!run(app([qw{openssl ecparam -noout -check -in}, $_])));
  32. }
  33. foreach (@invalid) {
  34. ok(!run(app([qw{openssl ecparam -noout -check_named -in}, $_])));
  35. }
  36. }
  37. foreach (@valid) {
  38. ok(run(app([qw{openssl pkeyparam -noout -check -in}, $_])));
  39. }
  40. foreach (@invalid) {
  41. ok(!run(app([qw{openssl pkeyparam -noout -check -in}, $_])));
  42. }