-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fixes #3135 - Replace _OpenSSLECCurve with crypto.get_elliptic_curve #3157
Changes from 1 commit
f692538
7ae89bb
24bfcaf
55bd158
fff7c33
952d0ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,8 +13,8 @@ | |
# limitations under the License. | ||
|
||
from twisted.internet import ssl | ||
from OpenSSL import SSL | ||
from twisted.internet._sslverify import _OpenSSLECCurve, _defaultCurveName | ||
from OpenSSL import SSL, crypto | ||
from twisted.internet._sslverify import _defaultCurveName | ||
|
||
import logging | ||
|
||
|
@@ -32,8 +32,11 @@ def __init__(self, config): | |
@staticmethod | ||
def configure_context(context, config): | ||
try: | ||
_ecCurve = _OpenSSLECCurve(_defaultCurveName) | ||
_ecCurve.addECKeyToContext(context) | ||
# This was removed in https://github.com/twisted/twisted/pull/928 | ||
# _ecCurve = _OpenSSLECCurve() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not much point in leaving it here as a comment, then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Left here mainly as a tombstone since it's a drop in replacement mostly, but to be fair git serves that purpose. |
||
_evCurve = crypto.get_elliptic_curve(_defaultCurveName) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this appears to have been introduced in pyopenssl 0.15 - so at the very least we need to bump the requirement in python_dependencies.py. However, there is a problem in that debian jessie has 0.14. There is a newer version in backports though - @erikjohnston is it ok to rely on things in backports? Otherwise we might have to do some hackery dependent on the Twisted version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It is, though I think we do some foo to host the backported packages we need on our repo. I've just had a look at it seems that we're already hosting v0.16, so this is fine. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why is it called _evCurve now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Brain corrected EC to EV (work product is called EV, my bad) |
||
context.set_tmp_ecdh(_evCurve) | ||
|
||
except Exception: | ||
logger.exception("Failed to enable elliptic curve for TLS") | ||
context.set_options(SSL.OP_NO_SSLv2 | SSL.OP_NO_SSLv3) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if there is any way we can fix this gut-wrenching at the same time.