1#	$OpenBSD: dropbear-ciphers.sh,v 1.1 2023/10/20 06:56:45 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
10cat >>$OBJ/sshd_proxy <<EOD
11PubkeyAcceptedAlgorithms +ssh-rsa,ssh-dss
12HostkeyAlgorithms +ssh-rsa,ssh-dss
13EOD
14
15ciphers=`$DBCLIENT -c help 2>&1 | awk '/ ciphers: /{print $4}' | tr ',' ' '`
16macs=`$DBCLIENT -m help 2>&1 | awk '/ MACs: /{print $4}' | tr ',' ' '`
17keytype=`(cd $OBJ/.dropbear && ls id_*)`
18
19for c in $ciphers ; do
20  for m in $macs; do
21    for kt in $keytype; do
22	verbose "$tid: cipher $c mac $m kt $kt"
23	rm -f ${COPY}
24	env HOME=$OBJ dbclient -y -i $OBJ/.dropbear/$kt 2>$OBJ/dbclient.log \
25	    -c $c -m $m -J "$OBJ/ssh_proxy.sh" somehost cat ${DATA} > ${COPY}
26	if [ $? -ne 0 ]; then
27		fail "ssh cat $DATA failed"
28	fi
29	cmp ${DATA} ${COPY}		|| fail "corrupted copy"
30    done
31  done
32done
33rm -f ${COPY}
34