summaryrefslogtreecommitdiff
path: root/regress/rekey.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/rekey.sh')
-rw-r--r--regress/rekey.sh63
1 files changed, 48 insertions, 15 deletions
diff --git a/regress/rekey.sh b/regress/rekey.sh
index 8eb7efaf9..cf9401ea0 100644
--- a/regress/rekey.sh
+++ b/regress/rekey.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: rekey.sh,v 1.8 2013/05/17 04:29:14 dtucker Exp $ 1# $OpenBSD: rekey.sh,v 1.14 2013/11/21 03:18:51 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="rekey" 4tid="rekey"
@@ -7,34 +7,67 @@ LOG=${TEST_SSH_LOGFILE}
7 7
8rm -f ${LOG} 8rm -f ${LOG}
9 9
10for s in 16 1k 128k 256k; do 10# Test rekeying based on data volume only.
11 verbose "client rekeylimit ${s}" 11# Arguments will be passed to ssh.
12ssh_data_rekeying()
13{
12 rm -f ${COPY} ${LOG} 14 rm -f ${COPY} ${LOG}
13 cat $DATA | \ 15 ${SSH} <${DATA} -oCompression=no $@ -v -F $OBJ/ssh_proxy somehost \
14 ${SSH} -oCompression=no -oRekeyLimit=$s \ 16 "cat > ${COPY}"
15 -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}"
16 if [ $? -ne 0 ]; then 17 if [ $? -ne 0 ]; then
17 fail "ssh failed" 18 fail "ssh failed ($@)"
18 fi 19 fi
19 cmp $DATA ${COPY} || fail "corrupted copy" 20 cmp ${DATA} ${COPY} || fail "corrupted copy ($@)"
20 n=`grep 'NEWKEYS sent' ${LOG} | wc -l` 21 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
21 n=`expr $n - 1` 22 n=`expr $n - 1`
22 trace "$n rekeying(s)" 23 trace "$n rekeying(s)"
23 if [ $n -lt 1 ]; then 24 if [ $n -lt 1 ]; then
24 fail "no rekeying occured" 25 fail "no rekeying occured ($@)"
25 fi 26 fi
27}
28
29increase_datafile_size 300
30
31opts=""
32for i in `${SSH} -Q kex`; do
33 opts="$opts KexAlgorithms=$i"
34done
35for i in `${SSH} -Q cipher`; do
36 opts="$opts Ciphers=$i"
37done
38for i in `${SSH} -Q mac`; do
39 opts="$opts MACs=$i"
40done
41
42for opt in $opts; do
43 verbose "client rekey $opt"
44 ssh_data_rekeying -oRekeyLimit=256k -o$opt
45done
46
47# AEAD ciphers are magical so test with all KexAlgorithms
48if ${SSH} -Q cipher-auth | grep '^.*$' >/dev/null 2>&1 ; then
49 for c in `${SSH} -Q cipher-auth`; do
50 for kex in `${SSH} -Q kex`; do
51 verbose "client rekey $c $kex"
52 ssh_data_rekeying -oRekeyLimit=256k -oCiphers=$c -oKexAlgorithms=$kex
53 done
54 done
55fi
56
57for s in 16 1k 128k 256k; do
58 verbose "client rekeylimit ${s}"
59 ssh_data_rekeying -oCompression=no -oRekeyLimit=$s
26done 60done
27 61
28for s in 5 10; do 62for s in 5 10; do
29 verbose "client rekeylimit default ${s}" 63 verbose "client rekeylimit default ${s}"
30 rm -f ${COPY} ${LOG} 64 rm -f ${COPY} ${LOG}
31 cat $DATA | \ 65 ${SSH} < ${DATA} -oCompression=no -oRekeyLimit="default $s" -F \
32 ${SSH} -oCompression=no -oRekeyLimit="default $s" -F \ 66 $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3"
33 $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3"
34 if [ $? -ne 0 ]; then 67 if [ $? -ne 0 ]; then
35 fail "ssh failed" 68 fail "ssh failed"
36 fi 69 fi
37 cmp $DATA ${COPY} || fail "corrupted copy" 70 cmp ${DATA} ${COPY} || fail "corrupted copy"
38 n=`grep 'NEWKEYS sent' ${LOG} | wc -l` 71 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
39 n=`expr $n - 1` 72 n=`expr $n - 1`
40 trace "$n rekeying(s)" 73 trace "$n rekeying(s)"
@@ -98,10 +131,10 @@ for size in 16 1k 1K 1m 1M 1g 1G; do
98 awk '/rekeylimit/{print $3}'` 131 awk '/rekeylimit/{print $3}'`
99 132
100 if [ "$bytes" != "$b" ]; then 133 if [ "$bytes" != "$b" ]; then
101 fatal "rekeylimit size: expected $bytes got $b" 134 fatal "rekeylimit size: expected $bytes bytes got $b"
102 fi 135 fi
103 if [ "$seconds" != "$s" ]; then 136 if [ "$seconds" != "$s" ]; then
104 fatal "rekeylimit time: expected $time got $s" 137 fatal "rekeylimit time: expected $time seconds got $s"
105 fi 138 fi
106 done 139 done
107done 140done