1#!/bin/sh
2
3# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4#
5# SPDX-License-Identifier: MPL-2.0
6#
7# This Source Code Form is subject to the terms of the Mozilla Public
8# License, v. 2.0.  If a copy of the MPL was not distributed with this
9# file, you can obtain one at https://mozilla.org/MPL/2.0/.
10#
11# See the COPYRIGHT file distributed with this work for additional
12# information regarding copyright ownership.
13
14SYSTEMTESTTOP=${SYSTEMTESTTOP:=..}
15. $SYSTEMTESTTOP/conf.sh
16
17prog=$0
18
19args=""
20alg="-a $DEFAULT_ALGORITHM -b $DEFAULT_BITS"
21quiet=0
22
23msg="cryptography"
24while test "$#" -gt 0; do
25        case $1 in
26        -q)
27                args="$args -q"
28                quiet=1
29                ;;
30        rsa|RSA)
31                alg="-a RSASHA1"
32                msg="RSA cryptography"
33                ;;
34	rsasha256|RSASHA256)
35                alg="-a RSASHA256"
36                msg="RSA cryptography"
37                ;;
38	rsasha512|RSASHA512)
39                alg="-a RSASHA512"
40                msg="RSA cryptography"
41                ;;
42        ecdsa|ECDSA|ecdsap256sha256|ECDSAP256SHA256)
43                alg="-a ECDSAP256SHA256"
44                msg="ECDSA cryptography"
45                ;;
46        ecdsap384sha384|ECDSAP384SHA384)
47                alg="-a ECDSAP384SHA384"
48                msg="ECDSA cryptography"
49                ;;
50        eddsa|EDDSA|ed25519|ED25519)
51                alg="-a ED25519"
52                msg="EDDSA cryptography"
53                ;;
54        ed448|ED448)
55                alg="-a ED448"
56                msg="EDDSA cryptography"
57                ;;
58        *)
59                echo "${prog}: unknown argument"
60                exit 1
61                ;;
62        esac
63        shift
64done
65
66if $KEYGEN $args $alg foo > /dev/null 2>&1
67then
68    rm -f Kfoo*
69else
70    if test $quiet -eq 0; then
71        echo_i "This test requires support for $msg" >&2
72        echo_i "configure with --with-openssl, or --enable-native-pkcs11" \
73            "--with-pkcs11" >&2
74    fi
75    exit 255
76fi
77