1#	$OpenBSD: dropbear-ciphers.sh,v 1.3 2024/06/20 08:23:18 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="dropbear ciphers"
5
6if test "x$REGRESS_INTEROP_DROPBEAR" != "xyes" ; then
7	skip "dropbear interop tests not enabled"
8fi
9
10# Enable all support algorithms
11algs=`$SSH -Q key-sig | tr '\n' ,`
12cat >>$OBJ/sshd_proxy <<EOD
13PubkeyAcceptedAlgorithms $algs
14HostkeyAlgorithms $algs
15EOD
16
17ciphers=`$DBCLIENT -c help hst 2>&1 | awk '/ ciphers: /{print $4}' | tr ',' ' '`
18macs=`$DBCLIENT -m help hst 2>&1 | awk '/ MACs: /{print $4}' | tr ',' ' '`
19if [ -z "$macs" ] || [ -z "$ciphers" ]; then
20	skip "dbclient query ciphers '$ciphers' or macs '$macs' failed"
21fi
22keytype=`(cd $OBJ/.dropbear && ls id_*)`
23
24for c in $ciphers ; do
25  for m in $macs; do
26    for kt in $keytype; do
27	verbose "$tid: cipher $c mac $m kt $kt"
28	rm -f ${COPY}
29	env HOME=$OBJ dbclient -y -i $OBJ/.dropbear/$kt 2>$OBJ/dbclient.log \
30	    -c $c -m $m -J "$OBJ/ssh_proxy.sh" somehost cat ${DATA} > ${COPY}
31	if [ $? -ne 0 ]; then
32		fail "ssh cat $DATA failed"
33	fi
34	cmp ${DATA} ${COPY}		|| fail "corrupted copy"
35    done
36  done
37done
38rm -f ${COPY}
39