Require libgcrypt 1.4.2, add cmake version detection

libgcrypt 1.4.2 is required since since v1.11.0-rc1-2787-g23f9100
("Really add support for AEAD ciphers (GCM)") due to the use of
gcry_cipher_setctr. Bump the version in configure.ac too.

Add version check for gcrypt to cmake. Tested with CentOS 6 (cmake
2.8.12.2, libgcrypt 1.4.5).

Change-Id: I93c3ed902a764d9d14675779e866230d073c96d5
Reviewed-on: https://code.wireshark.org/review/11043
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Peter Wu 2015-10-14 19:40:24 +02:00 committed by Anders Broman
parent a86acb2ac7
commit 82ec0bb0fc
3 changed files with 17 additions and 5 deletions

View File

@ -702,6 +702,8 @@ endif()
# GNU crypto
if(ENABLE_GCRYPT)
set(PACKAGELIST ${PACKAGELIST} GCRYPT)
# Minimum version needed.
set(GCRYPT_OPTIONS "1.4.2")
endif()
# GNU SSL/TLS support

View File

@ -28,10 +28,20 @@ SET(GCRYPT_NAMES gcrypt libgcrypt-20)
FIND_LIBRARY(GCRYPT_LIBRARY NAMES ${GCRYPT_NAMES} libgcc_s_sjlj-1 HINTS "${GCRYPT_HINTS}/bin")
FIND_LIBRARY(GCRYPT_ERROR_LIBRARY NAMES gpg-error libgpg-error-0 libgpg-error6-0 HINTS "${GCRYPT_HINTS}/bin")
# Try to retrieve version from header if found (available since libgcrypt 1.3.0)
if(GCRYPT_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+GCRYPT_VERSION[ \t]+\"([^\"]+)\".*")
file(STRINGS "${GCRYPT_INCLUDE_DIR}/gcrypt.h" GCRYPT_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1" GCRYPT_VERSION "${GCRYPT_VERSION}")
unset(_version_regex)
endif()
# handle the QUIETLY and REQUIRED arguments and set GCRYPT_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(GCRYPT DEFAULT_MSG GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GCRYPT
REQUIRED_VARS GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR
VERSION_VAR GCRYPT_VERSION)
IF(GCRYPT_FOUND)
SET( GCRYPT_LIBRARIES ${GCRYPT_LIBRARY} ${GCRYPT_ERROR_LIBRARY})

View File

@ -607,9 +607,9 @@ AC_ARG_WITH([gcrypt],
[ with_gcrypt="$withval"; want_gcrypt="yes" ], with_gcrypt="yes")
if test "x$with_gcrypt" = "xyes"; then
AM_PATH_LIBGCRYPT(1.1.92,
AM_PATH_LIBGCRYPT(1.4.2,
[
echo "libgcrypt found, enabling ipsec decryption"
echo "libgcrypt found, enabling decryption for ipsec, ssl, etc."
AC_DEFINE(HAVE_LIBGCRYPT, 1, [Define to use libgcrypt])
gcrypt_message="yes"
]
@ -617,7 +617,7 @@ if test "x$with_gcrypt" = "xyes"; then
if test x$libgcrypt_config_prefix != x ; then
AC_MSG_ERROR([[libgcrypt not found; install libgcrypt-devel package for your system]])
else
echo "libgcrypt not found, disabling ipsec decryption"
echo "libgcrypt not found, disabling decryption for ipsec, ssl, etc."
gcrypt_message="no"
fi