]> git.eshelyaron.com Git - emacs.git/commitdiff
Avoid link errors with older versions of GnuTLS
authorEli Zaretskii <eliz@gnu.org>
Sat, 15 Jul 2017 13:54:12 +0000 (16:54 +0300)
committerEli Zaretskii <eliz@gnu.org>
Sat, 15 Jul 2017 13:54:12 +0000 (16:54 +0300)
* src/gnutls.c (Fgnutls_ciphers, gnutls_symmetric_aead)
(Fgnutls_macs, Fgnutls_digests): Conditionally compile code that
calls GnuTLS functions which might be unavailable in older
versions of GnuTLS.

src/gnutls.c

index 5e14a3af333d0050db7c3e9d04fd74b928a439e1..e6f01a9cfe1c8a36594b05ecbc27d6f6c598f731 100644 (file)
@@ -1852,6 +1852,7 @@ The alist key is the cipher name. */)
 {
   Lisp_Object ciphers = Qnil;
 
+#ifdef HAVE_GNUTLS3_CIPHER
   const gnutls_cipher_algorithm_t *gciphers = gnutls_cipher_list ();
   for (ptrdiff_t pos = 0; gciphers[pos] != GNUTLS_CIPHER_NULL; pos++)
     {
@@ -1877,6 +1878,7 @@ The alist key is the cipher name. */)
 
       ciphers = Fcons (cp, ciphers);
     }
+#endif
 
   return ciphers;
 }
@@ -2176,6 +2178,7 @@ name. */)
   (void)
 {
   Lisp_Object mac_algorithms = Qnil;
+#ifdef HAVE_GNUTLS3_HMAC
   const gnutls_mac_algorithm_t *macs = gnutls_mac_list ();
   for (ptrdiff_t pos = 0; macs[pos] != 0; pos++)
     {
@@ -2197,6 +2200,7 @@ name. */)
                               make_number (gnutls_mac_get_nonce_size (gma)));
       mac_algorithms = Fcons (mp, mac_algorithms);
     }
+#endif
 
   return mac_algorithms;
 }
@@ -2210,6 +2214,7 @@ method name. */)
   (void)
 {
   Lisp_Object digest_algorithms = Qnil;
+#ifdef HAVE_GNUTLS3_DIGEST
   const gnutls_digest_algorithm_t *digests = gnutls_digest_list ();
   for (ptrdiff_t pos = 0; digests[pos] != 0; pos++)
     {
@@ -2226,6 +2231,7 @@ method name. */)
 
       digest_algorithms = Fcons (mp, digest_algorithms);
     }
+#endif
 
   return digest_algorithms;
 }