Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit f692538

Browse files
committed
Replace _OpenSSLECCurve with crypto.get_elliptic_curve
1 parent 9558236 commit f692538

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

synapse/crypto/context_factory.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# limitations under the License.
1414

1515
from twisted.internet import ssl
16-
from OpenSSL import SSL
17-
from twisted.internet._sslverify import _OpenSSLECCurve, _defaultCurveName
16+
from OpenSSL import SSL, crypto
17+
from twisted.internet._sslverify import _defaultCurveName
1818

1919
import logging
2020

@@ -32,8 +32,11 @@ def __init__(self, config):
3232
@staticmethod
3333
def configure_context(context, config):
3434
try:
35-
_ecCurve = _OpenSSLECCurve(_defaultCurveName)
36-
_ecCurve.addECKeyToContext(context)
35+
# This was removed in https://github.com/twisted/twisted/pull/928
36+
# _ecCurve = _OpenSSLECCurve()
37+
_evCurve = crypto.get_elliptic_curve(_defaultCurveName)
38+
context.set_tmp_ecdh(_evCurve)
39+
3740
except Exception:
3841
logger.exception("Failed to enable elliptic curve for TLS")
3942
context.set_options(SSL.OP_NO_SSLv2 | SSL.OP_NO_SSLv3)

0 commit comments

Comments
 (0)