[regress/rekey.sh]
     Factor out the data transfer rekey tests
This commit is contained in:
Darren Tucker 2013-11-07 15:08:02 +11:00
parent 651dc8b259
commit 06595d6395
2 changed files with 29 additions and 48 deletions

View File

@ -31,6 +31,9 @@
[regress/rekey.sh] [regress/rekey.sh]
Test rekeying for every Cipher, MAC and KEX, plus test every KEX with Test rekeying for every Cipher, MAC and KEX, plus test every KEX with
the GCM ciphers. the GCM ciphers.
- dtucker@cvs.openbsd.org 2013/11/07 01:12:51
[regress/rekey.sh]
Factor out the data transfer rekey tests
20131104 20131104
- (djm) OpenBSD CVS Sync - (djm) OpenBSD CVS Sync

View File

@ -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. # Placed in the Public Domain.
tid="rekey" tid="rekey"
@ -7,6 +7,25 @@ LOG=${TEST_SSH_LOGFILE}
rm -f ${LOG} 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="" opts=""
for i in `${SSH} -Q kex`; do for i in `${SSH} -Q kex`; do
opts="$opts KexAlgorithms=$i" opts="$opts KexAlgorithms=$i"
@ -20,20 +39,7 @@ done
for opt in $opts; do for opt in $opts; do
verbose "client rekey $opt" verbose "client rekey $opt"
rm -f ${COPY} ${LOG} ssh_data_rekeying -oRekeyLimit=16 -o$opt
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
done done
# GCM is magical so test with all KexAlgorithms # 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 c in `${SSH} -Q cipher | grep gcm@openssh.com`; do
for kex in `${SSH} -Q kex`; do for kex in `${SSH} -Q kex`; do
verbose "client rekey $c $kex" verbose "client rekey $c $kex"
rm -f ${COPY} ${LOG} ssh_data_rekeying -oRekeyLimit=16 -oCiphers=$c -oKexAlgorithms=$kex
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
done done
done done
fi fi
for s in 16 1k 128k 256k; do for s in 16 1k 128k 256k; do
verbose "client rekeylimit ${s}" verbose "client rekeylimit ${s}"
rm -f ${COPY} ${LOG} ssh_data_rekeying -oCompression=no -oRekeyLimit=$s
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
done done
for s in 5 10; do for s in 5 10; do
verbose "client rekeylimit default ${s}" verbose "client rekeylimit default ${s}"
rm -f ${COPY} ${LOG} rm -f ${COPY} ${LOG}
cat $DATA | \ ${SSH} < ${DATA} -oCompression=no -oRekeyLimit="default $s" -F \
${SSH} -oCompression=no -oRekeyLimit="default $s" -F \
$OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3" $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
fail "ssh failed" fail "ssh failed"
fi fi
cmp $DATA ${COPY} || fail "corrupted copy" cmp ${DATA} ${COPY} || fail "corrupted copy"
n=`grep 'NEWKEYS sent' ${LOG} | wc -l` n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
n=`expr $n - 1` n=`expr $n - 1`
trace "$n rekeying(s)" trace "$n rekeying(s)"