blob: a6d53a78d11fe5b253bdf9ba2ca883491639a518 [file] [log] [blame]
Damien Miller8a073cf2013-11-21 14:26:18 +11001# $OpenBSD: cipher-speed.sh,v 1.11 2013/11/21 03:18:51 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
Damien Miller7b1877c2006-07-24 15:31:41 +100015 trace "proto 2 cipher $c mac $m"
16 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' \
19 -F $OBJ/ssh_proxy -2 -m $m -c $c somehost \
20 exec sh -c \'"dd of=/dev/null obs=32k"\' \
21 < ${DATA} ) 2>&1 | getbytes
22
23 if [ $? -ne 0 ]; then
24 fail "ssh -2 failed with mac $m cipher $c"
25 fi
26 done
Damien Miller8a073cf2013-11-21 14:26:18 +110027 # No point trying all MACs for AEAD ciphers since they are ignored.
28 if ssh -Q cipher-auth | grep "^${c}\$" >/dev/null 2>&1 ; then
29 break
30 fi
Tim Ricec08b3ef2013-02-19 11:53:29 -080031 n=`expr $n + 1`
Damien Miller7b1877c2006-07-24 15:31:41 +100032done; done
33
34ciphers="3des blowfish"
35for c in $ciphers; do
36 trace "proto 1 cipher $c"
37 for x in $tries; do
Darren Tuckerfe10a282013-03-12 11:19:40 +110038 printf "%-60s" "$c:"
Damien Miller7b1877c2006-07-24 15:31:41 +100039 ( ${SSH} -o 'compression no' \
40 -F $OBJ/ssh_proxy -1 -c $c somehost \
41 exec sh -c \'"dd of=/dev/null obs=32k"\' \
42 < ${DATA} ) 2>&1 | getbytes
43 if [ $? -ne 0 ]; then
44 fail "ssh -1 failed with cipher $c"
45 fi
46 done
47done