aboutsummaryrefslogtreecommitdiffstats
path: root/tests/primitives/test_cryptrec.py
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-03 21:54:05 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2013-10-06 17:31:31 -0500
commitf2ce1ae856e43a292ea7a6aae26d75b508f0a363 (patch)
treed973c676ff4e4c7925abd9bb1a3b2fbac11bc62a /tests/primitives/test_cryptrec.py
parentefe0189de0714bbde76082566d0f82df1439cb63 (diff)
downloadcryptography-f2ce1ae856e43a292ea7a6aae26d75b508f0a363.tar.gz
cryptography-f2ce1ae856e43a292ea7a6aae26d75b508f0a363.tar.bz2
cryptography-f2ce1ae856e43a292ea7a6aae26d75b508f0a363.zip
rebase and modify to support some changed behaviors
* Update code to reflect new api object (ffi and lib are no longer private) * tests updated to take an api object * skipif marks removed for now as we need to use the api passed to each individual test. skip testing done inside the test * changed name of supports in api to supports_cipher (future PRs will contain supports_hash)
Diffstat (limited to 'tests/primitives/test_cryptrec.py')
-rw-r--r--tests/primitives/test_cryptrec.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/tests/primitives/test_cryptrec.py b/tests/primitives/test_cryptrec.py
index 54ae4d0c..fb2bf19a 100644
--- a/tests/primitives/test_cryptrec.py
+++ b/tests/primitives/test_cryptrec.py
@@ -23,13 +23,10 @@ import os
import pytest
-from cryptography.bindings.openssl.api import api
from cryptography.primitives.block import BlockCipher, ciphers, modes
from ..utils import load_cryptrec_vectors_from_file
-CAMELLIA_ECB_SUPPORTED = api.supports('camellia-128-ecb')
-
def parameterize_encrypt_test(cipher, vector_type, params, fnames):
return pytest.mark.parametrize(params,
@@ -42,9 +39,7 @@ def parameterize_encrypt_test(cipher, vector_type, params, fnames):
)
-@pytest.mark.skipif("not CAMELLIA_ECB_SUPPORTED")
class TestCamelliaECB(object):
-
@parameterize_encrypt_test(
"Camellia", "NTT",
("key", "plaintext", "ciphertext"),
@@ -54,10 +49,13 @@ class TestCamelliaECB(object):
"camellia-256-ecb.txt",
]
)
- def test_NTT(self, key, plaintext, ciphertext):
+ def test_NTT(self, key, plaintext, ciphertext, api):
+ if not api.supports_cipher('camellia-128-ecb'):
+ pytest.skip()
cipher = BlockCipher(
ciphers.Camellia(binascii.unhexlify(key)),
modes.ECB(),
+ api
)
actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))
actual_ciphertext += cipher.finalize()