diff options
author | Glyph <glyph@twistedmatrix.com> | 2015-06-30 01:46:38 -0700 |
---|---|---|
committer | Glyph <glyph@twistedmatrix.com> | 2015-06-30 01:46:38 -0700 |
commit | 14e67ac4241a20c25f0d7751171c8b626f014e45 (patch) | |
tree | 66f26860e0c7cc22c5283b8efca7439b64c9b4ef /tests/hazmat | |
parent | 7c3e7a83f06b0ff8f0c27a4486eaa6448ba6485e (diff) | |
download | cryptography-14e67ac4241a20c25f0d7751171c8b626f014e45.tar.gz cryptography-14e67ac4241a20c25f0d7751171c8b626f014e45.tar.bz2 cryptography-14e67ac4241a20c25f0d7751171c8b626f014e45.zip |
Detect and ignore LibreSSL.
Diffstat (limited to 'tests/hazmat')
-rw-r--r-- | tests/hazmat/bindings/test_openssl.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/hazmat/bindings/test_openssl.py b/tests/hazmat/bindings/test_openssl.py index 207fece9..73952561 100644 --- a/tests/hazmat/bindings/test_openssl.py +++ b/tests/hazmat/bindings/test_openssl.py @@ -95,13 +95,15 @@ class TestOpenSSL(object): b._register_osrandom_engine() def test_actual_osrandom_bytes(self, monkeypatch): + b = Binding() + if b'LibreSSL' in b.ffi.string(b.lib.OPENSSL_VERSION_TEXT): + pytest.skip("LibreSSL hard-codes RAND_bytes to use arc4random.") sample_data = (b"\x01\x02\x03\x04" * 4) length = len(sample_data) def notrandom(size): assert size == length return sample_data monkeypatch.setattr(os, "urandom", notrandom) - b = Binding() buf = b.ffi.new("char[]", length) b.lib.RAND_bytes(buf, length) assert b.ffi.buffer(buf)[0:length] == sample_data |