1#	$OpenBSD: putty-ciphers.sh,v 1.11 2021/09/01 03:16:06 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="putty ciphers"
5
6if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
7	skip "putty interop tests not enabled"
8fi
9
10# Re-enable ssh-rsa on older PuTTY versions.
11oldver="`${PLINK} --version | awk '/plink: Release/{if ($3<0.76)print "yes"}'`"
12if [ "x$oldver" = "xyes" ]; then
13	echo "HostKeyAlgorithms +ssh-rsa" >> ${OBJ}/sshd_proxy
14	echo "PubkeyAcceptedKeyTypes +ssh-rsa" >> ${OBJ}/sshd_proxy
15fi
16
17for c in aes 3des aes128-ctr aes192-ctr aes256-ctr chacha20 ; do
18	verbose "$tid: cipher $c"
19	cp ${OBJ}/.putty/sessions/localhost_proxy \
20	    ${OBJ}/.putty/sessions/cipher_$c
21	echo "Cipher=$c" >> ${OBJ}/.putty/sessions/cipher_$c
22
23	rm -f ${COPY}
24	env HOME=$PWD ${PLINK} -load cipher_$c -batch -i ${OBJ}/putty.rsa2 \
25	    cat ${DATA} > ${COPY}
26	if [ $? -ne 0 ]; then
27		fail "ssh cat $DATA failed"
28	fi
29	cmp ${DATA} ${COPY}		|| fail "corrupted copy"
30done
31rm -f ${COPY}
32
33