]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests: moved sha2 tests into cert-tests/
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 28 Jul 2016 11:24:55 +0000 (13:24 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Thu, 28 Jul 2016 16:26:57 +0000 (18:26 +0200)
14 files changed:
tests/Makefile.am
tests/cert-tests/Makefile.am
tests/cert-tests/data/key-ca-dsa.pem [moved from tests/sha2/key-ca-dsa.pem with 100% similarity]
tests/cert-tests/data/key-ca.pem [moved from tests/sha2/key-ca.pem with 100% similarity]
tests/cert-tests/data/key-dsa.pem [moved from tests/sha2/key-dsa.pem with 100% similarity]
tests/cert-tests/data/key-subca-dsa.pem [moved from tests/sha2/key-subca-dsa.pem with 100% similarity]
tests/cert-tests/data/key-subca.pem [moved from tests/sha2/key-subca.pem with 100% similarity]
tests/cert-tests/data/key-subsubca.pem [moved from tests/sha2/key-subsubca.pem with 100% similarity]
tests/cert-tests/data/key-user.pem [moved from tests/sha2/key-user.pem with 100% similarity]
tests/cert-tests/sha2-dsa-test [new file with mode: 0755]
tests/cert-tests/sha2-test [new file with mode: 0755]
tests/sha2/Makefile.am [deleted file]
tests/sha2/sha2 [deleted file]
tests/sha2/sha2-dsa [deleted file]

index 28bf43727036ee9b1a9932d4d193d7f37f87c16d..d43501dc49a5e2618d6eb0ae6c18d2ccea709a19 100644 (file)
@@ -19,7 +19,7 @@
 # along with this file; if not, write to the Free Software Foundation,
 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
-SUBDIRS = . cert-tests ocsp-tests key-tests sha2 safe-renegotiation scripts \
+SUBDIRS = . cert-tests ocsp-tests key-tests safe-renegotiation scripts \
        slow dtls srp windows
 
 if ENABLE_OPENPGP
index e9cfa171e875a5cf78315b20670e244f006b5dde..94349f3bae54f13e5ab78bca16132590d6e0669c 100644 (file)
@@ -51,11 +51,13 @@ EXTRA_DIST = data/ca-no-pathlen.pem data/no-ca-or-pathlen.pem data/aki-cert.pem
        data/arb-extensions.csr data/pkcs1-pad-ok.pem data/pkcs1-pad-broken.pem \
        data/pkcs1-pad-ok2.pem data/pkcs1-pad-broken2.pem data/pkcs1-pad-broken3.pem \
        data/client.p12 data/noclient.p12 data/unclient.p12 data/pkcs12_2certs.p12 \
-       data/pkcs12_5certs.p12 data/test-null.p12 data/cert-ca.p12 data/sha256.p12
+       data/pkcs12_5certs.p12 data/test-null.p12 data/cert-ca.p12 data/sha256.p12 \
+       data/key-ca.pem data/key-subca.pem data/key-subsubca.pem data/key-user.pem \
+       data/key-dsa.pem data/key-ca-dsa.pem data/key-subca-dsa.pem
 
 dist_check_SCRIPTS = pathlen aki certtool invalid-sig email \
        pkcs7 pkcs7-broken-sigs privkey-import name-constraints certtool-long-cn crl provable-privkey \
-       provable-dh userid
+       provable-dh userid sha2-test sha2-dsa-test
 
 if !ENABLE_FIPS140
 dist_check_SCRIPTS += pkcs12
diff --git a/tests/cert-tests/sha2-dsa-test b/tests/cert-tests/sha2-dsa-test
new file mode 100755 (executable)
index 0000000..955d5ae
--- /dev/null
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# Copyright (C) 2006-2008, 2010, 2012 Free Software Foundation, Inc.
+#
+# Author: Simon Josefsson
+#
+# This file is part of GnuTLS.
+#
+# GnuTLS is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# GnuTLS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GnuTLS; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+#set -e
+
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
+TEMPLFILE=template-dsa.$$.tmp
+CAFILE=ca-dsa.$$.tmp
+SUBCAFILE=subca-dsa.$$.tmp
+TMPFILE=sha2-dsa.$$.tmp
+USERFILE=user-dsa.$$.tmp
+VERIFYFILE=verify-dsa.$$.tmp
+
+echo ca > $TEMPLFILE
+echo "cn = SHA 256 CA" >> $TEMPLFILE
+
+"${CERTTOOL}" -d 2 --generate-self-signed --template $TEMPLFILE \
+       --load-privkey "${srcdir}/data/key-ca-dsa.pem" \
+       --outfile $CAFILE \
+       --hash sha256 >$TMPFILE 2>&1
+
+if [ $? != 0 ]; then
+       cat $TMPFILE
+       exit 1
+fi
+
+echo ca > $TEMPLFILE
+echo "cn = SHA 224 Mid CA" >> $TEMPLFILE
+
+"${CERTTOOL}" -d 2 --generate-certificate --template $TEMPLFILE \
+       --load-ca-privkey "${srcdir}/data/key-ca-dsa.pem" \
+       --load-ca-certificate $CAFILE \
+       --load-privkey "${srcdir}/data/key-subca-dsa.pem" \
+       --outfile $SUBCAFILE \
+       --hash sha224 >$TMPFILE 2>&1
+
+if [ $? != 0 ]; then
+       cat $TMPFILE
+       exit 1
+fi
+
+echo "cn = End-user" > $TEMPLFILE
+
+"${CERTTOOL}" -d 2 --generate-certificate --template $TEMPLFILE \
+       --load-ca-privkey "${srcdir}/data/key-subca-dsa.pem" \
+       --load-ca-certificate $SUBCAFILE \
+       --load-privkey "${srcdir}/data/key-dsa.pem" \
+       --outfile $USERFILE >$TMPFILE 2>&1
+
+if [ $? != 0 ]; then
+       cat $TMPFILE
+       exit 1
+fi
+
+cat $USERFILE $SUBCAFILE $CAFILE > $TMPFILE
+"${CERTTOOL}" --verify-chain <$TMPFILE > $VERIFYFILE
+
+if [ $? != 0 ]; then
+       cat $VERIFYFILE
+       exit 1
+fi
+
+rm -f $VERIFYFILE $USERFILE $CAFILE $SUBCAFILE $TEMPLFILE $TMPFILE
+
+exit 0
diff --git a/tests/cert-tests/sha2-test b/tests/cert-tests/sha2-test
new file mode 100755 (executable)
index 0000000..9447518
--- /dev/null
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+# Copyright (C) 2006-2008, 2010, 2012 Free Software Foundation, Inc.
+#
+# Author: Simon Josefsson
+#
+# This file is part of GnuTLS.
+#
+# GnuTLS is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# GnuTLS is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GnuTLS; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+#set -e
+
+srcdir="${srcdir:-.}"
+CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
+TEMPLFILE=template.$$.tmp
+CAFILE=ca.$$.tmp
+SUBCAFILE=subca.$$.tmp
+SUBSUBCAFILE=subsubca.$$.tmp
+TMPFILE=sha2.$$.tmp
+USERFILE=user.$$.tmp
+VERIFYFILE=verify.$$.tmp
+
+echo ca > $TEMPLFILE
+echo "cn = SHA 512 CA" >> $TEMPLFILE
+
+"${CERTTOOL}" -d 2 --generate-self-signed --template $TEMPLFILE \
+       --load-privkey "${srcdir}/data/key-ca.pem" \
+       --outfile $CAFILE \
+       --hash sha512 >$TMPFILE 2>&1
+
+if [ $? != 0 ]; then
+       cat $TMPFILE
+       exit 1
+fi
+
+echo ca > $TEMPLFILE
+echo "cn = SHA 384 sub-CA" >> $TEMPLFILE
+
+"${CERTTOOL}" -d 2 --generate-certificate --template $TEMPLFILE \
+       --load-ca-privkey "${srcdir}/data/key-ca.pem" \
+       --load-ca-certificate $CAFILE \
+       --load-privkey "${srcdir}/data/key-subca.pem" \
+       --outfile $SUBCAFILE \
+       --hash sha384 >$TMPFILE 2>&1
+
+if [ $? != 0 ]; then
+       cat $TMPFILE
+       exit 1
+fi
+
+echo ca > $TEMPLFILE
+echo "cn = SHA 256 sub-sub-CA" >> $TEMPLFILE
+
+"${CERTTOOL}" -d 2 --generate-certificate --template $TEMPLFILE \
+       --load-ca-privkey "${srcdir}/data/key-subca.pem" \
+       --load-ca-certificate $SUBCAFILE \
+       --load-privkey "${srcdir}/data/key-subsubca.pem" \
+       --outfile $SUBSUBCAFILE \
+       --hash sha256 >$TMPFILE 2>&1
+
+if [ $? != 0 ]; then
+       cat $TMPFILE
+       exit 1
+fi
+
+echo "cn = End-user" > $TEMPLFILE
+
+"${CERTTOOL}" -d 2 --generate-certificate --template $TEMPLFILE \
+       --load-ca-privkey "${srcdir}/data/key-subsubca.pem" \
+       --load-ca-certificate $SUBSUBCAFILE \
+       --load-privkey "${srcdir}/data/key-user.pem" \
+       --outfile $USERFILE >$TMPFILE 2>&1
+
+if [ $? != 0 ]; then
+       cat $TMPFILE
+       exit 1
+fi
+
+num=`cat $USERFILE $SUBSUBCAFILE $SUBCAFILE $CAFILE | "${CERTTOOL}" --verify-chain | tee $VERIFYFILE | grep -c Verified`
+#cat verify
+
+if test "${num}" != "4"; then
+       echo Verification failure
+       exit 1
+fi
+
+rm -f $VERIFYFILE $USERFILE $SUBSUBCAFILE $SUBCAFILE $CAFILE $TEMPLFILE $TMPFILE
+
+exit 0
diff --git a/tests/sha2/Makefile.am b/tests/sha2/Makefile.am
deleted file mode 100644 (file)
index 187239f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-## Process this file with automake to produce Makefile.in
-# Copyright (C) 2007-2008, 2010, 2012 Free Software Foundation, Inc.
-#
-# Author: Simon Josefsson
-#
-# This file is part of GnuTLS.
-#
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This file is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this file; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-EXTRA_DIST = key-ca.pem key-subca.pem key-subsubca.pem key-user.pem key-dsa.pem \
-       key-ca-dsa.pem key-subca-dsa.pem
-
-dist_check_SCRIPTS = sha2 sha2-dsa
-
-TESTS = sha2 sha2-dsa
-
-TESTS_ENVIRONMENT = EXEEXT=$(EXEEXT) \
-       LC_ALL="C"                                              \
-       top_builddir="$(top_builddir)"                          \
-       srcdir="$(srcdir)"
diff --git a/tests/sha2/sha2 b/tests/sha2/sha2
deleted file mode 100755 (executable)
index 8b77ea4..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2006-2008, 2010, 2012 Free Software Foundation, Inc.
-#
-# Author: Simon Josefsson
-#
-# This file is part of GnuTLS.
-#
-# GnuTLS is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-#
-# GnuTLS is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GnuTLS; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-#set -e
-
-srcdir="${srcdir:-.}"
-CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
-
-echo ca > template-sha2
-echo "cn = SHA 512 CA" >> template-sha2
-
-"${CERTTOOL}" -d 2 --generate-self-signed --template template-sha2 \
-       --load-privkey "${srcdir}/key-ca.pem" \
-       --outfile new-ca.pem \
-       --hash sha512 >out 2>&1
-
-if [ $? != 0 ]; then
-       cat out
-       exit 1
-fi
-
-echo ca > template-sha2
-echo "cn = SHA 384 sub-CA" >> template-sha2
-
-"${CERTTOOL}" -d 2 --generate-certificate --template template-sha2 \
-       --load-ca-privkey "${srcdir}/key-ca.pem" \
-       --load-ca-certificate new-ca.pem \
-       --load-privkey "${srcdir}/key-subca.pem" \
-       --outfile new-subca.pem \
-       --hash sha384 >out 2>&1
-
-if [ $? != 0 ]; then
-       cat out
-       exit 1
-fi
-
-echo ca > template-sha2
-echo "cn = SHA 256 sub-sub-CA" >> template-sha2
-
-"${CERTTOOL}" -d 2 --generate-certificate --template template-sha2 \
-       --load-ca-privkey "${srcdir}/key-subca.pem" \
-       --load-ca-certificate new-subca.pem \
-       --load-privkey "${srcdir}/key-subsubca.pem" \
-       --outfile new-subsubca.pem \
-       --hash sha256 >out 2>&1
-
-if [ $? != 0 ]; then
-       cat out
-       exit 1
-fi
-
-echo "cn = End-user" > template-sha2
-
-"${CERTTOOL}" -d 2 --generate-certificate --template template-sha2 \
-       --load-ca-privkey "${srcdir}/key-subsubca.pem" \
-       --load-ca-certificate new-subsubca.pem \
-       --load-privkey "${srcdir}/key-user.pem" \
-       --outfile new-user.pem >out 2>&1
-
-if [ $? != 0 ]; then
-       cat out
-       exit 1
-fi
-
-num=`cat new-user.pem new-subsubca.pem new-subca.pem new-ca.pem | "${CERTTOOL}" --verify-chain | tee verify-sha2 | grep -c Verified`
-#cat verify
-
-if test "${num}" != "4"; then
-       echo Verification failure
-       exit 1
-fi
-
-rm -f verify-sha2 new-user.pem new-subsubca.pem new-subca.pem new-ca.pem template-sha2 out
-
-exit 0
diff --git a/tests/sha2/sha2-dsa b/tests/sha2/sha2-dsa
deleted file mode 100755 (executable)
index b2b673f..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-# Copyright (C) 2006-2008, 2010, 2012 Free Software Foundation, Inc.
-#
-# Author: Simon Josefsson
-#
-# This file is part of GnuTLS.
-#
-# GnuTLS is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by the
-# Free Software Foundation; either version 3 of the License, or (at
-# your option) any later version.
-#
-# GnuTLS is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GnuTLS; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-#set -e
-
-srcdir="${srcdir:-.}"
-CERTTOOL="${CERTTOOL:-../../src/certtool${EXEEXT}}"
-
-echo ca > template-dsa
-echo "cn = SHA 256 CA" >> template-dsa
-
-"${CERTTOOL}" -d 2 --generate-self-signed --template template-dsa \
-       --load-privkey "${srcdir}/key-ca-dsa.pem" \
-       --outfile new-ca-dsa.pem \
-       --hash sha256 >out-dsa 2>&1
-
-if [ $? != 0 ]; then
-       cat out-dsa
-       exit 1
-fi
-
-echo ca > template-dsa
-echo "cn = SHA 224 Mid CA" >> template-dsa
-
-"${CERTTOOL}" -d 2 --generate-certificate --template template-dsa \
-       --load-ca-privkey "${srcdir}/key-ca-dsa.pem" \
-       --load-ca-certificate new-ca-dsa.pem \
-       --load-privkey "${srcdir}/key-subca-dsa.pem" \
-       --outfile new-subca-dsa.pem \
-       --hash sha224 >out-dsa 2>&1
-
-if [ $? != 0 ]; then
-       cat out-dsa
-       exit 1
-fi
-
-echo "cn = End-user" > template-dsa
-
-"${CERTTOOL}" -d 2 --generate-certificate --template template-dsa \
-       --load-ca-privkey "${srcdir}/key-subca-dsa.pem" \
-       --load-ca-certificate new-subca-dsa.pem \
-       --load-privkey "${srcdir}/key-dsa.pem" \
-       --outfile new-user-dsa.pem >out-dsa 2>&1
-
-if [ $? != 0 ]; then
-       cat out-dsa
-       exit 1
-fi
-
-cat new-user-dsa.pem new-subca-dsa.pem new-ca-dsa.pem > out-dsa
-"${CERTTOOL}" --verify-chain <out-dsa > verify-dsa
-
-if [ $? != 0 ]; then
-       cat verify-dsa
-       exit 1
-fi
-
-rm -f verify-dsa new-user-dsa.pem new-ca-dsa.pem new-subca-dsa.pem template-dsa out-dsa
-
-exit 0