Require GnuTLS 2.12.0, add cmake version detection

Since v2.1.0rc0-17-g877fd03 and v2.0.0rc0-23-g263ff53 ("ssl-utils:
load RSA keys based on their modulus+exponent"), GnuTLS 2.12.0 is
needed.

Add a version check to cmake as well, tested on CentOS6 (with
pkg-config check disabled to verify the code path). Note that RHEL6
has GnuTLS 2.8.5 and thus SSL decryption with a RSA private key is no
longer supported on that version.

Change-Id: I99fdfe6790107f48629dd435794fe8880263063d
Reviewed-on: https://code.wireshark.org/review/11044
Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
This commit is contained in:
Peter Wu 2015-10-14 20:23:46 +02:00
parent 2ddd92b6f8
commit fe1ab42f16
3 changed files with 20 additions and 5 deletions

View File

@ -719,6 +719,8 @@ endif()
# GNU SSL/TLS support
if(ENABLE_GNUTLS)
set(PACKAGELIST ${PACKAGELIST} GNUTLS)
# Minimum version needed.
set(GNUTLS_OPTIONS "2.12.0")
endif()
# Kerberos

View File

@ -20,9 +20,9 @@ FindWSWinLibs("gnutls-.*" "GNUTLS_HINTS")
find_package(PkgConfig)
pkg_search_module(GNUTLS gnutls)
# sources include gnutls/gnutls.h, look for that location instead of gnutls.h.
FIND_PATH(GNUTLS_INCLUDE_DIR
NAMES
gnutls.h
gnutls/gnutls.h
PATH_SUFFIXES
include
@ -42,10 +42,23 @@ FIND_LIBRARY(GNUTLS_LIBRARY
"${GNUTLS_HINTS}/bin"
)
# On systems without pkg-config (e.g. Windows), search its header
# (available since GnuTLS 0.1.3)
if(NOT GNUTLS_VERSION)
if(GNUTLS_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+GNUTLS_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${GNUTLS_INCLUDE_DIR}/gnutls/gnutls.h" GNUTLS_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1" GNUTLS_VERSION "${GNUTLS_VERSION}")
unset(_version_regex)
endif()
endif()
# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
# all listed variables are TRUE
# all listed variables are TRUE and the requested version matches.
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNUTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNUTLS
REQUIRED_VARS GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR
VERSION_VAR GNUTLS_VERSION)
IF(GNUTLS_FOUND)
SET( GNUTLS_LIBRARIES ${GNUTLS_LIBRARY} )

View File

@ -578,8 +578,8 @@ if test "x$with_gnutls" = "xyes"; then
)
if test "x$have_license_compatible_gnutls" != "xyes"; then
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 1.2.0 gnutls < 3],
[ have_license_compatible_gnutls="yes" ] , [ echo "GnuTLS >= 1.2.0, < 3.0 not found " ]
PKG_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.0 gnutls < 3],
[ have_license_compatible_gnutls="yes" ] , [ echo "GnuTLS >= 2.12.0, < 3.0 not found " ]
)
fi