aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2014-09-26 18:28:49 -0400
committerAlex Gaynor <alex.gaynor@gmail.com>2014-09-26 18:28:49 -0400
commitc45cb7562ef06a9ed621680974abe6eca89ffcc4 (patch)
tree7cc946bdd7e5da9bf98dfd125476a4b7af00638e
parent28edb8fc4b045fc30a67e9c25817eeedd11ab78a (diff)
downloadcryptography-c45cb7562ef06a9ed621680974abe6eca89ffcc4.tar.gz
cryptography-c45cb7562ef06a9ed621680974abe6eca89ffcc4.tar.bz2
cryptography-c45cb7562ef06a9ed621680974abe6eca89ffcc4.zip
Renamed _bn_ctx_manager().
The existing name is confusing because it's ambigious about the fact that ctx belongs to bn or manager. The name doesn't need to say it's a manager anyways, so now it better describes what it does.
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py6
-rw-r--r--cryptography/hazmat/backends/openssl/ec.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 0b129d1a..9d767aef 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -1049,12 +1049,12 @@ class Backend(object):
return curve_nid
@contextmanager
- def _bn_ctx_manager(self):
+ def _tmp_bn_ctx(self):
bn_ctx = self._lib.BN_CTX_new()
assert bn_ctx != self._ffi.NULL
bn_ctx = self._ffi.gc(bn_ctx, self._lib.BN_CTX_free)
+ self._lib.BN_CTX_start(bn_ctx)
try:
- self._lib.BN_CTX_start(bn_ctx)
yield bn_ctx
finally:
self._lib.BN_CTX_end(bn_ctx)
@@ -1098,7 +1098,7 @@ class Backend(object):
assert set_func and get_func
- with self._bn_ctx_manager() as bn_ctx:
+ with self._tmp_bn_ctx() as bn_ctx:
check_x = self._lib.BN_CTX_get(bn_ctx)
check_y = self._lib.BN_CTX_get(bn_ctx)
diff --git a/cryptography/hazmat/backends/openssl/ec.py b/cryptography/hazmat/backends/openssl/ec.py
index 51fc8f4b..611dba2c 100644
--- a/cryptography/hazmat/backends/openssl/ec.py
+++ b/cryptography/hazmat/backends/openssl/ec.py
@@ -38,7 +38,7 @@ def _truncate_digest_for_ecdsa(ec_key_cdata, digest, backend):
group = _lib.EC_KEY_get0_group(ec_key_cdata)
- with backend._bn_ctx_manager() as bn_ctx:
+ with backend._tmp_bn_ctx() as bn_ctx:
order = _lib.BN_CTX_get(bn_ctx)
assert order != _ffi.NULL