From e122b12c88487ac8766ff4eb071856b0666f0134 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Wed, 23 Nov 2016 16:42:00 +0100 Subject: [PATCH] build: Drop gcrypt support GnuTLS in combination with gcrypt has been deprecated since 2010. --- configure | 8 ++------ libavformat/hlsenc.c | 9 ++------- libavformat/rtmpdh.c | 18 ------------------ libavformat/rtmpdh.h | 5 ----- libavformat/tls_gnutls.c | 10 ---------- 5 files changed, 4 insertions(+), 46 deletions(-) diff --git a/configure b/configure index bfae451257..d0bec323c1 100755 --- a/configure +++ b/configure @@ -1700,7 +1700,6 @@ CONFIG_EXTRA=" flacdsp fmtconvert g722dsp - gcrypt gmp golomb gplv3 @@ -2387,7 +2386,7 @@ xcbgrab_indev_deps="libxcb" # protocols ffrtmpcrypt_protocol_deps="!librtmp_protocol" -ffrtmpcrypt_protocol_deps_any="gcrypt gmp openssl" +ffrtmpcrypt_protocol_deps_any="gmp openssl" ffrtmpcrypt_protocol_select="tcp_protocol" ffrtmphttp_protocol_deps="!librtmp_protocol" ffrtmphttp_protocol_select="http_protocol" @@ -4717,10 +4716,7 @@ enabled openssl && { { check_pkg_config openssl openssl/ssl.h OPENSSL_ check_lib openssl/ssl.h SSL_library_init -lssl -lcrypto -lws2_32 -lgdi32 || die "ERROR: openssl not found"; } -if enabled gnutls; then - { check_lib gmp.h mpz_export -lgmp && enable gmp; } || - { check_lib gcrypt.h gcry_mpi_new -lgcrypt && enable gcrypt; } -fi +enabled gnutls && check_lib gmp.h mpz_export -lgmp && enable gmp # libdc1394 check if enabled libdc1394; then diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 625531b881..05c9adb959 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -24,9 +24,7 @@ #include -#if CONFIG_GCRYPT -#include -#elif CONFIG_OPENSSL +#if CONFIG_OPENSSL #include #endif @@ -86,10 +84,7 @@ typedef struct HLSContext { static int randomize(uint8_t *buf, int len) { -#if CONFIG_GCRYPT - gcry_randomize(buf, len, GCRY_VERY_STRONG_RANDOM); - return 0; -#elif CONFIG_OPENSSL +#if CONFIG_OPENSSL if (RAND_bytes(buf, len)) return 0; return AVERROR(EIO); diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c index 593b2b1edd..0593eac943 100644 --- a/libavformat/rtmpdh.c +++ b/libavformat/rtmpdh.c @@ -107,24 +107,6 @@ static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) mpz_powm(bn, y, q, p); return 0; } -#elif CONFIG_GCRYPT -#define bn_new(bn) bn = gcry_mpi_new(1) -#define bn_free(bn) gcry_mpi_release(bn) -#define bn_set_word(bn, w) gcry_mpi_set_ui(bn, w) -#define bn_cmp(a, b) gcry_mpi_cmp(a, b) -#define bn_copy(to, from) gcry_mpi_set(to, from) -#define bn_sub_word(bn, w) gcry_mpi_sub_ui(bn, bn, w) -#define bn_cmp_1(bn) gcry_mpi_cmp_ui(bn, 1) -#define bn_num_bytes(bn) (gcry_mpi_get_nbits(bn) + 7) / 8 -#define bn_bn2bin(bn, buf, len) gcry_mpi_print(GCRYMPI_FMT_USG, buf, len, NULL, bn) -#define bn_bin2bn(bn, buf, len) gcry_mpi_scan(&bn, GCRYMPI_FMT_USG, buf, len, NULL) -#define bn_hex2bn(bn, buf, ret) ret = (gcry_mpi_scan(&bn, GCRYMPI_FMT_HEX, buf, 0, 0) == 0) -#define bn_random(bn, num_bits) gcry_mpi_randomize(bn, num_bits, GCRY_WEAK_RANDOM) -static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) -{ - gcry_mpi_powm(bn, y, q, p); - return 0; -} #elif CONFIG_OPENSSL #define bn_new(bn) bn = BN_new() #define bn_free(bn) BN_free(bn) diff --git a/libavformat/rtmpdh.h b/libavformat/rtmpdh.h index 5233de0905..b4d6121d85 100644 --- a/libavformat/rtmpdh.h +++ b/libavformat/rtmpdh.h @@ -30,11 +30,6 @@ #include typedef mpz_ptr FFBigNum; -#elif CONFIG_GCRYPT -#include - -typedef gcry_mpi_t FFBigNum; - #elif CONFIG_OPENSSL #include #include diff --git a/libavformat/tls_gnutls.c b/libavformat/tls_gnutls.c index 3e29a45ce4..f8a612ad9b 100644 --- a/libavformat/tls_gnutls.c +++ b/libavformat/tls_gnutls.c @@ -35,12 +35,6 @@ #include "libavutil/opt.h" #include "libavutil/parseutils.h" -#if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00 -#include -#include "libavutil/thread.h" -GCRY_THREAD_OPTION_PTHREAD_IMPL; -#endif - typedef struct TLSContext { const AVClass *class; TLSShared tls_shared; @@ -52,10 +46,6 @@ typedef struct TLSContext { void ff_gnutls_init(void) { avpriv_lock_avformat(); -#if HAVE_THREADS && GNUTLS_VERSION_NUMBER < 0x020b00 - if (gcry_control(GCRYCTL_ANY_INITIALIZATION_P) == 0) - gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread); -#endif gnutls_global_init(); avpriv_unlock_avformat(); }