Merge pull request #1357 from alex/rename-bn-cntx
Renamed _bn_ctx_manager().
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 0b129d1..9d767ae 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -1049,12 +1049,12 @@
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 @@
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 51fc8f4..611dba2 100644
--- a/cryptography/hazmat/backends/openssl/ec.py
+++ b/cryptography/hazmat/backends/openssl/ec.py
@@ -38,7 +38,7 @@
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