aboutsummaryrefslogtreecommitdiff
path: root/tests/conftest.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2021-08-11 22:47:25 -0400
committerGitHub <noreply@github.com>2021-08-11 22:47:25 -0400
commitb93f405c07a312945935a1a718d8d6e1b5153a9b (patch)
tree645b6570926b07b835813ea40e2e77154687abc0 /tests/conftest.py
parent5f5eb5493dd2453b98480330dbf149fc5a0489d1 (diff)
downloadpyca-cryptography-b93f405c07a312945935a1a718d8d6e1b5153a9b.zip
pyca-cryptography-b93f405c07a312945935a1a718d8d6e1b5153a9b.tar.gz
pyca-cryptography-b93f405c07a312945935a1a718d8d6e1b5153a9b.tar.bz2
Speed up RSA tests in 3.0.0 (#6206)
* Speed up RSA tests in 3.0.0 RSA_check_key is slower in OpenSSL 3.0.0 due to improved primality checking. In normal use this is unlikely to be a problem since users don't load new keys constantly, but we do in our tests. This adds some private flags to allow skipping those checks for performance reasons. On my laptop with this patch it takes 16s to run test_rsa.py. The previous commit takes 72s. * black * different approach * skip rsa key checks in wycheproof wycheproof's tets don't rely on broken keys
Diffstat (limited to 'tests/conftest.py')
-rw-r--r--tests/conftest.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/conftest.py b/tests/conftest.py
index 2fea50c..01aba77 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -33,3 +33,12 @@ def pytest_runtest_setup(item):
def backend(request):
check_backend_support(openssl_backend, request)
return openssl_backend
+
+
+@pytest.fixture
+def disable_rsa_checks(backend):
+ # Use this fixture to skip RSA key checks in tests that need the
+ # performance.
+ backend._rsa_skip_check_key = True
+ yield
+ backend._rsa_skip_check_key = False