From 3a0e9f6479d50a95b5ccd7d7668b0ff45571de9c Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Fri, 5 Nov 2010 10:16:34 +1100 Subject: - djm@cvs.openbsd.org 2010/09/22 12:26:05 [regress/Makefile regress/kextype.sh] regress test for each of the key exchange algorithms that we support --- regress/kextype.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 regress/kextype.sh (limited to 'regress/kextype.sh') diff --git a/regress/kextype.sh b/regress/kextype.sh new file mode 100644 index 000000000..ba6fd9509 --- /dev/null +++ b/regress/kextype.sh @@ -0,0 +1,26 @@ +# $OpenBSD: kextype.sh,v 1.1 2010/09/22 12:26:05 djm Exp $ +# Placed in the Public Domain. + +tid="login with different key exchange algorithms" + +TIME=/usr/bin/time +cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak +cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak + +kextypes="ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521" +kextypes="$kextypes diffie-hellman-group-exchange-sha256" +kextypes="$kextypes diffie-hellman-group-exchange-sha1" +kextypes="$kextypes diffie-hellman-group14-sha1" +kextypes="$kextypes diffie-hellman-group1-sha1" + +tries="1 2 3 4" +for k in $kextypes; do + verbose "kex $k" + for i in $tries; do + ${SSH} -F $OBJ/ssh_proxy -o KexAlgorithms=$k x true + if [ $? -ne 0 ]; then + fail "ssh kex $k" + fi + done +done + -- cgit v1.2.3 From eab5f0df90cad495ee65abdb557538dbfb625d15 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 5 Nov 2010 18:23:38 +1100 Subject: - (dtucker) [Makefile configure.ac regress/Makefile regress/keytype.sh] Import recent changes to regress/Makefile, pass a flag to enable ECC tests from configure through to regress/Makefile and use it in the tests. --- ChangeLog | 3 +++ configure.ac | 7 +++++-- regress/Makefile | 27 +++++++++++++++++++++++++++ regress/cert-hostkey.sh | 3 +-- regress/cert-userkey.sh | 3 +-- regress/kextype.sh | 4 +++- regress/keytype.sh | 5 ++++- 7 files changed, 44 insertions(+), 8 deletions(-) (limited to 'regress/kextype.sh') diff --git a/ChangeLog b/ChangeLog index 2f309739d..c6dfa2403 100644 --- a/ChangeLog +++ b/ChangeLog @@ -43,6 +43,9 @@ - (dtucker) [platform.c platform.h session.c] Move the Cygwin special-case check into platform.c - (dtucker) [regress/keytype.sh] Import new test. + - (dtucker) [Makefile configure.ac regress/Makefile regress/keytype.sh] + Import recent changes to regress/Makefile, pass a flag to enable ECC tests + from configure through to regress/Makefile and use it in the tests. 20101025 - (tim) [openbsd-compat/glob.h] Remove sys/cdefs.h include that came with diff --git a/configure.ac b/configure.ac index 39b68c70a..97d4e6bdb 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.456 2010/11/05 01:03:05 dtucker Exp $ +# $Id: configure.ac,v 1.457 2010/11/05 07:23:38 dtucker Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,7 +15,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) -AC_REVISION($Revision: 1.456 $) +AC_REVISION($Revision: 1.457 $) AC_CONFIG_SRCDIR([ssh.c]) AC_CONFIG_HEADER(config.h) @@ -2209,11 +2209,14 @@ int main(void) { AC_MSG_RESULT(yes) AC_DEFINE(OPENSSL_HAS_ECC, 1, [libcrypto includes complete ECC support]) + TEST_SSH_ECC=yes ], [ AC_MSG_RESULT(no) + TEST_SSH_ECC=no ] ) +AC_SUBST(TEST_SSH_ECC) saved_LIBS="$LIBS" AC_CHECK_LIB(iaf, ia_openinfo, [ diff --git a/regress/Makefile b/regress/Makefile index f51307f02..d5668f08f 100644 --- a/regress/Makefile +++ b/regress/Makefile @@ -53,12 +53,16 @@ LTESTS= connect \ localcommand \ forcecommand \ portnum \ + keytype \ + kextype \ cert-hostkey \ cert-userkey INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers #INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp +#LTESTS= cipher-speed + USER!= id -un CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \ t8.out t8.out.pub t9.out t9.out.pub \ @@ -78,6 +82,10 @@ TEST_ENV= "MALLOC_OPTIONS=AFGJPRX" t1: ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv + tr '\n' '\r' <${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_cr.prv + ssh-keygen -if ${.OBJDIR}/rsa_ssh2_cr.prv | diff - ${.CURDIR}/rsa_openssh.prv + awk '{print $$0 "\r"}' ${.CURDIR}/rsa_ssh2.prv > ${.OBJDIR}/rsa_ssh2_crnl.prv + ssh-keygen -if ${.OBJDIR}/rsa_ssh2_crnl.prv | diff - ${.CURDIR}/rsa_openssh.prv t2: cat ${.CURDIR}/rsa_openssh.prv > $(OBJ)/t2.out @@ -110,6 +118,23 @@ t7: $(OBJ)/t7.out ssh-keygen -lf $(OBJ)/t7.out > /dev/null ssh-keygen -Bf $(OBJ)/t7.out > /dev/null +t8.out: + ssh-keygen -q -t dsa -N '' -f $@ + +t8: t8.out + ssh-keygen -lf t8.out > /dev/null + ssh-keygen -Bf t8.out > /dev/null + +t9.out: + test "${TEST_SSH_ECC}" != yes || \ + ssh-keygen -q -t ecdsa -N '' -f + +t9: t9.out + test "${TEST_SSH_ECC}" != yes || \ + ssh-keygen -lf t9.out > /dev/null + test "${TEST_SSH_ECC}" != yes || \ + ssh-keygen -Bf t9.out > /dev/null + t-exec: ${LTESTS:=.sh} @if [ "x$?" = "x" ]; then exit 0; fi; \ for TEST in ""$?; do \ @@ -124,3 +149,5 @@ t-exec-interop: ${INTEROP_TESTS:=.sh} (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \ done +# Not run by default +interop: ${INTEROP_TARGETS} diff --git a/regress/cert-hostkey.sh b/regress/cert-hostkey.sh index 7461beca6..1ae5d0bda 100644 --- a/regress/cert-hostkey.sh +++ b/regress/cert-hostkey.sh @@ -5,8 +5,7 @@ tid="certified host keys" # used to disable ECC based tests on platforms without ECC ecdsa="" -if grep "#define.*OPENSSL_HAS_ECC" ${BUILDDIR}/config.h >/dev/null 2>&1 -then +if "$TEST_SSH_ECC" = "yes"; then ecdsa=ecdsa fi diff --git a/regress/cert-userkey.sh b/regress/cert-userkey.sh index a7760a2f6..a42c7f34a 100644 --- a/regress/cert-userkey.sh +++ b/regress/cert-userkey.sh @@ -5,8 +5,7 @@ tid="certified user keys" # used to disable ECC based tests on platforms without ECC ecdsa="" -if grep "#define.*OPENSSL_HAS_ECC" ${BUILDDIR}/config.h >/dev/null 2>&1 -then +if "$TEST_SSH_ECC" = "yes"; then ecdsa=ecdsa fi diff --git a/regress/kextype.sh b/regress/kextype.sh index ba6fd9509..22ceb40c9 100644 --- a/regress/kextype.sh +++ b/regress/kextype.sh @@ -7,7 +7,9 @@ TIME=/usr/bin/time cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak -kextypes="ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521" +if "$TEST_SSH_ECC" = "yes"; then + kextypes="ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521" +fi kextypes="$kextypes diffie-hellman-group-exchange-sha256" kextypes="$kextypes diffie-hellman-group-exchange-sha1" kextypes="$kextypes diffie-hellman-group14-sha1" diff --git a/regress/keytype.sh b/regress/keytype.sh index 7be3cc0c8..cd9024587 100644 --- a/regress/keytype.sh +++ b/regress/keytype.sh @@ -7,7 +7,10 @@ TIME=/usr/bin/time cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak -ktypes="dsa-1024 rsa-2048 ecdsa-256 rsa-3072 ecdsa-384 ecdsa-521" +ktypes="dsa-1024 rsa-2048 rsa-3072" +if test "$TEST_SSH_ECC" = "yes"; then + ktypes="$ktypes ecdsa-256 ecdsa-384 ecdsa-521" +fi for kt in $ktypes; do rm -f $OBJ/key.$kt -- cgit v1.2.3 From 345178d95103a976044ed44de0ad19cf1075706b Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 5 Nov 2010 18:35:52 +1100 Subject: - (dtucker) [regress/kextype.sh] Add missing "test". --- ChangeLog | 1 + regress/kextype.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'regress/kextype.sh') diff --git a/ChangeLog b/ChangeLog index c6dfa2403..e540a4d18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -46,6 +46,7 @@ - (dtucker) [Makefile configure.ac regress/Makefile regress/keytype.sh] Import recent changes to regress/Makefile, pass a flag to enable ECC tests from configure through to regress/Makefile and use it in the tests. + - (dtucker) [regress/kextype.sh] Add missing "test". 20101025 - (tim) [openbsd-compat/glob.h] Remove sys/cdefs.h include that came with diff --git a/regress/kextype.sh b/regress/kextype.sh index 22ceb40c9..9f8b7bcd0 100644 --- a/regress/kextype.sh +++ b/regress/kextype.sh @@ -7,7 +7,7 @@ TIME=/usr/bin/time cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak -if "$TEST_SSH_ECC" = "yes"; then +if test "$TEST_SSH_ECC" = "yes"; then kextypes="ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521" fi kextypes="$kextypes diffie-hellman-group-exchange-sha256" -- cgit v1.2.3 From f619d1cad948193e53910ff48bc0b36547fa6d8f Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 5 Nov 2010 18:41:50 +1100 Subject: - (dtucker) [regress/kextype.sh] Make sha256 test depend on ECC. This is not strictly correct since while ECC requires sha256 the reverse is not true however it does prevent spurious test failures. --- ChangeLog | 3 +++ regress/kextype.sh | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'regress/kextype.sh') diff --git a/ChangeLog b/ChangeLog index e540a4d18..b4211302a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -47,6 +47,9 @@ Import recent changes to regress/Makefile, pass a flag to enable ECC tests from configure through to regress/Makefile and use it in the tests. - (dtucker) [regress/kextype.sh] Add missing "test". + - (dtucker) [regress/kextype.sh] Make sha256 test depend on ECC. This is not + strictly correct since while ECC requires sha256 the reverse is not true + however it does prevent spurious test failures. 20101025 - (tim) [openbsd-compat/glob.h] Remove sys/cdefs.h include that came with diff --git a/regress/kextype.sh b/regress/kextype.sh index 9f8b7bcd0..71e2ee060 100644 --- a/regress/kextype.sh +++ b/regress/kextype.sh @@ -9,8 +9,8 @@ cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak if test "$TEST_SSH_ECC" = "yes"; then kextypes="ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521" + kextypes="$kextypes diffie-hellman-group-exchange-sha256" fi -kextypes="$kextypes diffie-hellman-group-exchange-sha256" kextypes="$kextypes diffie-hellman-group-exchange-sha1" kextypes="$kextypes diffie-hellman-group14-sha1" kextypes="$kextypes diffie-hellman-group1-sha1" -- cgit v1.2.3 From 5278806e39bb1794959c71bba61610efb6ec0d58 Mon Sep 17 00:00:00 2001 From: Damien Miller Date: Thu, 13 Jan 2011 22:05:14 +1100 Subject: - (djm) [regress/kextype.sh] Testing diffie-hellman-group-exchange-sha256 should not depend on ECC support --- ChangeLog | 2 ++ regress/kextype.sh | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'regress/kextype.sh') diff --git a/ChangeLog b/ChangeLog index 354127ebe..a064d5690 100644 --- a/ChangeLog +++ b/ChangeLog @@ -10,6 +10,8 @@ - (djm) [myproposal.h] Fix reversed OPENSSL_VERSION_NUMBER test and bad #define that was causing diffie-hellman-group-exchange-sha256 to be incorrectly disabled + - (djm) [regress/kextype.sh] Testing diffie-hellman-group-exchange-sha256 + should not depend on ECC support 20110212 - OpenBSD CVS Sync diff --git a/regress/kextype.sh b/regress/kextype.sh index 71e2ee060..9f8b7bcd0 100644 --- a/regress/kextype.sh +++ b/regress/kextype.sh @@ -9,8 +9,8 @@ cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak if test "$TEST_SSH_ECC" = "yes"; then kextypes="ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521" - kextypes="$kextypes diffie-hellman-group-exchange-sha256" fi +kextypes="$kextypes diffie-hellman-group-exchange-sha256" kextypes="$kextypes diffie-hellman-group-exchange-sha1" kextypes="$kextypes diffie-hellman-group14-sha1" kextypes="$kextypes diffie-hellman-group1-sha1" -- cgit v1.2.3 From 50c61f88abdb356d45026dc1427ddb461b626e45 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 16 Jan 2011 18:28:09 +1100 Subject: - (dtucker) [Makefile.in configure.ac regress/kextype.sh] Skip sha256-based on configurations that don't have it. --- ChangeLog | 4 ++++ Makefile.in | 4 +++- configure.ac | 8 +++++--- regress/kextype.sh | 4 +++- 4 files changed, 15 insertions(+), 5 deletions(-) (limited to 'regress/kextype.sh') diff --git a/ChangeLog b/ChangeLog index ccc8bc302..1266e9984 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20110116 + - (dtucker) [Makefile.in configure.ac regress/kextype.sh] Skip sha256-based + on configurations that don't have it. + 20110114 - OpenBSD CVS Sync - djm@cvs.openbsd.org 2011/01/13 21:54:53 diff --git a/Makefile.in b/Makefile.in index 3ace262e8..c4011daf7 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.318 2011/01/14 03:47:40 djm Exp $ +# $Id: Makefile.in,v 1.319 2011/01/16 07:28:10 dtucker Exp $ # uncomment if you run a non bourne compatable shell. Ie. csh #SHELL = @SH@ @@ -416,6 +416,7 @@ tests interop-tests: $(TARGETS) TEST_SSH_CONCH="conch"; \ TEST_SSH_IPV6="@TEST_SSH_IPV6@" ; \ TEST_SSH_ECC="@TEST_SSH_ECC@" ; \ + TEST_SSH_SHA256="@TEST_SSH_SHA256@" ; \ cd $(srcdir)/regress || exit $$?; \ $(MAKE) \ .OBJDIR="$${BUILDDIR}/regress" \ @@ -438,6 +439,7 @@ tests interop-tests: $(TARGETS) TEST_SSH_CONCH="$${TEST_SSH_CONCH}" \ TEST_SSH_IPV6="$${TEST_SSH_IPV6}" \ TEST_SSH_ECC="$${TEST_SSH_ECC}" \ + TEST_SSH_SHA256="$${TEST_SSH_SHA256}" \ EXEEXT="$(EXEEXT)" \ $@ && echo all tests passed diff --git a/configure.ac b/configure.ac index 3d4d11c92..1817dd909 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -# $Id: configure.ac,v 1.464 2011/01/13 06:35:46 tim Exp $ +# $Id: configure.ac,v 1.465 2011/01/16 07:28:12 dtucker Exp $ # # Copyright (c) 1999-2004 Damien Miller # @@ -15,7 +15,7 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org) -AC_REVISION($Revision: 1.464 $) +AC_REVISION($Revision: 1.465 $) AC_CONFIG_SRCDIR([ssh.c]) # local macros @@ -2239,7 +2239,9 @@ if test "x$check_for_libcrypt_later" = "x1"; then fi # Search for SHA256 support in libc and/or OpenSSL -AC_CHECK_FUNCS(SHA256_Update EVP_sha256) +AC_CHECK_FUNCS(SHA256_Update EVP_sha256, [TEST_SSH_SHA256=yes], + [TEST_SSH_SHA256=no]) +AC_SUBST(TEST_SSH_SHA256) # Check complete ECC support in OpenSSL AC_MSG_CHECKING([whether OpenSSL has complete ECC support]) diff --git a/regress/kextype.sh b/regress/kextype.sh index 9f8b7bcd0..79c0817bb 100644 --- a/regress/kextype.sh +++ b/regress/kextype.sh @@ -10,7 +10,9 @@ cp $OBJ/ssh_proxy $OBJ/ssh_proxy_bak if test "$TEST_SSH_ECC" = "yes"; then kextypes="ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521" fi -kextypes="$kextypes diffie-hellman-group-exchange-sha256" +if test "$TEST_SSH_SHA256" = "yes"; then + kextypes="$kextypes diffie-hellman-group-exchange-sha256" +fi kextypes="$kextypes diffie-hellman-group-exchange-sha1" kextypes="$kextypes diffie-hellman-group14-sha1" kextypes="$kextypes diffie-hellman-group1-sha1" -- cgit v1.2.3