xref: /freebsd/crypto/openssl/test/recipes/06-test_algorithmid.t (revision a8089ea5aee578e08acab2438e82fc9a9ae50ed8)
1#! /usr/bin/env perl
2
3# Copyright 2018-2021 The OpenSSL Project Authors. All Rights Reserved.
4#
5# Licensed under the Apache License 2.0 (the "License").  You may not use
6# this file except in compliance with the License.  You can obtain a copy
7# in the file LICENSE in the source distribution or at
8# https://www.openssl.org/source/license.html
9
10use strict;
11
12use OpenSSL::Test qw(:DEFAULT srctop_file);
13use OpenSSL::Test::Utils;
14
15setup("test_algorithmid");
16
17# eecert => cacert
18my %certs_info =
19    (
20     'ee-cert' => 'ca-cert',
21     'ee-cert2' => 'ca-cert2',
22
23     # 'ee-pss-sha1-cert' => 'ca-cert',
24     # 'ee-pss-sha256-cert' => 'ca-cert',
25     # 'ee-pss-cert' => 'ca-pss-cert',
26     # 'server-pss-restrict-cert' => 'rootcert',
27
28     (
29      disabled('ec')
30      ? ()
31      : (
32         'ee-cert-ec-explicit' => 'ca-cert-ec-named',
33         'ee-cert-ec-named-explicit' => 'ca-cert-ec-explicit',
34         'ee-cert-ec-named-named' => 'ca-cert-ec-named',
35         # 'server-ed448-cert' => 'root-ed448-cert'
36         'server-ecdsa-brainpoolP256r1-cert' => 'rootcert',
37        )
38     )
39    );
40my @pubkeys =
41    (
42     'testrsapub',
43     disabled('dsa') ? () : 'testdsapub',
44     disabled('ec') ? () : qw(testecpub-p256 tested25519pub tested448pub)
45    );
46my @certs = sort keys %certs_info;
47
48plan tests =>
49    scalar @certs
50    + scalar @pubkeys;
51
52foreach (@certs) {
53    ok(run(test(['algorithmid_test', '-x509',
54                 srctop_file('test', 'certs', "$_.pem"),
55                 srctop_file('test', 'certs', "$certs_info{$_}.pem")])));
56}
57
58foreach (sort @pubkeys) {
59    ok(run(test(['algorithmid_test', '-spki', srctop_file('test', "$_.pem")])));
60}
61