So, require 3.5.1. */
#if GNUTLS_VERSION_NUMBER >= 0x030501
# define HAVE_GNUTLS_AEAD
+#else
+/* gnutls_cipher_get_tag_size was introduced in 3.2.0, but it's only
+ relevant for AEAD ciphers. */
+# define gnutls_cipher_get_tag_size(cipher) 0
+#endif
+
+#if GNUTLS_VERSION_NUMBER < 0x030200
+/* gnutls_cipher_get_iv_size was introduced in 3.2.0. For the ciphers
+ available in previous versions, block size is equivalent. */
+#define gnutls_cipher_get_iv_size(cipher) gnutls_cipher_get_block_size (cipher)
+#endif
+
+#if GNUTLS_VERSION_NUMBER < 0x030202
+/* gnutls_digest_list and gnutls_digest_get_name were added in 3.2.2.
+ For previous versions, the mac algorithms are equivalent. */
+# define gnutls_digest_list() ((const gnutls_digest_algorithm_t *) gnutls_mac_list ())
+# define gnutls_digest_get_name(id) gnutls_mac_get_name ((gnutls_mac_algorithm_t) id)
#endif
/* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was
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));
+# ifndef gnutls_digest_list
DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void));
+# endif
+# ifndef gnutls_digest_get_name
DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t));
+# endif
DEF_DLL_FN (gnutls_cipher_algorithm_t *, gnutls_cipher_list, (void));
+# ifndef gnutls_cipher_get_iv_size
DEF_DLL_FN (int, gnutls_cipher_get_iv_size, (gnutls_cipher_algorithm_t));
+# endif
DEF_DLL_FN (size_t, gnutls_cipher_get_key_size, (gnutls_cipher_algorithm_t));
DEF_DLL_FN (int, gnutls_cipher_get_block_size, (gnutls_cipher_algorithm_t));
+# ifndef gnutls_cipher_get_tag_size
DEF_DLL_FN (int, gnutls_cipher_get_tag_size, (gnutls_cipher_algorithm_t));
+# endif
DEF_DLL_FN (int, gnutls_cipher_init,
(gnutls_cipher_hd_t *, gnutls_cipher_algorithm_t,
const gnutls_datum_t *, const gnutls_datum_t *));
LOAD_DLL_FN (library, gnutls_mac_get_nonce_size);
# endif
LOAD_DLL_FN (library, gnutls_mac_get_key_size);
+# ifndef gnutls_digest_list
LOAD_DLL_FN (library, gnutls_digest_list);
+# endif
+# ifndef gnutls_digest_get_name
LOAD_DLL_FN (library, gnutls_digest_get_name);
+# endif
LOAD_DLL_FN (library, gnutls_cipher_list);
+# ifndef gnutls_cipher_get_iv_size
LOAD_DLL_FN (library, gnutls_cipher_get_iv_size);
+# endif
LOAD_DLL_FN (library, gnutls_cipher_get_key_size);
LOAD_DLL_FN (library, gnutls_cipher_get_block_size);
+# ifndef gnutls_cipher_get_tag_size
LOAD_DLL_FN (library, gnutls_cipher_get_tag_size);
+# endif
LOAD_DLL_FN (library, gnutls_cipher_init);
LOAD_DLL_FN (library, gnutls_cipher_set_iv);
LOAD_DLL_FN (library, gnutls_cipher_encrypt2);
# 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
+# ifndef gnutls_digest_list
+# define gnutls_digest_list fn_gnutls_digest_list
+# endif
+# ifndef gnutls_digest_get_name
+# define gnutls_digest_get_name fn_gnutls_digest_get_name
+# endif
# define gnutls_cipher_list fn_gnutls_cipher_list
-# define gnutls_cipher_get_iv_size fn_gnutls_cipher_get_iv_size
+# ifndef gnutls_cipher_get_iv_size
+# define gnutls_cipher_get_iv_size fn_gnutls_cipher_get_iv_size
+# endif
# define gnutls_cipher_get_key_size fn_gnutls_cipher_get_key_size
# define gnutls_cipher_get_block_size fn_gnutls_cipher_get_block_size
-# define gnutls_cipher_get_tag_size fn_gnutls_cipher_get_tag_size
+# ifndef gnutls_cipher_get_tag_size
+# define gnutls_cipher_get_tag_size fn_gnutls_cipher_get_tag_size
+# endif
# define gnutls_cipher_init fn_gnutls_cipher_init
# define gnutls_cipher_set_iv fn_gnutls_cipher_set_iv
# define gnutls_cipher_encrypt2 fn_gnutls_cipher_encrypt2