#include "coding.h"
#include "buffer.h"
-#if 0x030014 <= GNUTLS_VERSION_NUMBER
+#if GNUTLS_VERSION_NUMBER >= 0x030014
# define HAVE_GNUTLS_X509_SYSTEM_TRUST
#endif
The relevant fix seems to have been made in GnuTLS 3.5.1; see:
https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d
So, require 3.5.1. */
-#if 0x030501 <= GNUTLS_VERSION_NUMBER
+#if GNUTLS_VERSION_NUMBER >= 0x030501
# define HAVE_GNUTLS_AEAD
#endif
+/* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was
+ exported only since 3.3.0. */
+#if GNUTLS_VERSION_NUMBER >= 0x030300
+# define HAVE_GNUTLS_MAC_GET_NONCE_SIZE
+#endif
+
#ifdef HAVE_GNUTLS
# ifdef WINDOWSNT
# ifdef HAVE_GNUTLS3
DEF_DLL_FN (int, gnutls_rnd, (gnutls_rnd_level_t, void *, size_t));
DEF_DLL_FN (const gnutls_mac_algorithm_t *, gnutls_mac_list, (void));
+# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
DEF_DLL_FN (size_t, gnutls_mac_get_nonce_size, (gnutls_mac_algorithm_t));
+# endif
DEF_DLL_FN (size_t, gnutls_mac_get_key_size, (gnutls_mac_algorithm_t));
DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void));
DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t));
# ifdef HAVE_GNUTLS3
LOAD_DLL_FN (library, gnutls_rnd);
LOAD_DLL_FN (library, gnutls_mac_list);
+# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
LOAD_DLL_FN (library, gnutls_mac_get_nonce_size);
+# endif
LOAD_DLL_FN (library, gnutls_mac_get_key_size);
LOAD_DLL_FN (library, gnutls_digest_list);
LOAD_DLL_FN (library, gnutls_digest_get_name);
# ifdef HAVE_GNUTLS3
# define gnutls_rnd fn_gnutls_rnd
# define gnutls_mac_list fn_gnutls_mac_list
-# define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size
+# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
+# define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size
+# endif
# define gnutls_mac_get_key_size fn_gnutls_mac_get_key_size
# define gnutls_digest_list fn_gnutls_digest_list
# define gnutls_digest_get_name fn_gnutls_digest_get_name
# define gnutls_cipher_decrypt2 fn_gnutls_cipher_decrypt2
# define gnutls_cipher_deinit fn_gnutls_cipher_deinit
# ifdef HAVE_GNUTLS_AEAD
-# define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt
-# define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt
-# define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init
-# define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit
+# define gnutls_aead_cipher_encrypt fn_gnutls_aead_cipher_encrypt
+# define gnutls_aead_cipher_decrypt fn_gnutls_aead_cipher_decrypt
+# define gnutls_aead_cipher_init fn_gnutls_aead_cipher_init
+# define gnutls_aead_cipher_deinit fn_gnutls_aead_cipher_deinit
# endif
# define gnutls_hmac_init fn_gnutls_hmac_init
# define gnutls_hmac_get_len fn_gnutls_hmac_get_len
/* A symbol representing the GnuTLS MAC algorithm. */
Lisp_Object gma_symbol = intern (gnutls_mac_get_name (gma));
+ size_t nonce_size = 0;
+#ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
+ nonce_size = gnutls_mac_get_nonce_size (gma);
+#endif
Lisp_Object mp = listn (CONSTYPE_HEAP, 11, gma_symbol,
QCmac_algorithm_id, make_number (gma),
QCtype, Qgnutls_type_mac_algorithm,
make_number (gnutls_mac_get_key_size (gma)),
QCmac_algorithm_noncesize,
- make_number (gnutls_mac_get_nonce_size (gma)));
+ make_number (nonce_size));
mac_algorithms = Fcons (mp, mac_algorithms);
}