summaryrefslogtreecommitdiff
path: root/regress/usr.bin/ssh/rekey.sh
blob: 26848d27b56c4618426fd1db61422ab5fc4e77e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#	$OpenBSD: rekey.sh,v 1.1 2003/03/28 13:58:28 markus Exp $
#	Placed in the Public Domain.

tid="rekey during transfer data"

DATA=${OBJ}/data
COPY=${OBJ}/copy
LOG=${OBJ}/log

rm -f ${COPY} ${LOG} ${DATA}
dd if=/dev/zero of=${DATA} bs=1k count=512 > /dev/null 2>&1

for s in 16 1k 128k 256k; do
	trace "rekeylimit ${s}"
	rm -f ${COPY}
	cat $DATA | \
		${SSH} -oCompression=no -oRekeyLimit=$s \
			-v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" \
		2> ${LOG}
	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
rm -f ${COPY} ${LOG} ${DATA}