blob: 5da95b3a9e707982463318db47ee858d6a6e7dda [file] [log] [blame]
djm@openbsd.orgdd369322017-04-30 23:34:55 +00001# $OpenBSD: cipher-speed.sh,v 1.14 2017/04/30 23:34:55 djm Exp $
Damien Miller7b1877c2006-07-24 15:31:41 +10002# Placed in the Public Domain.
3
4tid="cipher speed"
5
6getbytes ()
7{
Darren Tuckerfe10a282013-03-12 11:19:40 +11008 sed -n -e '/transferred/s/.*secs (\(.* bytes.sec\).*/\1/p' \
9 -e '/copied/s/.*s, \(.* MB.s\).*/\1/p'
Damien Miller7b1877c2006-07-24 15:31:41 +100010}
11
12tries="1 2"
Damien Miller7b1877c2006-07-24 15:31:41 +100013
Darren Tuckera9550412013-11-07 15:21:19 +110014for c in `${SSH} -Q cipher`; do n=0; for m in `${SSH} -Q mac`; do
djm@openbsd.orgdd369322017-04-30 23:34:55 +000015 trace "cipher $c mac $m"
Damien Miller7b1877c2006-07-24 15:31:41 +100016 for x in $tries; do
Darren Tuckerfe10a282013-03-12 11:19:40 +110017 printf "%-60s" "$c/$m:"
Damien Miller7b1877c2006-07-24 15:31:41 +100018 ( ${SSH} -o 'compression no' \
djm@openbsd.orgdd369322017-04-30 23:34:55 +000019 -F $OBJ/ssh_proxy -m $m -c $c somehost \
Damien Miller7b1877c2006-07-24 15:31:41 +100020 exec sh -c \'"dd of=/dev/null obs=32k"\' \
21 < ${DATA} ) 2>&1 | getbytes
22
23 if [ $? -ne 0 ]; then
djm@openbsd.orgdd369322017-04-30 23:34:55 +000024 fail "ssh failed with mac $m cipher $c"
Damien Miller7b1877c2006-07-24 15:31:41 +100025 fi
26 done
Damien Miller8a073cf2013-11-21 14:26:18 +110027 # No point trying all MACs for AEAD ciphers since they are ignored.
markus@openbsd.org9e1777a2015-03-24 20:19:15 +000028 if ${SSH} -Q cipher-auth | grep "^${c}\$" >/dev/null 2>&1 ; then
Damien Miller8a073cf2013-11-21 14:26:18 +110029 break
30 fi
Tim Ricec08b3ef2013-02-19 11:53:29 -080031 n=`expr $n + 1`
Damien Miller7b1877c2006-07-24 15:31:41 +100032done; done