xref: /freebsd/crypto/openssh/regress/dropbear-ciphers.sh (revision 0fdf8fae8b569bf9fff3b5171e669dcd7cf9c79e)
1*0fdf8faeSEd Maste#	$OpenBSD: dropbear-ciphers.sh,v 1.3 2024/06/20 08:23:18 dtucker Exp $
2069ac184SEd Maste#	Placed in the Public Domain.
3069ac184SEd Maste
4069ac184SEd Mastetid="dropbear ciphers"
5069ac184SEd Maste
6069ac184SEd Masteif test "x$REGRESS_INTEROP_DROPBEAR" != "xyes" ; then
7069ac184SEd Maste	skip "dropbear interop tests not enabled"
8069ac184SEd Mastefi
9069ac184SEd Maste
10*0fdf8faeSEd Maste# Enable all support algorithms
11*0fdf8faeSEd Mastealgs=`$SSH -Q key-sig | tr '\n' ,`
12069ac184SEd Mastecat >>$OBJ/sshd_proxy <<EOD
13*0fdf8faeSEd MastePubkeyAcceptedAlgorithms $algs
14*0fdf8faeSEd MasteHostkeyAlgorithms $algs
15069ac184SEd MasteEOD
16069ac184SEd Maste
17*0fdf8faeSEd Masteciphers=`$DBCLIENT -c help hst 2>&1 | awk '/ ciphers: /{print $4}' | tr ',' ' '`
18*0fdf8faeSEd Mastemacs=`$DBCLIENT -m help hst 2>&1 | awk '/ MACs: /{print $4}' | tr ',' ' '`
19*0fdf8faeSEd Masteif [ -z "$macs" ] || [ -z "$ciphers" ]; then
20*0fdf8faeSEd Maste	skip "dbclient query ciphers '$ciphers' or macs '$macs' failed"
21*0fdf8faeSEd Mastefi
22069ac184SEd Mastekeytype=`(cd $OBJ/.dropbear && ls id_*)`
23069ac184SEd Maste
24069ac184SEd Mastefor c in $ciphers ; do
25069ac184SEd Maste  for m in $macs; do
26069ac184SEd Maste    for kt in $keytype; do
27069ac184SEd Maste	verbose "$tid: cipher $c mac $m kt $kt"
28069ac184SEd Maste	rm -f ${COPY}
29069ac184SEd Maste	env HOME=$OBJ dbclient -y -i $OBJ/.dropbear/$kt 2>$OBJ/dbclient.log \
30069ac184SEd Maste	    -c $c -m $m -J "$OBJ/ssh_proxy.sh" somehost cat ${DATA} > ${COPY}
31069ac184SEd Maste	if [ $? -ne 0 ]; then
32069ac184SEd Maste		fail "ssh cat $DATA failed"
33069ac184SEd Maste	fi
34069ac184SEd Maste	cmp ${DATA} ${COPY}		|| fail "corrupted copy"
35069ac184SEd Maste    done
36069ac184SEd Maste  done
37069ac184SEd Mastedone
38069ac184SEd Masterm -f ${COPY}
39