summaryrefslogtreecommitdiff
path: root/tests/cipher-listings.sh
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2017-03-30 20:56:01 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2017-04-02 11:17:45 +0200
commit387b5239a029fafec08be1d22359702847ee13fd (patch)
treee9734d3a0a06cf6ded7c8a819a661dd0c15c4515 /tests/cipher-listings.sh
parent97d8ed6c68d6a7306f50d2b1c2da66a7757956bd (diff)
downloadgnutls-387b5239a029fafec08be1d22359702847ee13fd.tar.gz
tests: added unit test for gnutls_priority_get_cipher_suite_index
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'tests/cipher-listings.sh')
-rwxr-xr-xtests/cipher-listings.sh85
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/cipher-listings.sh b/tests/cipher-listings.sh
new file mode 100755
index 0000000000..eb0e330b16
--- /dev/null
+++ b/tests/cipher-listings.sh
@@ -0,0 +1,85 @@
+#!/bin/sh
+
+# Copyright (C) 2010-2016 Free Software Foundation, Inc.
+#
+# Author: Nikos Mavrogiannopoulos
+#
+# 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.
+
+srcdir="${srcdir:-.}"
+CLI="${CLI:-../src/gnutls-cli${EXEEXT}}"
+DIFF="${DIFF:-diff -b -B}"
+unset RETCODE
+
+TMPFILE=cipher-listings.$$.tmp
+TMPFILE2=cipher-listings2.$$.tmp
+
+if ! test -x "${CLI}"; then
+ exit 77
+fi
+
+if test "${WINDIR}" != ""; then
+ exit 77
+fi
+
+if ! test -z "${VALGRIND}"; then
+ VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=15"
+fi
+
+
+. "${srcdir}/scripts/common.sh"
+
+echo "Checking ciphersuite listings"
+
+check()
+{
+ prio=$2
+ name=$1
+ echo checking $prio
+ "${CLI}" --list --priority $prio|grep -v ^Certificate|grep -v ^Ciphers|grep -v ^MACs|grep -v ^Key|grep -v Compression|grep -v ^Elliptic|sed -e 's/\tSSL3.0$//g' -e 's/\tTLS1.0$//g'|grep -v ^PK>$TMPFILE
+ cat ${srcdir}/data/listings-$name|sed 's/\tSSL3.0$//g' >$TMPFILE2
+ ${DIFF} ${TMPFILE} ${TMPFILE2}
+ if test $? != 0;then
+ echo Error checking $prio with $name
+ echo output in ${TMPFILE}
+ exit 1
+ fi
+}
+
+${CLI} --fips140-mode
+if test $? = 0;then
+ echo "Cannot run this test in FIPS140-2 mode"
+ exit 77
+fi
+
+# We check whether the ciphersuites listed by gnutls-cli
+# for specific (legacy) protocols remain constant. We
+# don't check newer protocols as these change more often.
+
+# This is a unit test for gnutls_priority_get_cipher_suite_index
+
+if test "${ENABLE_SSL3}" = "1";then
+check SSL3.0 "NORMAL:-VERS-ALL:+VERS-SSL3.0:+ARCFOUR-128"
+fi
+check TLS1.0 "NORMAL:-VERS-ALL:+VERS-TLS1.0"
+check TLS1.1 "NORMAL:-VERS-ALL:+VERS-TLS1.1"
+check SSL3.0-TLS1.1 "NORMAL:-VERS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:+VERS-TLS1.1"
+check DTLS1.0 "NORMAL:-VERS-ALL:+VERS-DTLS1.0"
+
+rm -f ${TMPFILE}
+rm -f ${TMPFILE2}
+exit 0