1 # $OpenBSD: cipher-speed.sh,v 1.4 2011/08/02 01:23:41 djm Exp $ 2 # Placed in the Public Domain. 3 4 tid="cipher speed" 5 6 getbytes () 7 { 8 sed -n '/transferred/s/.*secs (\(.* bytes.sec\).*/\1/p' 9 } 10 11 tries="1 2" 12 DATA=/bin/ls 13 DATA=/bsd 14 15 ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc 16 arcfour128 arcfour256 arcfour 17 aes192-cbc aes256-cbc rijndael-cbc (at] lysator.liu.se 18 aes128-ctr aes192-ctr aes256-ctr" 19 macs="hmac-sha1 hmac-md5 umac-64 (at] openssh.com hmac-sha1-96 hmac-md5-96" 20 config_defined HAVE_EVP_SHA256 && 21 macs="$macs hmac-sha2-256 hmac-sha2-256-96 hmac-sha2-512 hmac-sha2-512-96" 22 23 for c in $ciphers; do for m in $macs; do 24 trace "proto 2 cipher $c mac $m" 25 for x in $tries; do 26 echon "$c/$m:\t" 27 ( ${SSH} -o 'compression no' \ 28 -F $OBJ/ssh_proxy -2 -m $m -c $c somehost \ 29 exec sh -c \'"dd of=/dev/null obs=32k"\' \ 30 < ${DATA} ) 2>&1 | getbytes 31 32 if [ $? -ne 0 ]; then 33 fail "ssh -2 failed with mac $m cipher $c" 34 fi 35 done 36 done; done 37 38 ciphers="3des blowfish" 39 for c in $ciphers; do 40 trace "proto 1 cipher $c" 41 for x in $tries; do 42 echon "$c:\t" 43 ( ${SSH} -o 'compression no' \ 44 -F $OBJ/ssh_proxy -1 -c $c somehost \ 45 exec sh -c \'"dd of=/dev/null obs=32k"\' \ 46 < ${DATA} ) 2>&1 | getbytes 47 if [ $? -ne 0 ]; then 48 fail "ssh -1 failed with cipher $c" 49 fi 50 done 51 done 52