diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2013-11-07 01:12:52 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2013-11-07 01:12:52 +0000 |
commit | 286d0f17ad10f6f710816740e5cf038a6e2615a7 (patch) | |
tree | 44c138c96e784283728a561495a5c2d330c3cc9e /regress/usr.bin/ssh | |
parent | 5da298d536d2d12db748f564e8a3d3c228ca4c36 (diff) |
Factor out the data transfer rekey tests
Diffstat (limited to 'regress/usr.bin/ssh')
-rw-r--r-- | regress/usr.bin/ssh/rekey.sh | 74 |
1 files changed, 26 insertions, 48 deletions
diff --git a/regress/usr.bin/ssh/rekey.sh b/regress/usr.bin/ssh/rekey.sh index 156179b3892..7131a6f0a43 100644 --- a/regress/usr.bin/ssh/rekey.sh +++ b/regress/usr.bin/ssh/rekey.sh @@ -1,4 +1,4 @@ -# $OpenBSD: rekey.sh,v 1.10 2013/11/07 00:12:05 dtucker Exp $ +# $OpenBSD: rekey.sh,v 1.11 2013/11/07 01:12:51 dtucker Exp $ # Placed in the Public Domain. tid="rekey" @@ -7,6 +7,25 @@ LOG=${TEST_SSH_LOGFILE} rm -f ${LOG} +# Test rekeying based on data volume only. +# Arguments will be passed to ssh. +ssh_data_rekeying() +{ + rm -f ${COPY} ${LOG} + ${SSH} <${DATA} -oCompression=no $@ -v -F $OBJ/ssh_proxy somehost \ + "cat > ${COPY}" + if [ $? -ne 0 ]; then + fail "ssh failed ($@)" + fi + cmp ${DATA} ${COPY} || fail "corrupted copy ($@)" + n=`grep 'NEWKEYS sent' ${LOG} | wc -l` + n=`expr $n - 1` + trace "$n rekeying(s)" + if [ $n -lt 1 ]; then + fail "no rekeying occured ($@)" + fi +} + opts="" for i in `${SSH} -Q kex`; do opts="$opts KexAlgorithms=$i" @@ -20,20 +39,7 @@ done for opt in $opts; do verbose "client rekey $opt" - rm -f ${COPY} ${LOG} - cat $DATA | \ - ${SSH} -oCompression=no -oRekeyLimit=16 -o$opt \ - -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" - if [ $? -ne 0 ]; then - fail "ssh failed" - fi - cmp $DATA ${COPY} || fail "corrupted copy" - n=`grep 'NEWKEYS sent' ${LOG} | wc -l` - n=`expr $n - 1` - trace "$n rekeying(s)" - if [ $n -lt 1 ]; then - fail "no rekeying occured" - fi + ssh_data_rekeying -oRekeyLimit=16 -o$opt done # GCM is magical so test with all KexAlgorithms @@ -41,53 +47,25 @@ if ${SSH} -Q cipher | grep gcm@openssh.com >/dev/null ; then for c in `${SSH} -Q cipher | grep gcm@openssh.com`; do for kex in `${SSH} -Q kex`; do verbose "client rekey $c $kex" - rm -f ${COPY} ${LOG} - cat $DATA | \ - ${SSH} -oCompression=no -oRekeyLimit=16 \ - -oCiphers=$c -oKexAlgorithms=$kex \ - -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" - if [ $? -ne 0 ]; then - fail "ssh failed" - fi - cmp $DATA ${COPY} || fail "corrupted copy" - n=`grep 'NEWKEYS sent' ${LOG} | wc -l` - n=`expr $n - 1` - trace "$n rekeying(s)" - if [ $n -lt 1 ]; then - fail "no rekeying occured" - fi + ssh_data_rekeying -oRekeyLimit=16 -oCiphers=$c -oKexAlgorithms=$kex done done fi for s in 16 1k 128k 256k; do verbose "client rekeylimit ${s}" - rm -f ${COPY} ${LOG} - cat $DATA | \ - ${SSH} -oCompression=no -oRekeyLimit=$s \ - -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" - if [ $? -ne 0 ]; then - fail "ssh failed" - fi - cmp $DATA ${COPY} || fail "corrupted copy" - n=`grep 'NEWKEYS sent' ${LOG} | wc -l` - n=`expr $n - 1` - trace "$n rekeying(s)" - if [ $n -lt 1 ]; then - fail "no rekeying occured" - fi + ssh_data_rekeying -oCompression=no -oRekeyLimit=$s done for s in 5 10; do verbose "client rekeylimit default ${s}" rm -f ${COPY} ${LOG} - cat $DATA | \ - ${SSH} -oCompression=no -oRekeyLimit="default $s" -F \ - $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3" + ${SSH} < ${DATA} -oCompression=no -oRekeyLimit="default $s" -F \ + $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3" if [ $? -ne 0 ]; then fail "ssh failed" fi - cmp $DATA ${COPY} || fail "corrupted copy" + cmp ${DATA} ${COPY} || fail "corrupted copy" n=`grep 'NEWKEYS sent' ${LOG} | wc -l` n=`expr $n - 1` trace "$n rekeying(s)" |