From d2c6858e87b92bfcffe12155f8145ab7c2db0b41 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 29 Nov 2022 22:41:06 +0000 Subject: Use gnutls_digest_get_id if supported by the GnuTLS library. --- src/modules/extra/m_ssl_gnutls.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/modules') diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 94baab642..e09098825 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -198,9 +198,12 @@ namespace GnuTLS { // As older versions of gnutls can't do this, let's disable it where needed. #ifdef GNUTLS_HAS_MAC_GET_ID +# if INSPIRCD_GNUTLS_HAS_VERSION(3, 2, 2) + hash = gnutls_digest_get_id(hashname.c_str()); +# else // As gnutls_digest_algorithm_t and gnutls_mac_algorithm_t are mapped 1:1, we can do this - // There is no gnutls_dig_get_id() at the moment, but it may come later hash = (gnutls_digest_algorithm_t)gnutls_mac_get_id(hashname.c_str()); +# endif if (hash == GNUTLS_DIG_UNKNOWN) throw Exception("Unknown hash type " + hashname); -- cgit v1.3.1-10-gc9f91