1# $OpenBSD: cipher-speed.sh,v 1.11 2013/11/21 03:18:51 djm Exp $ 2# Placed in the Public Domain. 3 4tid="cipher speed" 5 6getbytes () 7{ 8 sed -n '/transferred/s/.*secs (\(.* bytes.sec\).*/\1/p' 9} 10 11tries="1 2" 12 13for c in `${SSH} -Q cipher`; do n=0; for m in `${SSH} -Q mac`; do 14 trace "proto 2 cipher $c mac $m" 15 for x in $tries; do 16 printf "$c/$m:\t" 17 ( ${SSH} -o 'compression no' \ 18 -F $OBJ/ssh_proxy -2 -m $m -c $c somehost \ 19 exec sh -c \'"dd of=/dev/null obs=32k"\' \ 20 < ${DATA} ) 2>&1 | getbytes 21 22 if [ $? -ne 0 ]; then 23 fail "ssh -2 failed with mac $m cipher $c" 24 fi 25 done 26 # No point trying all MACs for AEAD ciphers since they are ignored. 27 if ssh -Q cipher-auth | grep "^${c}\$" >/dev/null 2>&1 ; then 28 break 29 fi 30 n=$(($n + 1)) 31done; done 32 33ciphers="3des blowfish" 34for c in $ciphers; do 35 trace "proto 1 cipher $c" 36 for x in $tries; do 37 printf "$c:\t" 38 ( ${SSH} -o 'compression no' \ 39 -F $OBJ/ssh_proxy -1 -c $c somehost \ 40 exec sh -c \'"dd of=/dev/null obs=32k"\' \ 41 < ${DATA} ) 2>&1 | getbytes 42 if [ $? -ne 0 ]; then 43 fail "ssh -1 failed with cipher $c" 44 fi 45 done 46done 47