build: Drop gcrypt support
authorDiego Biurrun <diego@biurrun.de>
Wed, 23 Nov 2016 15:42:00 +0000 (16:42 +0100)
committerDiego Biurrun <diego@biurrun.de>
Fri, 25 Nov 2016 17:46:53 +0000 (18:46 +0100)
GnuTLS in combination with gcrypt has been deprecated since 2010.

configure
libavformat/hlsenc.c
libavformat/rtmpdh.c
libavformat/rtmpdh.h
libavformat/tls_gnutls.c

index bfae451..d0bec32 100755 (executable)
--- 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
index 625531b..05c9adb 100644 (file)
@@ -24,9 +24,7 @@
 
 #include <config.h>
 
-#if CONFIG_GCRYPT
-#include <gcrypt.h>
-#elif CONFIG_OPENSSL
+#if CONFIG_OPENSSL
 #include <openssl/rand.h>
 #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);
index 593b2b1..0593eac 100644 (file)
@@ -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)
index 5233de0..b4d6121 100644 (file)
 #include <gmp.h>
 
 typedef mpz_ptr FFBigNum;
-#elif CONFIG_GCRYPT
-#include <gcrypt.h>
-
-typedef gcry_mpi_t FFBigNum;
-
 #elif CONFIG_OPENSSL
 #include <openssl/bn.h>
 #include <openssl/dh.h>
index 3e29a45..f8a612a 100644 (file)
 #include "libavutil/opt.h"
 #include "libavutil/parseutils.h"
 
-#if HAVE_THREADS && GNUTLS_VERSION_NUMBER <= 0x020b00
-#include <gcrypt.h>
-#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();
 }