Skip to content

Commit d2e8557

Browse files
alexreaperhulk
authored andcommitted
Run wycheproof RSA tests on LibreSSL>=2.8 (pyca#4737)
* Run wycheproof RSA tests on LibreSSL>=2.8 * Define it this way * These are errors on libressl
1 parent 5c07d7a commit d2e8557

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

src/_cffi_src/openssl/cryptography.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,15 @@
3333
#include <Winsock2.h>
3434
#endif
3535
36+
#if CRYPTOGRAPHY_IS_LIBRESSL
3637
#define CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER \
37-
(CRYPTOGRAPHY_IS_LIBRESSL && LIBRESSL_VERSION_NUMBER >= 0x2070000fL)
38+
(LIBRESSL_VERSION_NUMBER >= 0x2070000f)
39+
#define CRYPTOGRAPHY_LIBRESSL_28_OR_GREATER \
40+
(LIBRESSL_VERSION_NUMBER >= 0x2080000f)
41+
#else
42+
#define CRYPTOGRAPHY_LIBRESSL_27_OR_GREATER (0)
43+
#define CRYPTOGRAPHY_LIBRESSL_28_OR_GREATER (0)
44+
#endif
3845
3946
#define CRYPTOGRAPHY_OPENSSL_102_OR_GREATER \
4047
(OPENSSL_VERSION_NUMBER >= 0x10002000 && !CRYPTOGRAPHY_IS_LIBRESSL)
@@ -67,6 +74,8 @@
6774
static const int CRYPTOGRAPHY_OPENSSL_LESS_THAN_111;
6875
6976
static const int CRYPTOGRAPHY_IS_LIBRESSL;
77+
78+
static const int CRYPTOGRAPHY_LIBRESSL_28_OR_GREATER;
7079
"""
7180

7281
FUNCTIONS = """

tests/wycheproof/test_rsa.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ def should_verify(backend, wycheproof):
2929

3030
if wycheproof.acceptable:
3131
if (
32-
backend._lib.CRYPTOGRAPHY_OPENSSL_110_OR_GREATER and
33-
wycheproof.has_flag("MissingNull")
32+
(
33+
backend._lib.CRYPTOGRAPHY_OPENSSL_110_OR_GREATER or
34+
backend._lib.CRYPTOGRAPHY_LIBRESSL_28_OR_GREATER
35+
) and wycheproof.has_flag("MissingNull")
3436
):
3537
return False
3638
return True
@@ -41,10 +43,8 @@ def should_verify(backend, wycheproof):
4143
@pytest.mark.requires_backend_interface(interface=RSABackend)
4244
@pytest.mark.supported(
4345
only_if=lambda backend: (
44-
# TODO: this also skips on LibreSSL, which is ok for now, since these
45-
# don't pass on Libre, but we'll need to fix this when LibreSSL 2.8 is
46-
# released.
47-
not backend._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_102
46+
not backend._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_102 or
47+
backend._lib.CRYPTOGRAPHY_LIBRESSL_28_OR_GREATER
4848
),
4949
skip_message=(
5050
"Many of these tests fail on OpenSSL < 1.0.2 and since upstream isn't"

0 commit comments

Comments
 (0)