blob: e04268ba35bf652e26c7ac1dcad5f9de9f60e7b6 [file] [log] [blame]
djm@openbsd.orgdd369322017-04-30 23:34:55 +00001# $OpenBSD: try-ciphers.sh,v 1.26 2017/04/30 23:34:55 djm Exp $
Damien Miller38cd4352002-05-01 13:17:33 +10002# Placed in the Public Domain.
3
4tid="try ciphers"
5
Damien Milleredb1af52014-05-15 15:07:53 +10006cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
7
Darren Tuckera9550412013-11-07 15:21:19 +11008for c in `${SSH} -Q cipher`; do
Damien Miller846dc7f2013-01-12 22:46:26 +11009 n=0
Darren Tuckera9550412013-11-07 15:21:19 +110010 for m in `${SSH} -Q mac`; do
djm@openbsd.orgdd369322017-04-30 23:34:55 +000011 trace "cipher $c mac $m"
12 verbose "test $tid: cipher $c mac $m"
Damien Milleredb1af52014-05-15 15:07:53 +100013 cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
14 echo "Ciphers=$c" >> $OBJ/sshd_proxy
15 echo "MACs=$m" >> $OBJ/sshd_proxy
djm@openbsd.orgdd369322017-04-30 23:34:55 +000016 ${SSH} -F $OBJ/ssh_proxy -m $m -c $c somehost true
Damien Miller38cd4352002-05-01 13:17:33 +100017 if [ $? -ne 0 ]; then
djm@openbsd.orgdd369322017-04-30 23:34:55 +000018 fail "ssh failed with mac $m cipher $c"
Damien Miller38cd4352002-05-01 13:17:33 +100019 fi
Damien Miller8a073cf2013-11-21 14:26:18 +110020 # No point trying all MACs for AEAD ciphers since they
21 # are ignored.
markus@openbsd.org9e1777a2015-03-24 20:19:15 +000022 if ${SSH} -Q cipher-auth | grep "^${c}\$" >/dev/null 2>&1 ; then
Damien Miller8a073cf2013-11-21 14:26:18 +110023 break
24 fi
Tim Ricec08b3ef2013-02-19 11:53:29 -080025 n=`expr $n + 1`
Damien Miller38cd4352002-05-01 13:17:33 +100026 done
27done
28