diff options
author | 2013-01-12 11:23:53 +0000 | |
---|---|---|
committer | 2013-01-12 11:23:53 +0000 | |
commit | fc8dc03f7d2637722eac600d756f0debdee205e0 (patch) | |
tree | 37f5b6961e4776308604636451b0a0791fff34fb | |
parent | improve error message for integrity failure in AES-GCM modes; ok markus@ (diff) | |
download | wireguard-openbsd-fc8dc03f7d2637722eac600d756f0debdee205e0.tar.xz wireguard-openbsd-fc8dc03f7d2637722eac600d756f0debdee205e0.zip |
test AES-GCM modes; feedback markus@
-rw-r--r-- | regress/usr.bin/ssh/cipher-speed.sh | 12 | ||||
-rw-r--r-- | regress/usr.bin/ssh/integrity.sh | 14 | ||||
-rw-r--r-- | regress/usr.bin/ssh/try-ciphers.sh | 11 |
3 files changed, 29 insertions, 8 deletions
diff --git a/regress/usr.bin/ssh/cipher-speed.sh b/regress/usr.bin/ssh/cipher-speed.sh index c332fd7d3e2..343b3ed572a 100644 --- a/regress/usr.bin/ssh/cipher-speed.sh +++ b/regress/usr.bin/ssh/cipher-speed.sh @@ -1,4 +1,4 @@ -# $OpenBSD: cipher-speed.sh,v 1.6 2012/10/05 02:20:48 dtucker Exp $ +# $OpenBSD: cipher-speed.sh,v 1.7 2013/01/12 11:23:53 djm Exp $ # Placed in the Public Domain. tid="cipher speed" @@ -15,11 +15,12 @@ DATA=/bsd ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc arcfour128 arcfour256 arcfour aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se - aes128-ctr aes192-ctr aes256-ctr" + aes128-ctr aes192-ctr aes256-ctr + aes128-gcm@openssh.com aes256-gcm@openssh.com" macs="hmac-sha1 hmac-md5 umac-64@openssh.com umac-128@openssh.com hmac-sha1-96 hmac-md5-96 hmac-sha2-256 hmac-sha2-512" -for c in $ciphers; do for m in $macs; do +for c in $ciphers; do n=0; for m in $macs; do trace "proto 2 cipher $c mac $m" for x in $tries; do echo -n "$c/$m:\t" @@ -32,6 +33,11 @@ for c in $ciphers; do for m in $macs; do fail "ssh -2 failed with mac $m cipher $c" fi done + # No point trying all MACs for GCM since they are ignored. + case $c in + aes*-gcm@openssh.com) test $n -gt 0 && break;; + esac + n=$(($n + 1)) done; done ciphers="3des blowfish" diff --git a/regress/usr.bin/ssh/integrity.sh b/regress/usr.bin/ssh/integrity.sh index 23135685cef..f3821a60273 100644 --- a/regress/usr.bin/ssh/integrity.sh +++ b/regress/usr.bin/ssh/integrity.sh @@ -1,4 +1,4 @@ -# $OpenBSD: integrity.sh,v 1.1 2012/12/11 22:42:11 markus Exp $ +# $OpenBSD: integrity.sh,v 1.2 2013/01/12 11:23:53 djm Exp $ # Placed in the Public Domain. tid="integrity" @@ -14,6 +14,9 @@ macs="hmac-sha1 hmac-md5 umac-64@openssh.com umac-128@openssh.com umac-64-etm@openssh.com umac-128-etm@openssh.com hmac-sha1-96-etm@openssh.com hmac-md5-96-etm@openssh.com hmac-sha2-256-etm@openssh.com hmac-sha2-512-etm@openssh.com" +# The following are not MACs, but ciphers with integrated integrity. They are +# handled specially below. +macs="$macs aes128-gcm@openssh.com aes256-gcm@openssh.com" # sshd-command for proxy (see test-exec.sh) cmd="sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy" @@ -32,7 +35,11 @@ for m in $macs; do fi # modify output from sshd at offset $off pxy="proxycommand=$cmd | $OBJ/modpipe -m xor:$off:1" - output=$(${SSH} -m $m -2F $OBJ/ssh_proxy -o "$pxy" \ + case $m in + aes*gcm*) macopt="-c $m";; + *) macopt="-m $m";; + esac + output=$(${SSH} $macopt -2F $OBJ/ssh_proxy -o "$pxy" \ 999.999.999.999 true 2>&1) if [ $? -eq 0 ]; then fail "ssh -m $m succeeds with bit-flip at $off" @@ -42,7 +49,8 @@ for m in $macs; do verbose "test $tid: $m @$off $output" case "$output" in Bad?packet*) elen=$((elen+1)); skip=2;; - Corrupted?MAC*) emac=$((emac+1)); skip=0;; + Corrupted?MAC* | Decryption?integrity?check?failed*) + emac=$((emac+1)); skip=0;; padding*) epad=$((epad+1)); skip=0;; *) fail "unexpected error mac $m at $off";; esac diff --git a/regress/usr.bin/ssh/try-ciphers.sh b/regress/usr.bin/ssh/try-ciphers.sh index 00d2dd5195b..01e70e22707 100644 --- a/regress/usr.bin/ssh/try-ciphers.sh +++ b/regress/usr.bin/ssh/try-ciphers.sh @@ -1,4 +1,4 @@ -# $OpenBSD: try-ciphers.sh,v 1.17 2012/12/11 23:12:13 markus Exp $ +# $OpenBSD: try-ciphers.sh,v 1.18 2013/01/12 11:23:53 djm Exp $ # Placed in the Public Domain. tid="try ciphers" @@ -6,7 +6,8 @@ tid="try ciphers" ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc arcfour128 arcfour256 arcfour aes192-cbc aes256-cbc rijndael-cbc@lysator.liu.se - aes128-ctr aes192-ctr aes256-ctr" + aes128-ctr aes192-ctr aes256-ctr + aes128-gcm@openssh.com aes256-gcm@openssh.com" macs="hmac-sha1 hmac-md5 umac-64@openssh.com umac-128@openssh.com hmac-sha1-96 hmac-md5-96 hmac-sha2-256 hmac-sha2-512 hmac-sha1-etm@openssh.com hmac-md5-etm@openssh.com @@ -16,6 +17,7 @@ macs="hmac-sha1 hmac-md5 umac-64@openssh.com umac-128@openssh.com hmac-ripemd160-etm@openssh.com" for c in $ciphers; do + n=0 for m in $macs; do trace "proto 2 cipher $c mac $m" verbose "test $tid: proto 2 cipher $c mac $m" @@ -23,6 +25,11 @@ for c in $ciphers; do if [ $? -ne 0 ]; then fail "ssh -2 failed with mac $m cipher $c" fi + # No point trying all MACs for GCM since they are ignored. + case $c in + aes*-gcm@openssh.com) test $n -gt 0 && break;; + esac + n=$(($n + 1)) done done |