cipher-speed.sh revision 295367
1157016Sdes# $OpenBSD: cipher-speed.sh,v 1.13 2015/03/24 20:22:17 markus Exp $ 2157016Sdes# Placed in the Public Domain. 3157016Sdes 4157016Sdestid="cipher speed" 5157016Sdes 6157016Sdesgetbytes () 7157016Sdes{ 8157016Sdes sed -n -e '/transferred/s/.*secs (\(.* bytes.sec\).*/\1/p' \ 9157016Sdes -e '/copied/s/.*s, \(.* MB.s\).*/\1/p' 10157016Sdes} 11157016Sdes 12157016Sdestries="1 2" 13157016Sdes 14157016Sdesfor c in `${SSH} -Q cipher`; do n=0; for m in `${SSH} -Q mac`; do 15157016Sdes trace "proto 2 cipher $c mac $m" 16157016Sdes for x in $tries; do 17157016Sdes printf "%-60s" "$c/$m:" 18157016Sdes ( ${SSH} -o 'compression no' \ 19157016Sdes -F $OBJ/ssh_proxy -2 -m $m -c $c somehost \ 20157016Sdes exec sh -c \'"dd of=/dev/null obs=32k"\' \ 21157016Sdes < ${DATA} ) 2>&1 | getbytes 22157016Sdes 23157016Sdes if [ $? -ne 0 ]; then 24157016Sdes fail "ssh -2 failed with mac $m cipher $c" 25157016Sdes fi 26157016Sdes done 27157016Sdes # No point trying all MACs for AEAD ciphers since they are ignored. 28157016Sdes if ${SSH} -Q cipher-auth | grep "^${c}\$" >/dev/null 2>&1 ; then 29157016Sdes break 30157016Sdes fi 31157016Sdes n=`expr $n + 1` 32157016Sdesdone; done 33157016Sdes 34if ssh_version 1; then 35 ciphers="3des blowfish" 36else 37 ciphers="" 38fi 39for c in $ciphers; do 40 trace "proto 1 cipher $c" 41 for x in $tries; do 42 printf "%-60s" "$c:" 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 51done 52