Detect GnuTLS presence and version in compat.sh

This commit is contained in:
Manuel Pégourié-Gonnard 2014-08-31 16:20:58 +02:00
parent 16494496db
commit 1287f11d54

View file

@ -6,18 +6,11 @@
# with and without client authentication. # with and without client authentication.
# #
# Peer version requirements: # Peer version requirements:
# - OpenSSL 1.0.1e 11 Feb 2013 # - OpenSSL 1.0.1e 11 Feb 2013 (probably since 1.0.1, tested with 1.0.1e)
# - GnuTLS 3.2.15 (probably works since 3.2.12 but tested only with 3.2.15) # - GnuTLS 3.2.15 (probably works since 3.2.12 but tested only with 3.2.15)
set -u set -u
# test if those two are set in the environment before assigning defaults
if [ -n "${GNUTLS_CLI:-}" -a -n "${GNUTLS_SERV:-}" ]; then
GNUTLS_AVAILABLE=1
else
GNUTLS_AVAILABLE=0
fi
# initialise counters # initialise counters
TESTS=0 TESTS=0
FAILED=0 FAILED=0
@ -31,6 +24,21 @@ SRVMEM=0
: ${GNUTLS_CLI:=gnutls-cli} : ${GNUTLS_CLI:=gnutls-cli}
: ${GNUTLS_SERV:=gnutls-serv} : ${GNUTLS_SERV:=gnutls-serv}
# do we have a recent enough GnuTLS?
if ( which $GNUTLS_CLI && which $GNUTLS_SERV ) >/dev/null; then
eval $( $GNUTLS_CLI --version | head -n1 | sed 's/.* \([0-9]*\)\.\([0-9]\)*\.\([0-9]*\)$/MAJOR="\1" MINOR="\2" PATCH="\3"/' )
if [ $MAJOR -lt 3 -o \
\( $MAJOR -eq 3 -a $MINOR -lt 2 \) -o \
\( $MAJOR -eq 3 -a $MINOR -eq 2 -a $PATCH -lt 15 \) ]
then
PEER_GNUTLS=""
else
PEER_GNUTLS=" GnuTLS"
fi
else
PEER_GNUTLS=""
fi
# default values for options # default values for options
MODES="ssl3 tls1 tls1_1 tls1_2" MODES="ssl3 tls1 tls1_1 tls1_2"
VERIFIES="NO YES" VERIFIES="NO YES"
@ -39,12 +47,7 @@ FILTER=""
EXCLUDE='NULL\|DES-CBC-' # avoid plain DES but keep 3DES-EDE-CBC (PolarSSL), DES-CBC3 (OpenSSL) EXCLUDE='NULL\|DES-CBC-' # avoid plain DES but keep 3DES-EDE-CBC (PolarSSL), DES-CBC3 (OpenSSL)
VERBOSE="" VERBOSE=""
MEMCHECK=0 MEMCHECK=0
# GnuTLS not enabled by default PEERS="OpenSSL$PEER_GNUTLS PolarSSL"
if [ "$GNUTLS_AVAILABLE" -gt 0 ]; then
PEERS="OpenSSL PolarSSL GnuTLS"
else
PEERS="OpenSSL PolarSSL"
fi
print_usage() { print_usage() {
echo "Usage: $0" echo "Usage: $0"