aboutsummaryrefslogtreecommitdiffstats
path: root/src/modules
diff options
context:
space:
mode:
authorGravatar Sadie Powell2022-01-20 17:22:34 +0000
committerGravatar Sadie Powell2022-01-21 13:11:28 +0000
commit5faa39f6719dfadad979d56d7db1bef06ca4ffce (patch)
tree8258826530033b6dc7475a2736347656b74a9253 /src/modules
parentFix parsing a LIST request with both a match and inverted match. (diff)
downloadinspircd++-5faa39f6719dfadad979d56d7db1bef06ca4ffce.tar.gz
inspircd++-5faa39f6719dfadad979d56d7db1bef06ca4ffce.tar.bz2
inspircd++-5faa39f6719dfadad979d56d7db1bef06ca4ffce.zip
Work around the deprecation of manual DH params in GnuTLS 3.5.6.
As of this version specifying custom DH parameters is deprecated and should not be used. Instead, a default (secure) DH parameters will be used.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 256f1df6c..471505a11 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -94,6 +94,10 @@
# include <gcrypt.h>
#endif
+#if INSPIRCD_GNUTLS_HAS_VERSION(3, 5, 6)
+# define GNUTLS_AUTO_DH
+#endif
+
#ifdef _WIN32
# pragma comment(lib, "libgnutls-30.lib")
#endif
@@ -220,6 +224,7 @@ namespace GnuTLS
gnutls_digest_algorithm_t get() const { return hash; }
};
+#ifndef GNUTLS_AUTO_DH
class DHParams
{
gnutls_dh_params_t dh_params;
@@ -246,6 +251,7 @@ namespace GnuTLS
const gnutls_dh_params_t& get() const { return dh_params; }
};
+#endif
class X509Key
{
@@ -443,9 +449,11 @@ namespace GnuTLS
class CertCredentials
{
+#ifndef GNUTLS_AUTO_DH
/** DH parameters associated with these credentials
*/
SMART_PTR<DHParams> dh;
+#endif
protected:
gnutls_certificate_credentials_t cred;
@@ -468,6 +476,7 @@ namespace GnuTLS
gnutls_credentials_set(sess, GNUTLS_CRD_CERTIFICATE, cred);
}
+#ifndef GNUTLS_AUTO_DH
/** Set the given DH parameters to be used with these credentials
*/
void SetDH(SMART_PTR<DHParams>& DH)
@@ -475,6 +484,7 @@ namespace GnuTLS
dh = DH;
gnutls_certificate_set_dh_params(cred, dh->get());
}
+#endif
};
class X509Credentials : public CertCredentials
@@ -655,8 +665,10 @@ namespace GnuTLS
std::string certstr;
std::string keystr;
- SMART_PTR<DHParams> dh;
+#ifndef GNUTLS_AUTO_DH
+ SMART_PTR<DHParams> dh;
+#endif
std::string priostr;
unsigned int mindh;
std::string hashstr;
@@ -668,7 +680,9 @@ namespace GnuTLS
: name(profilename)
, certstr(ReadFile(tag->getString("certfile", "cert.pem", 1)))
, keystr(ReadFile(tag->getString("keyfile", "key.pem", 1)))
+#ifndef GNUTLS_AUTO_DH
, dh(DHParams::Import(ReadFile(tag->getString("dhfile", "dhparams.pem", 1))))
+#endif
, priostr(GetPrioStr(profilename, tag))
, mindh(tag->getUInt("mindhbits", 1024))
, hashstr(tag->getString("hash", "md5", 1))
@@ -703,7 +717,9 @@ namespace GnuTLS
, outrecsize(config.outrecsize)
, requestclientcert(config.requestclientcert)
{
+#ifndef GNUTLS_AUTO_DH
x509cred.SetDH(config.dh);
+#endif
x509cred.SetCA(config.ca, config.crl);
}
/** Set up the given session with the settings in this profile