From 7d954bd5065138dec04a85d7d3be46f2cb3c1dae Mon Sep 17 00:00:00 2001 From: Hynek Schlawack Date: Fri, 10 Jan 2014 12:15:15 +0100 Subject: Expose ERR_load_SSL_strings --- cryptography/hazmat/bindings/openssl/err.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cryptography/hazmat/bindings/openssl/err.py b/cryptography/hazmat/bindings/openssl/err.py index 6b2a77b1..918c06d3 100644 --- a/cryptography/hazmat/bindings/openssl/err.py +++ b/cryptography/hazmat/bindings/openssl/err.py @@ -39,6 +39,7 @@ static const int ASN1_R_BAD_PASSWORD_READ; FUNCTIONS = """ void ERR_load_crypto_strings(void); +void ERR_load_SSL_strings(void); void ERR_free_strings(void); char* ERR_error_string(unsigned long, char *); void ERR_error_string_n(unsigned long, char *, size_t); -- cgit v1.2.3 From 9cd4b21fd91016040658f1ee0fb095fc11541651 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 10 Jan 2014 06:54:21 -0800 Subject: Use a normal quote here, not sure where the smart quote came from --- docs/security.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/security.rst b/docs/security.rst index 88959709..2b96d589 100644 --- a/docs/security.rst +++ b/docs/security.rst @@ -7,6 +7,6 @@ identified a security issue in it, please report it to fingerprint ``E27D 4AA0 1651 72CB C5D2 AF2B 125F 5C67 DFE9 4084`` (this public key is available from most commonly-used key servers). -Once you’ve submitted an issue via email, you should receive an acknowledgment +Once you've submitted an issue via email, you should receive an acknowledgment within 48 hours, and depending on the action to be taken, you may receive further followup emails. -- cgit v1.2.3 From fc4e2b740feba8d38ad9900e6203f619a31b71f3 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 10 Jan 2014 07:30:51 -0800 Subject: Try to run the spellchecker on travis --- docs/conf.py | 1 + docs/spelling_wordlist.txt | 28 ++++++++++++++++++++++++++++ tox.ini | 1 + 3 files changed, 30 insertions(+) create mode 100644 docs/spelling_wordlist.txt diff --git a/docs/conf.py b/docs/conf.py index 00660314..a42dcb22 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -38,6 +38,7 @@ extensions = [ 'sphinx.ext.intersphinx', 'sphinx.ext.viewcode', 'cryptography-docs', + 'sphinxcontrib.spelling', ] # Add any paths that contain templates here, relative to this directory. diff --git a/docs/spelling_wordlist.txt b/docs/spelling_wordlist.txt new file mode 100644 index 00000000..97356c24 --- /dev/null +++ b/docs/spelling_wordlist.txt @@ -0,0 +1,28 @@ +backend +backends +boolean +ciphertext +committer +crypto +cryptographic +cryptographically +decrypt +decrypted +decrypting +fernet +hazmat +indistinguishability +introspectability +invariants +pickleable +plaintext +testability +unencrypted +unpadded +unpadding +Backends +Blowfish +Changelog +Docstrings +Fernet +Schneier diff --git a/tox.ini b/tox.ini index ce2f5398..9cd0699d 100644 --- a/tox.ini +++ b/tox.ini @@ -21,6 +21,7 @@ commands = sphinx-build -W -b latex -d {envtmpdir}/doctrees docs docs/_build/latex sphinx-build -W -b doctest -d {envtmpdir}/doctrees docs docs/_build/html sphinx-build -W -b linkcheck docs docs/_build/html + sphinx-build -W -b spelling docs docs/_build/html # Temporarily disable coverage on pypy because of performance problems with # coverage.py on pypy. -- cgit v1.2.3 From 5c0ec7c85e3623630a55e4da4b954f2fb594bf47 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 10 Jan 2014 08:08:58 -0800 Subject: Actuall install a thing --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index 9cd0699d..a34ad633 100644 --- a/tox.ini +++ b/tox.ini @@ -14,6 +14,7 @@ commands = [testenv:docs] deps = sphinx + sphinxcontrib-spelling sphinx_rtd_theme basepython = python2.7 commands = -- cgit v1.2.3 From 2153c57164c0307ce864554136db15d1d201c739 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 10:42:27 -0600 Subject: init the ssl library in the backend Also add some comments since this is mildly convoluted. --- cryptography/hazmat/backends/openssl/backend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py index 284fa989..07ee58c1 100644 --- a/cryptography/hazmat/backends/openssl/backend.py +++ b/cryptography/hazmat/backends/openssl/backend.py @@ -43,7 +43,11 @@ class Backend(object): self._ffi = self._binding.ffi self._lib = self._binding.lib + # adds all ciphers/digests for EVP self._lib.OpenSSL_add_all_algorithms() + # registers available SSL/TLS ciphers and digests + self._lib.SSL_library_init() + # loads error strings for libcrypto and libssl functions self._lib.SSL_load_error_strings() self._cipher_registry = {} -- cgit v1.2.3 From 29b40eaa062af0e1d6eb9733958bfd497dd8dc4d Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 10 Jan 2014 09:00:12 -0800 Subject: This is a dep --- tox.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/tox.ini b/tox.ini index a34ad633..ff5df360 100644 --- a/tox.ini +++ b/tox.ini @@ -13,6 +13,7 @@ commands = [testenv:docs] deps = + pyenchant sphinx sphinxcontrib-spelling sphinx_rtd_theme -- cgit v1.2.3 From 50e58d4472f6c5a599ca683dcf1b532c310a2d7a Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 10 Jan 2014 09:59:55 -0800 Subject: Nonsense I think we need. --- .travis/install.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis/install.sh b/.travis/install.sh index 8d6840f2..e6ea2537 100755 --- a/.travis/install.sh +++ b/.travis/install.sh @@ -9,6 +9,11 @@ if [[ "${OPENSSL}" == "0.9.8" && "$(uname -s)" != "Darwin" ]]; then sudo apt-get install -y --force-yes libssl-dev/lucid fi +if [[ "${TOX_ENV}" == "docs" && "$(name -s)" != "Darwin" ]]; then + sudo apt-get -y update + sudo apt-get install libenchant-dev +fi + if [[ "$(uname -s)" == "Darwin" ]]; then brew update brew install pyenv -- cgit v1.2.3 From cf77d3ad5390e6e00bbb38f379effe8df401fabb Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 12:13:05 -0600 Subject: add tests to the openssl backend to verify that we've registered evp ciphers and ssl ciphers --- tests/hazmat/backends/test_openssl.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index ad399594..71250592 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -95,3 +95,11 @@ class TestOpenSSL(object): backend._lib.EVP_F_EVP_DECRYPTFINAL_EX, 0 ) + + def test_ssl_ciphers_registered(self): + meth = backend._lib.TLSv1_method() + assert backend._lib.SSL_CTX_new(meth) != backend._ffi.NULL + + def test_evp_ciphers_registered(self): + cipher = backend._lib.EVP_get_cipherbyname("aes-256-cbc") + assert cipher != backend._ffi.NULL -- cgit v1.2.3 From 82128826bb0a92779a9029645525a7dc280671be Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 12:27:14 -0600 Subject: don't leak a context in the test --- tests/hazmat/backends/test_openssl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 71250592..a212df4a 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -98,7 +98,9 @@ class TestOpenSSL(object): def test_ssl_ciphers_registered(self): meth = backend._lib.TLSv1_method() - assert backend._lib.SSL_CTX_new(meth) != backend._ffi.NULL + ctx = backend._lib.SSL_CTX_new(meth) + assert ctx != backend._ffi.NULL + backend._lib.SSL_CTX_free(ctx) def test_evp_ciphers_registered(self): cipher = backend._lib.EVP_get_cipherbyname("aes-256-cbc") -- cgit v1.2.3 From 44957cde537a85ad8dba524cb352f784b07fc307 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 12:36:14 -0600 Subject: oops, bytes plz --- tests/hazmat/backends/test_openssl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index a212df4a..c70446b0 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -103,5 +103,5 @@ class TestOpenSSL(object): backend._lib.SSL_CTX_free(ctx) def test_evp_ciphers_registered(self): - cipher = backend._lib.EVP_get_cipherbyname("aes-256-cbc") + cipher = backend._lib.EVP_get_cipherbyname(b"aes-256-cbc") assert cipher != backend._ffi.NULL -- cgit v1.2.3 From 59075dfd1bc18ad778d04425d8941e07352d7bba Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 10 Jan 2014 11:40:03 -0800 Subject: Spelling! --- docs/security.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/security.rst b/docs/security.rst index 2b96d589..4dadc847 100644 --- a/docs/security.rst +++ b/docs/security.rst @@ -9,4 +9,4 @@ key is available from most commonly-used key servers). Once you've submitted an issue via email, you should receive an acknowledgment within 48 hours, and depending on the action to be taken, you may receive -further followup emails. +further follow-up emails. -- cgit v1.2.3 From 11a007ac544fd8754c29d0b06fc1be380d59a02f Mon Sep 17 00:00:00 2001 From: Alex Stapleton Date: Fri, 10 Jan 2014 22:19:05 +0000 Subject: Bind all the PEM errors --- cryptography/hazmat/bindings/openssl/err.py | 49 +++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/cryptography/hazmat/bindings/openssl/err.py b/cryptography/hazmat/bindings/openssl/err.py index 918c06d3..1b66bd2a 100644 --- a/cryptography/hazmat/bindings/openssl/err.py +++ b/cryptography/hazmat/bindings/openssl/err.py @@ -22,19 +22,62 @@ struct ERR_string_data_st { }; typedef struct ERR_string_data_st ERR_STRING_DATA; +static const int ASN1_R_BAD_PASSWORD_READ; + static const int ERR_LIB_EVP; static const int ERR_LIB_PEM; -static const int EVP_F_EVP_ENCRYPTFINAL_EX; static const int EVP_F_EVP_DECRYPTFINAL_EX; +static const int EVP_F_EVP_ENCRYPTFINAL_EX; static const int EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH; -static const int PEM_F_PEM_READ_BIO_PRIVATEKEY; static const int PEM_F_D2I_PKCS8PRIVATEKEY_BIO; +static const int PEM_F_D2I_PKCS8PRIVATEKEY_BIO; +static const int PEM_F_D2I_PKCS8PRIVATEKEY_FP; +static const int PEM_F_DO_PK8PKEY; +static const int PEM_F_DO_PK8PKEY_FP; +static const int PEM_F_LOAD_IV; +static const int PEM_F_PEM_ASN1_READ; +static const int PEM_F_PEM_ASN1_READ_BIO; +static const int PEM_F_PEM_ASN1_WRITE; +static const int PEM_F_PEM_ASN1_WRITE_BIO; +static const int PEM_F_PEM_DEF_CALLBACK; +static const int PEM_F_PEM_DO_HEADER; +static const int PEM_F_PEM_F_PEM_WRITE_PKCS8PRIVATEKEY; +static const int PEM_F_PEM_GET_EVP_CIPHER_INFO; +static const int PEM_F_PEM_PK8PKEY; +static const int PEM_F_PEM_READ; +static const int PEM_F_PEM_READ_BIO; +static const int PEM_F_PEM_READ_BIO_PRIVATEKEY; +static const int PEM_F_PEM_READ_BIO_PRIVATEKEY; +static const int PEM_F_PEM_READ_PRIVATEKEY; +static const int PEM_F_PEM_SEALFINAL; +static const int PEM_F_PEM_SEALINIT; +static const int PEM_F_PEM_SIGNFINAL; +static const int PEM_F_PEM_WRITE; +static const int PEM_F_PEM_WRITE_BIO; +static const int PEM_F_PEM_X509_INFO_READ; +static const int PEM_F_PEM_X509_INFO_READ_BIO; +static const int PEM_F_PEM_X509_INFO_WRITE_BIO; +static const int PEM_R_BAD_BASE64_DECODE; +static const int PEM_R_BAD_DECRYPT; +static const int PEM_R_BAD_END_LINE; +static const int PEM_R_BAD_IV_CHARS; static const int PEM_R_BAD_PASSWORD_READ; -static const int ASN1_R_BAD_PASSWORD_READ; +static const int PEM_R_BAD_PASSWORD_READ; +static const int PEM_R_ERROR_CONVERTING_PRIVATE_KEY; +static const int PEM_R_NOT_DEK_INFO; +static const int PEM_R_NOT_ENCRYPTED; +static const int PEM_R_NOT_PROC_TYPE; +static const int PEM_R_NO_START_LINE; +static const int PEM_R_PROBLEMS_GETTING_PASSWORD; +static const int PEM_R_PUBLIC_KEY_NO_RSA; +static const int PEM_R_READ_KEY; +static const int PEM_R_SHORT_HEADER; +static const int PEM_R_UNSUPPORTED_CIPHER; +static const int PEM_R_UNSUPPORTED_ENCRYPTION; """ FUNCTIONS = """ -- cgit v1.2.3 From ab2cfc70a63e49ed385f9bb9c4e44bc86025c3a5 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 21:44:05 -0600 Subject: add check to confirm we've loaded error strings --- tests/hazmat/backends/test_openssl.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index c70446b0..421bb530 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -105,3 +105,10 @@ class TestOpenSSL(object): def test_evp_ciphers_registered(self): cipher = backend._lib.EVP_get_cipherbyname(b"aes-256-cbc") assert cipher != backend._ffi.NULL + + def test_error_strings_loaded(self): + err = backend._lib.ERR_error_string(101183626, backend._ffi.NULL) + assert backend._ffi.string(err) == ( + "error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:" + "data not multiple of block length" + ) -- cgit v1.2.3 From 985d99d2934befe8bcf6257cbd9036dee1934ed9 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 22:01:04 -0600 Subject: bytes byte back --- tests/hazmat/backends/test_openssl.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/hazmat/backends/test_openssl.py b/tests/hazmat/backends/test_openssl.py index 421bb530..2a329920 100644 --- a/tests/hazmat/backends/test_openssl.py +++ b/tests/hazmat/backends/test_openssl.py @@ -107,8 +107,9 @@ class TestOpenSSL(object): assert cipher != backend._ffi.NULL def test_error_strings_loaded(self): + # returns a value in a static buffer err = backend._lib.ERR_error_string(101183626, backend._ffi.NULL) assert backend._ffi.string(err) == ( - "error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:" - "data not multiple of block length" + b"error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:" + b"data not multiple of block length" ) -- cgit v1.2.3 From d1de411a6339671b7a1b03fa621d2f61fc3780cb Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 22:32:51 -0600 Subject: add hmac to commoncrypto binding --- .../hazmat/bindings/commoncrypto/binding.py | 1 + .../hazmat/bindings/commoncrypto/common_hmac.py | 46 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 cryptography/hazmat/bindings/commoncrypto/common_hmac.py diff --git a/cryptography/hazmat/bindings/commoncrypto/binding.py b/cryptography/hazmat/bindings/commoncrypto/binding.py index e0cd61f7..9c1af40a 100644 --- a/cryptography/hazmat/bindings/commoncrypto/binding.py +++ b/cryptography/hazmat/bindings/commoncrypto/binding.py @@ -25,6 +25,7 @@ class Binding(object): _module_prefix = "cryptography.hazmat.bindings.commoncrypto." _modules = [ "common_digest", + "common_hmac", ] ffi = None diff --git a/cryptography/hazmat/bindings/commoncrypto/common_hmac.py b/cryptography/hazmat/bindings/commoncrypto/common_hmac.py new file mode 100644 index 00000000..a4abcb04 --- /dev/null +++ b/cryptography/hazmat/bindings/commoncrypto/common_hmac.py @@ -0,0 +1,46 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +INCLUDES = """ +#include +""" + +TYPES = """ +typedef struct { + ...; +} CCHmacContext; +enum CCHmacAlgorithm { + kCCHmacAlgSHA1, + kCCHmacAlgMD5, + kCCHmacAlgSHA256, + kCCHmacAlgSHA384, + kCCHmacAlgSHA512, + kCCHmacAlgSHA224 +}; +typedef uint32_t CCHmacAlgorithm; +""" + +FUNCTIONS = """ +void CCHmacInit(CCHmacContext *, CCHmacAlgorithm, const void *, size_t); +void CCHmacUpdate( CCHmacContext *, const void *, size_t); +void CCHmacFinal( CCHmacContext *, void *); + +""" + +MACROS = """ +""" + +CUSTOMIZATIONS = """ +""" + +CONDITIONAL_NAMES = {} -- cgit v1.2.3 From 8e306b793abe07e631779510def8da659db9e040 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 22:39:54 -0600 Subject: remove extraneous spaces --- cryptography/hazmat/bindings/commoncrypto/common_hmac.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cryptography/hazmat/bindings/commoncrypto/common_hmac.py b/cryptography/hazmat/bindings/commoncrypto/common_hmac.py index a4abcb04..72945364 100644 --- a/cryptography/hazmat/bindings/commoncrypto/common_hmac.py +++ b/cryptography/hazmat/bindings/commoncrypto/common_hmac.py @@ -32,8 +32,8 @@ typedef uint32_t CCHmacAlgorithm; FUNCTIONS = """ void CCHmacInit(CCHmacContext *, CCHmacAlgorithm, const void *, size_t); -void CCHmacUpdate( CCHmacContext *, const void *, size_t); -void CCHmacFinal( CCHmacContext *, void *); +void CCHmacUpdate(CCHmacContext *, const void *, size_t); +void CCHmacFinal(CCHmacContext *, void *); """ -- cgit v1.2.3 From a8dcf8428fed7d66309959b64d5bd55794c25386 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 23:34:20 -0600 Subject: require cffi >= 0.8.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index feed0cd8..d03e5ff8 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ with open(os.path.join(base_dir, "cryptography", "__about__.py")) as f: exec(f.read(), about) -CFFI_DEPENDENCY = "cffi>=0.6" +CFFI_DEPENDENCY = "cffi>=0.8.1" SIX_DEPENDENCY = "six>=1.4.1" requirements = [ -- cgit v1.2.3 From c54c762c93eb5bc23c36ccfe511344f2cd499364 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 23:37:13 -0600 Subject: change to anonymous enum --- cryptography/hazmat/bindings/commoncrypto/common_hmac.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cryptography/hazmat/bindings/commoncrypto/common_hmac.py b/cryptography/hazmat/bindings/commoncrypto/common_hmac.py index 72945364..a4bf9009 100644 --- a/cryptography/hazmat/bindings/commoncrypto/common_hmac.py +++ b/cryptography/hazmat/bindings/commoncrypto/common_hmac.py @@ -19,7 +19,7 @@ TYPES = """ typedef struct { ...; } CCHmacContext; -enum CCHmacAlgorithm { +enum { kCCHmacAlgSHA1, kCCHmacAlgMD5, kCCHmacAlgSHA256, -- cgit v1.2.3 From 7fcaa3715f1b3afde3256b6a01232c8a71fea891 Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Fri, 10 Jan 2014 23:39:58 -0600 Subject: drop to >= 0.8 to make pypy happy --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d03e5ff8..e8bcc11f 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ with open(os.path.join(base_dir, "cryptography", "__about__.py")) as f: exec(f.read(), about) -CFFI_DEPENDENCY = "cffi>=0.8.1" +CFFI_DEPENDENCY = "cffi>=0.8" SIX_DEPENDENCY = "six>=1.4.1" requirements = [ -- cgit v1.2.3 From 0d58373aac5bdbd8f4b72a9bed02fc6a1e58b0b3 Mon Sep 17 00:00:00 2001 From: Alex Stapleton Date: Fri, 10 Jan 2014 22:39:12 +0000 Subject: Use pytest.fixture for backends This lets you chain in additional fixtures that vary by backend easily. --- tests/conftest.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 0ddc3338..1d9f96ed 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,6 @@ import pytest +from cryptography.hazmat.backends import _ALL_BACKENDS from cryptography.hazmat.backends.interfaces import ( HMACBackend, CipherBackend, HashBackend ) @@ -7,11 +8,9 @@ from cryptography.hazmat.backends.interfaces import ( from .utils import check_for_iface, check_backend_support -def pytest_generate_tests(metafunc): - from cryptography.hazmat.backends import _ALL_BACKENDS - - if "backend" in metafunc.fixturenames: - metafunc.parametrize("backend", _ALL_BACKENDS) +@pytest.fixture(params=_ALL_BACKENDS) +def backend(request): + return request.param @pytest.mark.trylast -- cgit v1.2.3