xref: /openbsd-src/regress/usr.bin/ssh/cipher-speed.sh (revision 4c1e55dc91edd6e69ccc60ce855900fbc12cf34f)
1#	$OpenBSD: cipher-speed.sh,v 1.5 2012/06/28 05:07:45 dtucker 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"
12DATA=/bin/ls
13DATA=/bsd
14
15ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc
16	arcfour128 arcfour256 arcfour
17	aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se
18	aes128-ctr aes192-ctr aes256-ctr"
19macs="hmac-sha1 hmac-md5 umac-64@openssh.com hmac-sha1-96 hmac-md5-96
20	hmac-sha2-256 hmac-sha2-512"
21
22for c in $ciphers; do for m in $macs; do
23	trace "proto 2 cipher $c mac $m"
24	for x in $tries; do
25		echo -n "$c/$m:\t"
26		( ${SSH} -o 'compression no' \
27			-F $OBJ/ssh_proxy -2 -m $m -c $c somehost \
28			exec sh -c \'"dd of=/dev/null obs=32k"\' \
29		< ${DATA} ) 2>&1 | getbytes
30
31		if [ $? -ne 0 ]; then
32			fail "ssh -2 failed with mac $m cipher $c"
33		fi
34	done
35done; done
36
37ciphers="3des blowfish"
38for c in $ciphers; do
39	trace "proto 1 cipher $c"
40	for x in $tries; do
41		echo -n "$c:\t"
42		( ${SSH} -o 'compression no' \
43			-F $OBJ/ssh_proxy -1 -c $c somehost \
44			exec sh -c \'"dd of=/dev/null obs=32k"\' \
45		< ${DATA} ) 2>&1 | getbytes
46		if [ $? -ne 0 ]; then
47			fail "ssh -1 failed with cipher $c"
48		fi
49	done
50done
51