From 14e67ac4241a20c25f0d7751171c8b626f014e45 Mon Sep 17 00:00:00 2001 From: Glyph Date: Tue, 30 Jun 2015 01:46:38 -0700 Subject: Detect and ignore LibreSSL. --- tests/hazmat/bindings/test_openssl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/hazmat/bindings') 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 -- cgit v1.2.3