Remove libgcrypt as dependency

GnuTLS used gcrypt as backend but switched in ~2011 to nettle.
Thus we don't need to/shouldn't depend on it.
This commit is contained in:
Peter Keresztes Schmidt 2021-05-24 13:36:26 +02:00
parent 2e61ee4c95
commit b81689aa3f
12 changed files with 18 additions and 64 deletions

View File

@ -53,7 +53,7 @@ jobs:
git submodule update --init --recursive
sudo apt-get update
sudo apt-get install libavdevice-dev libavcodec-dev libavformat-dev libavutil-dev libswresample-dev libswscale-dev libjwt-gnutls-dev
sudo apt-get install libbz2-dev libgcrypt20-dev libcurl4-gnutls-dev libjpeg-turbo8-dev libturbojpeg0-dev
sudo apt-get install libbz2-dev libcurl4-gnutls-dev libjpeg-turbo8-dev libturbojpeg0-dev
sudo apt-get install default-libmysqlclient-dev libpcre3-dev libpolkit-gobject-1-dev libv4l-dev libvlc-dev
sudo apt-get install libdate-manip-perl libdbd-mysql-perl libphp-serialization-perl libsys-mmap-perl
sudo apt-get install libwww-perl libdata-uuid-perl libssl-dev libcrypt-eksblowfish-perl libdata-entropy-perl

View File

@ -411,23 +411,6 @@ else()
set(optlibsnotfound "${optlibsnotfound} PCRE")
endif()
# gcrypt (using find_library and find_path)
find_library(GCRYPT_LIBRARIES gcrypt)
if(GCRYPT_LIBRARIES)
set(HAVE_LIBGCRYPT 1)
list(APPEND ZM_BIN_LIBS "${GCRYPT_LIBRARIES}")
find_path(GCRYPT_INCLUDE_DIR gcrypt.h)
if(GCRYPT_INCLUDE_DIR)
include_directories("${GCRYPT_INCLUDE_DIR}")
set(CMAKE_REQUIRED_INCLUDES "${GCRYPT_INCLUDE_DIR}")
endif()
mark_as_advanced(FORCE GCRYPT_LIBRARIES GCRYPT_INCLUDE_DIR)
check_include_file("gcrypt.h" HAVE_GCRYPT_H)
set(optlibsfound "${optlibsfound} GCrypt")
else()
set(optlibsnotfound "${optlibsnotfound} GCrypt")
endif()
# mysqlclient (using find_library and find_path)
find_library(MYSQLCLIENT_LIBRARIES mysqlclient PATH_SUFFIXES mysql)
if(MYSQLCLIENT_LIBRARIES)
@ -708,10 +691,9 @@ if((NOT HAVE_MD5_OPENSSL) AND (NOT HAVE_DECL_GNUTLS_FINGERPRINT))
none were found - hashed authentication will not be available")
endif()
# Dirty fix for zm_user only using openssl's md5 if gnutls and gcrypt are not available.
# Dirty fix for zm_user only using openssl's md5 if gnutls is not available.
# This needs to be fixed in zm_user.[h,cpp] but such fix will also require changes to configure.ac
if(HAVE_LIBCRYPTO AND HAVE_OPENSSL_MD5_H AND HAVE_MD5_OPENSSL)
set(HAVE_GCRYPT_H 0)
set(HAVE_GNUTLS_OPENSSL_H 0)
endif()

View File

@ -14,7 +14,6 @@ Build-Depends: debhelper, sphinx-doc, dh-linktree, dh-apache2
,ffmpeg
,net-tools
,libbz2-dev
,libgcrypt20-dev
,libcurl4-gnutls-dev
,libturbojpeg0-dev
,default-libmysqlclient-dev | libmysqlclient-dev | libmariadbclient-dev-compat

View File

@ -17,7 +17,7 @@ Build-Depends: debhelper (>= 9), cmake
, libnetpbm10-dev
, libvlccore-dev, libvlc-dev
, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev
, libgcrypt11-dev, libpolkit-gobject-1-dev
, libpolkit-gobject-1-dev
, libphp-serialization-perl
, libdate-manip-perl, libmime-lite-perl, libmime-tools-perl, libdbd-mysql-perl
, libwww-perl, libarchive-tar-perl, libarchive-zip-perl, libdevice-serialport-perl

View File

@ -27,7 +27,7 @@ Source: ZoneMinder-%{version}.tar.gz
BuildRequires: cmake polkit-devel
BuildRequires: perl-DBI perl-DBD-mysql perl-Date-Manip perl-Sys-Mmap
BuildRequires: libjpeg62 libjpeg62-devel libmysqld-devel libSDL-devel libgcrypt-devel libgnutls-devel
BuildRequires: libjpeg62 libjpeg62-devel libmysqld-devel libSDL-devel libgnutls-devel
BuildRequires: libffmpeg-devel x264
BuildRequires: pcre-devel w32codec-all

View File

@ -15,7 +15,7 @@ Build-Depends: debhelper (>= 9), po-debconf (>= 1.0), autoconf, automake, libtoo
, libdevice-serialport-perl, libarchive-zip-perl, libmime-lite-perl
, libvlccore-dev, libvlc-dev
, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev
, libgcrypt11-dev | libgcrypt20-dev, libpolkit-gobject-1-dev
, libpolkit-gobject-1-dev
, libdbi-perl, libnet-sftp-foreign-perl, libexpect-perl, libmime-tools-perl
Standards-Version: 3.9.6
Homepage: http://www.zoneminder.com/

View File

@ -14,7 +14,6 @@ Build-Depends: debhelper (>= 9), dh-systemd, python3-sphinx, apache2-dev, dh-lin
,ffmpeg | libav-tools
,net-tools
,libbz2-dev
,libgcrypt-dev | libgcrypt11-dev
,libcurl4-gnutls-dev
,libgnutls-openssl-dev
,libjpeg8-dev | libjpeg9-dev | libjpeg62-turbo-dev

View File

@ -13,7 +13,6 @@ Build-Depends: debhelper (>= 12), sphinx-doc, python3-sphinx, dh-linktree, dh-ap
,ffmpeg
,net-tools
,libbz2-dev
,libgcrypt20-dev
,libcurl4-gnutls-dev
,libjpeg-turbo8-dev | libjpeg62-turbo-dev | libjpeg8-dev | libjpeg9-dev
,libturbojpeg0-dev

View File

@ -22,26 +22,16 @@
#include "zm_utils.h"
#include <cassert>
#include <cstring>
#include <utility>
namespace zm {
Authenticator::Authenticator( const std::string &username, const std::string &password) :
fCnonce("0a4f113b"),
fUsername(username),
fPassword(password)
{
#ifdef HAVE_GCRYPT_H
// Special initialisation for libgcrypt
if ( !gcry_check_version(GCRYPT_VERSION) ) {
Fatal("Unable to initialise libgcrypt");
}
gcry_control( GCRYCTL_DISABLE_SECMEM, 0 );
gcry_control( GCRYCTL_INITIALIZATION_FINISHED, 0 );
#endif // HAVE_GCRYPT_H
fAuthMethod = AUTH_UNDEFINED;
nc = 1;
}
Authenticator::Authenticator(std::string username, std::string password)
: fAuthMethod(AUTH_UNDEFINED),
fCnonce("0a4f113b"),
fUsername(std::move(username)),
fPassword(std::move(password)),
nc(1) {}
Authenticator::~Authenticator() {
reset();

View File

@ -26,18 +26,16 @@
#include <gnutls/gnutls.h>
#endif
#if HAVE_GCRYPT_H
#include <gcrypt.h>
#elif HAVE_LIBCRYPTO
#if HAVE_LIBCRYPTO
#include <openssl/md5.h>
#endif // HAVE_GCRYPT_H || HAVE_LIBCRYPTO
#endif // HAVE_LIBCRYPTO
namespace zm {
namespace zm {
enum AuthMethod { AUTH_UNDEFINED = 0, AUTH_BASIC = 1, AUTH_DIGEST = 2 };
class Authenticator {
public:
Authenticator(const std::string &username, const std::string &password);
Authenticator(std::string username, std::string password);
virtual ~Authenticator();
void reset();

View File

@ -29,11 +29,9 @@
#include <gnutls/gnutls.h>
#endif
#if HAVE_GCRYPT_H
#include <gcrypt.h>
#elif HAVE_LIBCRYPTO
#if HAVE_LIBCRYPTO
#include <openssl/md5.h>
#endif // HAVE_GCRYPT_H || HAVE_LIBCRYPTO
#endif // HAVE_LIBCRYPTO
User::User() {
id = 0;
@ -192,15 +190,6 @@ User *zmLoadTokenUser(const std::string &jwt_token_str, bool use_remote_addr) {
// Function to validate an authentication string
User *zmLoadAuthUser(const char *auth, bool use_remote_addr) {
#if HAVE_DECL_MD5 || HAVE_DECL_GNUTLS_FINGERPRINT
#ifdef HAVE_GCRYPT_H
// Special initialisation for libgcrypt
if ( !gcry_check_version(GCRYPT_VERSION) ) {
Fatal("Unable to initialise libgcrypt");
}
gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
#endif // HAVE_GCRYPT_H
const char *remote_addr = "";
if ( use_remote_addr ) {
remote_addr = getenv("REMOTE_ADDR");

View File

@ -35,8 +35,6 @@
#cmakedefine HAVE_PTHREAD_H
#cmakedefine HAVE_LIBPCRE 1
#cmakedefine HAVE_PCRE_H 1
#cmakedefine HAVE_LIBGCRYPT 1
#cmakedefine HAVE_GCRYPT_H 1
#cmakedefine HAVE_LIBGNUTLS 1
#cmakedefine HAVE_GNUTLS_GNUTLS_H 1
#cmakedefine HAVE_LIBMYSQLCLIENT 1