1# $OpenBSD: dhgex.sh,v 1.1 2014/01/25 04:35:32 dtucker Exp $ 2# Placed in the Public Domain. 3 4tid="dhgex" 5 6LOG=${TEST_SSH_LOGFILE} 7rm -f ${LOG} 8 9kexs=`${SSH} -Q kex | grep diffie-hellman-group-exchange` 10 11ssh_test_dhgex() 12{ 13 bits="$1"; shift 14 cipher="$1"; shift 15 kex="$1"; shift 16 17 rm -f ${LOG} 18 opts="-oKexAlgorithms=$kex -oCiphers=$cipher" 19 groupsz="1024<$bits<8192" 20 verbose "$tid bits $bits $kex $cipher" 21 ${SSH} ${opts} $@ -vvv -F ${OBJ}/ssh_proxy somehost true 22 if [ $? -ne 0 ]; then 23 fail "ssh failed ($@)" 24 fi 25 # check what we request 26 grep "SSH2_MSG_KEX_DH_GEX_REQUEST($groupsz) sent" ${LOG} >/dev/null 27 if [ $? != 0 ]; then 28 got=`egrep "SSH2_MSG_KEX_DH_GEX_REQUEST(.*) sent" ${LOG}` 29 fail "$tid unexpected GEX sizes, expected $groupsz, got $got" 30 fi 31 # check what we got (depends on contents of system moduli file) 32 gotbits="`awk '/bits set:/{print $4}' ${LOG} | head -1 | cut -f2 -d/`" 33 if [ "$gotbits" -lt "$bits" ]; then 34 fatal "$tid expected $bits bit group, got $gotbits" 35 fi 36} 37 38check() 39{ 40 bits="$1"; shift 41 42 for c in $@; do 43 for k in $kexs; do 44 ssh_test_dhgex $bits $c $k 45 done 46 done 47} 48 49#check 2048 3des-cbc 50check 3072 `${SSH} -Q cipher | grep 128` 51check 3072 arcfour blowfish-cbc 52check 7680 `${SSH} -Q cipher | grep 192` 53check 8192 `${SSH} -Q cipher | grep 256` 54check 8192 rijndael-cbc@lysator.liu.se chacha20-poly1305@openssh.com 55