xref: /netbsd-src/external/mpl/bind/dist/bin/tests/system/ecdsa/tests.sh (revision dd3ee07da436799d8de85f3055253118b76bf345)
1#!/bin/sh
2#
3# Copyright (C) Internet Systems Consortium, Inc. ("ISC")
4#
5# This Source Code Form is subject to the terms of the Mozilla Public
6# License, v. 2.0. If a copy of the MPL was not distributed with this
7# file, you can obtain one at https://mozilla.org/MPL/2.0/.
8#
9# See the COPYRIGHT file distributed with this work for additional
10# information regarding copyright ownership.
11
12SYSTEMTESTTOP=..
13. $SYSTEMTESTTOP/conf.sh
14
15status=0
16n=0
17
18dig_with_opts() {
19    "$DIG" +tcp +noau +noadd +nosea +nostat +nocmd +dnssec -p "$PORT" "$@"
20}
21
22if [ -f ecdsa256-supported.file ]; then
23	n=$((n+1))
24	echo_i "checking that ECDSA256 positive validation works ($n)"
25	ret=0
26	dig_with_opts . @10.53.0.1 soa > dig.out.ns1.test$n || ret=1
27	dig_with_opts . @10.53.0.2 soa > dig.out.ns2.test$n || ret=1
28	$PERL ../digcomp.pl dig.out.ns1.test$n dig.out.ns2.test$n || ret=1
29	grep "flags:.*ad.*QUERY" dig.out.ns2.test$n > /dev/null || ret=1
30	if [ $ret != 0 ]; then echo_i "failed"; fi
31	status=$((status+ret))
32else
33	echo_i "algorithm ECDSA256 not supported, skipping test"
34fi
35
36if [ -f ecdsa384-supported.file ]; then
37	n=$((n+1))
38	echo_i "checking that ECDSA384 positive validation works ($n)"
39	ret=0
40	dig_with_opts . @10.53.0.1 soa > dig.out.ns1.test$n || ret=1
41	dig_with_opts . @10.53.0.3 soa > dig.out.ns3.test$n || ret=1
42	$PERL ../digcomp.pl dig.out.ns1.test$n dig.out.ns3.test$n || ret=1
43	grep "flags:.*ad.*QUERY" dig.out.ns3.test$n > /dev/null || ret=1
44	if [ $ret != 0 ]; then echo_i "failed"; fi
45	status=$((status+ret))
46else
47	echo_i "algorithm ECDSA384 not supported, skipping test"
48fi
49
50echo_i "exit status: $status"
51[ $status -eq 0 ] || exit 1
52