aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGlyph <glyph@twistedmatrix.com>2015-06-26 23:09:46 -0700
committerGlyph <glyph@twistedmatrix.com>2015-06-26 23:09:46 -0700
commitd70c98d28effdc410d5ac773e0e461fb548a40e0 (patch)
tree07b3d4c6ac771401d57765d219eef6ecada94400 /src
parentb51d246eb6ccaed7920ba6dd6a816f74d1158c16 (diff)
downloadcryptography-d70c98d28effdc410d5ac773e0e461fb548a40e0.tar.gz
cryptography-d70c98d28effdc410d5ac773e0e461fb548a40e0.tar.bz2
cryptography-d70c98d28effdc410d5ac773e0e461fb548a40e0.zip
pointer shenanigans
apparently (?) ENGINE_by_id treats its ID as an opaque *pointer* key and not actually as a string, and while CPython's CFFI support seems to manage to preserve the pointer identity when using the same Python string, PyPy doesn't. Fix things to use a cffi-wrapped pointer again and tests pass on PyPy.
Diffstat (limited to 'src')
-rw-r--r--src/cryptography/hazmat/bindings/openssl/binding.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cryptography/hazmat/bindings/openssl/binding.py b/src/cryptography/hazmat/bindings/openssl/binding.py
index 8e80aa60..eda23959 100644
--- a/src/cryptography/hazmat/bindings/openssl/binding.py
+++ b/src/cryptography/hazmat/bindings/openssl/binding.py
@@ -22,8 +22,8 @@ class Binding(object):
_rand_method = None
_init_lock = threading.Lock()
_lock_init_lock = threading.Lock()
- _osrandom_engine_id = b"osrandom"
- _osrandom_engine_name = b"osrandom_engine"
+ _osrandom_engine_id = ffi.new("const char[]", b"osrandom")
+ _osrandom_engine_name = ffi.new("const char[]", b"osrandom_engine")
_retained = []
def __init__(self):
@@ -98,6 +98,7 @@ class Binding(object):
and cls.lib.ENGINE_add(e))
if not cls.lib.ENGINE_free(e):
return 0
+ assert cls.lib.ENGINE_by_id(cls._osrandom_engine_id) != cls.ffi.NULL
return result
@classmethod