mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Work around the deprecation of the old curve API in OpenSSL 3.0.0.
This commit is contained in:
parent
087b0b54f9
commit
ad28a2bc5f
@ -102,7 +102,7 @@
|
||||
|
||||
#else
|
||||
# define INSPIRCD_OPENSSL_OPAQUE_BIO
|
||||
# if OPENSSL_VERSION_NUMBER > 0x30000000L
|
||||
# if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
# define INSPIRCD_OPENSSL_AUTO_DH
|
||||
# endif
|
||||
#endif
|
||||
@ -207,9 +207,14 @@ namespace OpenSSL
|
||||
void SetECDH(const std::string& curvename)
|
||||
{
|
||||
int nid = OBJ_sn2nid(curvename.c_str());
|
||||
if (nid == 0)
|
||||
if (nid == NID_undef)
|
||||
throw Exception("Unknown curve: " + curvename);
|
||||
|
||||
# if OPENSSL_VERSION_NUMBER >= 0x10101000L
|
||||
ERR_clear_error();
|
||||
if (!SSL_CTX_set1_groups(ctx, &nid, 1))
|
||||
throw Exception("Couldn't set ECDH curve");
|
||||
# else
|
||||
EC_KEY* eckey = EC_KEY_new_by_curve_name(nid);
|
||||
if (!eckey)
|
||||
throw Exception("Unable to create EC key object");
|
||||
@ -219,6 +224,7 @@ namespace OpenSSL
|
||||
EC_KEY_free(eckey);
|
||||
if (!ret)
|
||||
throw Exception("Couldn't set ECDH parameters");
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -456,7 +462,7 @@ namespace OpenSSL
|
||||
}
|
||||
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
const std::string curvename = tag->getString("ecdhcurve", "prime256v1", 1);
|
||||
const std::string curvename = tag->getString("ecdhcurve", "prime256v1");
|
||||
if (!curvename.empty())
|
||||
ctx.SetECDH(curvename);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user