aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlyph <glyph@twistedmatrix.com>2015-06-27 15:16:25 -0700
committerGlyph <glyph@twistedmatrix.com>2015-06-27 15:16:25 -0700
commitdd53a5b216ac45620e7eee0c5a70e9dbfa33d08d (patch)
tree87ebb59231a7a45bb9aad87aa3cc6b0f59a26ed9 /src
parente03e9aaf17d70f7a891920d91ac8b79a30c64282 (diff)
downloadcryptography-dd53a5b216ac45620e7eee0c5a70e9dbfa33d08d.tar.gz
cryptography-dd53a5b216ac45620e7eee0c5a70e9dbfa33d08d.tar.bz2
cryptography-dd53a5b216ac45620e7eee0c5a70e9dbfa33d08d.zip
also retain method with a global reference
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/bindings/openssl/binding.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py
index 17dad4c1..d3999959 100644
--- a/src/cryptography/hazmat/bindings/openssl/binding.py
+++ b/src/cryptography/hazmat/bindings/openssl/binding.py
@@ -34,16 +34,18 @@ def osrandom_rand_status():
return 1
+method = ffi.new(
+ "RAND_METHOD*", dict(bytes=osrandom_rand_bytes,
+ pseudorand=osrandom_pseudo_rand_bytes,
+ status=osrandom_rand_status)
+)
+
+
def _register_osrandom_engine():
looked_up_engine = lib.ENGINE_by_id(_osrandom_engine_id)
if looked_up_engine != ffi.NULL:
return 2
- method = ffi.new(
- "RAND_METHOD*", dict(bytes=osrandom_rand_bytes,
- pseudorand=osrandom_pseudo_rand_bytes,
- status=osrandom_rand_status)
- )
engine = lib.ENGINE_new()
try:
result = lib.ENGINE_set_id(engine, _osrandom_engine_id)