xref: /netbsd-src/crypto/external/bsd/openssl.old/dist/test/recipes/15-test_ecparam.t (revision 4724848cf0da353df257f730694b7882798e5daf)
1*4724848cSchristos#! /usr/bin/env perl
2*4724848cSchristos# Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
3*4724848cSchristos#
4*4724848cSchristos# Licensed under the OpenSSL license (the "License").  You may not use
5*4724848cSchristos# this file except in compliance with the License.  You can obtain a copy
6*4724848cSchristos# in the file LICENSE in the source distribution or at
7*4724848cSchristos# https://www.openssl.org/source/license.html
8*4724848cSchristos
9*4724848cSchristos
10*4724848cSchristosuse strict;
11*4724848cSchristosuse warnings;
12*4724848cSchristos
13*4724848cSchristosuse File::Spec;
14*4724848cSchristosuse OpenSSL::Glob;
15*4724848cSchristosuse OpenSSL::Test qw/:DEFAULT data_file/;
16*4724848cSchristosuse OpenSSL::Test::Utils;
17*4724848cSchristos
18*4724848cSchristossetup("test_ecparam");
19*4724848cSchristos
20*4724848cSchristosplan skip_all => "EC isn't supported in this build"
21*4724848cSchristos    if disabled("ec") || disabled("ec2m");
22*4724848cSchristos
23*4724848cSchristosmy @valid = glob(data_file("valid", "*.pem"));
24*4724848cSchristosmy @invalid = glob(data_file("invalid", "*.pem"));
25*4724848cSchristos
26*4724848cSchristosplan tests => scalar @valid + scalar @invalid;
27*4724848cSchristos
28*4724848cSchristosforeach (@valid) {
29*4724848cSchristos    ok(run(app([qw{openssl ecparam -noout -check -in}, $_])));
30*4724848cSchristos}
31*4724848cSchristos
32*4724848cSchristosforeach (@invalid) {
33*4724848cSchristos    ok(!run(app([qw{openssl ecparam -noout -check -in}, $_])));
34*4724848cSchristos}
35