diff options
| author | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2014-04-17 17:00:58 -0400 |
|---|---|---|
| committer | Jean-Paul Calderone <exarkun@twistedmatrix.com> | 2014-04-17 17:00:58 -0400 |
| commit | c48cd8177b3bf107073a2c075173722fdbeb809e (patch) | |
| tree | 2926393d2b001620731c5e8e248e0cde9d333480 /OpenSSL/SSL.py | |
| parent | 01787c44e1d78caad9bdd9d6854aa85ac6b75688 (diff) | |
| download | pyopenssl-c48cd8177b3bf107073a2c075173722fdbeb809e.tar.gz | |
Add a test for the failure condition of EC_KEY_new_by_curve_name
Diffstat (limited to 'OpenSSL/SSL.py')
| -rw-r--r-- | OpenSSL/SSL.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/OpenSSL/SSL.py b/OpenSSL/SSL.py index be636ae..86410c0 100644 --- a/OpenSSL/SSL.py +++ b/OpenSSL/SSL.py @@ -642,10 +642,13 @@ class Context(object): _lib.SSL_CTX_set_tmp_dh(self._context, dh) - def _set_tmp_ecdh_curve_by_nid(self, nid): + def _set_tmp_ecdh_curve_by_nid(self, name, nid): """ Select a curve to use by the OpenSSL NID associated with that curve. + :param name: The name of the curve identified by the NID. + :type name: str + :param nid: The OpenSSL NID to use. :type nid: int @@ -654,7 +657,7 @@ class Context(object): """ ecdh = _lib.EC_KEY_new_by_curve_name(nid) if ecdh == _ffi.NULL: - raise UnsupportedEllipticCurve(sn) + raise UnsupportedEllipticCurve(name) _lib.SSL_CTX_set_tmp_ecdh(self._context, ecdh) _lib.EC_KEY_free(ecdh) @@ -679,7 +682,7 @@ class Context(object): nid = _lib.OBJ_sn2nid(curve_name.encode('ascii')) if nid == _lib.NID_undef: raise UnknownObject(curve_name) - return self._set_tmp_ecdh_curve_by_nid(nid) + return self._set_tmp_ecdh_curve_by_nid(curve_name, nid) raise ECNotAvailable() |
