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

Commit 2ad3fc3

Browse files
Half-Shotrichvdh
authored andcommitted
Fixes #3135 - Replace _OpenSSLECCurve with crypto.get_elliptic_curve (#3157)
fixes #3135 Signed-off-by: Will Hunt will@half-shot.uk
1 parent cead75f commit 2ad3fc3

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

synapse/crypto/context_factory.py

Lines changed: 5 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,9 @@ def __init__(self, config):
3232
@staticmethod
3333
def configure_context(context, config):
3434
try:
35-
_ecCurve = _OpenSSLECCurve(_defaultCurveName)
36-
_ecCurve.addECKeyToContext(context)
35+
_ecCurve = crypto.get_elliptic_curve(_defaultCurveName)
36+
context.set_tmp_ecdh(_ecCurve)
37+
3738
except Exception:
3839
logger.exception("Failed to enable elliptic curve for TLS")
3940
context.set_options(SSL.OP_NO_SSLv2 | SSL.OP_NO_SSLv3)

synapse/python_dependencies.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,11 @@
3939
"signedjson>=1.0.0": ["signedjson>=1.0.0"],
4040
"pynacl>=1.2.1": ["nacl>=1.2.1", "nacl.bindings"],
4141
"service_identity>=1.0.0": ["service_identity>=1.0.0"],
42+
"Twisted>=16.0.0": ["twisted>=16.0.0"],
4243

43-
# we break under Twisted 18.4
44-
# (https://github.com/matrix-org/synapse/issues/3135)
45-
"Twisted>=16.0.0,<18.4": ["twisted>=16.0.0"],
44+
# We use crypto.get_elliptic_curve which is only supported in >=0.15
45+
"pyopenssl>=0.15": ["OpenSSL>=0.15"],
4646

47-
"pyopenssl>=0.14": ["OpenSSL>=0.14"],
4847
"pyyaml": ["yaml"],
4948
"pyasn1": ["pyasn1"],
5049
"daemonize": ["daemonize"],

0 commit comments

Comments
 (0)