Blame tests/cipher-listings.sh

Packit Service 4684c1
#!/bin/sh
Packit Service 4684c1
Packit Service 4684c1
# Copyright (C) 2010-2016 Free Software Foundation, Inc.
Packit Service 4684c1
#
Packit Service 4684c1
# Author: Nikos Mavrogiannopoulos
Packit Service 4684c1
#
Packit Service 4684c1
# This file is part of GnuTLS.
Packit Service 4684c1
#
Packit Service 4684c1
# GnuTLS is free software; you can redistribute it and/or modify it
Packit Service 4684c1
# under the terms of the GNU General Public License as published by the
Packit Service 4684c1
# Free Software Foundation; either version 3 of the License, or (at
Packit Service 4684c1
# your option) any later version.
Packit Service 4684c1
#
Packit Service 4684c1
# GnuTLS is distributed in the hope that it will be useful, but
Packit Service 4684c1
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service 4684c1
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service 4684c1
# General Public License for more details.
Packit Service 4684c1
#
Packit Service 4684c1
# You should have received a copy of the GNU General Public License
Packit Service 4684c1
# along with GnuTLS; if not, write to the Free Software Foundation,
Packit Service 4684c1
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Packit Service 4684c1
Packit Service 4684c1
srcdir="${srcdir:-.}"
Packit Service 4684c1
CLI="${CLI:-../src/gnutls-cli${EXEEXT}}"
Packit Service 4684c1
DIFF="${DIFF:-diff -b -B}"
Packit Service 4684c1
SED="${SED:-sed}"
Packit Service 4684c1
unset RETCODE
Packit Service 4684c1
Packit Service 4684c1
TMPFILE=cipher-listings.$$.tmp
Packit Service 4684c1
TMPFILE2=cipher-listings2.$$.tmp
Packit Service 4684c1
Packit Service 4684c1
if ! test -x "${CLI}"; then
Packit Service 4684c1
	exit 77
Packit Service 4684c1
fi
Packit Service 4684c1
Packit Service 4684c1
if test "${WINDIR}" != ""; then
Packit Service 4684c1
	exit 77
Packit Service 4684c1
fi 
Packit Service 4684c1
Packit Service 4684c1
if ! test -z "${VALGRIND}"; then
Packit Service 4684c1
	VALGRIND="${LIBTOOL:-libtool} --mode=execute ${VALGRIND} --error-exitcode=15"
Packit Service 4684c1
fi
Packit Service 4684c1
Packit Service 4684c1
Packit Service 4684c1
. "${srcdir}/scripts/common.sh"
Packit Service 4684c1
Packit Service 4684c1
echo "Checking ciphersuite listings"
Packit Service 4684c1
Packit Service 4684c1
tab=$(printf '\t')
Packit Service 4684c1
check()
Packit Service 4684c1
{
Packit Service 4684c1
	prio=$2
Packit Service 4684c1
	name=$1
Packit Service 4684c1
	echo checking $prio
Packit Service 4684c1
	"${CLI}" --list --priority $prio|grep -v ^Certificate|grep -v ^Ciphers|grep -v ^MACs|grep -v ^Key|grep -v Compression|grep -v ^Groups|grep -v ^Elliptic|${SED} -e 's/'"${tab}"'SSL3.0$//g' -e 's/'"${tab}"'TLS1.0$//g'|grep -v ^PK>$TMPFILE
Packit Service 4684c1
	cat ${srcdir}/data/listings-$name|${SED} 's/'"${tab}"'SSL3.0$//g' >$TMPFILE2
Packit Service 4684c1
	${DIFF} ${TMPFILE} ${TMPFILE2}
Packit Service 4684c1
	if test $? != 0;then
Packit Service 4684c1
		echo Error checking $prio with $name
Packit Service 4684c1
		echo output in ${TMPFILE}
Packit Service 4684c1
		exit 1
Packit Service 4684c1
	fi
Packit Service 4684c1
}
Packit Service 4684c1
Packit Service 4684c1
${CLI} --fips140-mode
Packit Service 4684c1
if test $? = 0;then
Packit Service 4684c1
	echo "Cannot run this test in FIPS140-2 mode"
Packit Service 4684c1
	exit 77
Packit Service 4684c1
fi
Packit Service 4684c1
Packit Service 4684c1
# We check whether the ciphersuites listed by gnutls-cli
Packit Service 4684c1
# for specific (legacy) protocols remain constant. We
Packit Service 4684c1
# don't check newer protocols as these change more often.
Packit Service 4684c1
Packit Service 4684c1
# This is a unit test for gnutls_priority_get_cipher_suite_index
Packit Service 4684c1
Packit Service 4684c1
if test "${ENABLE_SSL3}" = "1";then
Packit Service 4684c1
echo "Running with SSL3.0 enabled"
Packit Service 4684c1
check SSL3.0 "NORMAL:-VERS-ALL:+VERS-SSL3.0:+ARCFOUR-128"
Packit Service 4684c1
check old-SSL3.0-TLS1.1 "NORMAL:-VERS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:+VERS-TLS1.1"
Packit Service 4684c1
else
Packit Service 4684c1
echo "Running without support for SSL3.0"
Packit Service 4684c1
check SSL3.0-TLS1.1 "NORMAL:-VERS-ALL:+VERS-TLS1.0:+VERS-SSL3.0:+VERS-TLS1.1"
Packit Service 4684c1
fi
Packit Service 4684c1
check TLS1.0 "NORMAL:-VERS-ALL:+VERS-TLS1.0"
Packit Service 4684c1
check TLS1.1 "NORMAL:-VERS-ALL:+VERS-TLS1.1"
Packit Service 4684c1
check DTLS1.0 "NORMAL:-VERS-ALL:+VERS-DTLS1.0"
Packit Service 4684c1
# Priority strings prior to 3.6.x did not require the +GROUP option; here we
Packit Service 4684c1
# test whether these work as expected.
Packit Service 4684c1
check legacy1 "NONE:+VERS-TLS-ALL:+MAC-ALL:+RSA:+AES-128-GCM:+SIGN-ALL:+COMP-NULL"
Packit Service 4684c1
check legacy2 "NONE:+VERS-TLS-ALL:+MAC-ALL:+RSA:+CAMELLIA-256-GCM:+SIGN-ALL:+COMP-NULL"
Packit Service 4684c1
check legacy3 "NONE:+VERS-TLS-ALL:+MAC-ALL:+RSA:+CAMELLIA-256-GCM:+SIGN-ALL:+COMP-NULL:+CTYPE-OPENPGP"
Packit Service 4684c1
check legacy4 "NONE:+VERS-TLS-ALL:+MAC-ALL:+RSA:+CAMELLIA-256-GCM:+SIGN-ALL:+COMP-NULL:-CTYPE-OPENPGP"
Packit Service 4684c1
Packit Service 4684c1
Packit Service 4684c1
rm -f ${TMPFILE}
Packit Service 4684c1
rm -f ${TMPFILE2}
Packit Service 4684c1
exit 0