diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-03 09:24:58 -0700 | 
|---|---|---|
| committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-03 09:24:58 -0700 | 
| commit | 814efab2a71a869d362c0b488b6c51bb590f0d23 (patch) | |
| tree | ecb2eefd8b37a8ee2135130a720ca8134cafea52 /tests/primitives/test_nist.py | |
| parent | 14fdcd186c9f6c7ccc1e6388347cd584822bc041 (diff) | |
| download | cryptography-814efab2a71a869d362c0b488b6c51bb590f0d23.tar.gz cryptography-814efab2a71a869d362c0b488b6c51bb590f0d23.tar.bz2 cryptography-814efab2a71a869d362c0b488b6c51bb590f0d23.zip  | |
Explicitly pass around the API, and run all tests under all available APIs
Diffstat (limited to 'tests/primitives/test_nist.py')
| -rw-r--r-- | tests/primitives/test_nist.py | 36 | 
1 files changed, 22 insertions, 14 deletions
diff --git a/tests/primitives/test_nist.py b/tests/primitives/test_nist.py index 1e5d2396..261bbd1d 100644 --- a/tests/primitives/test_nist.py +++ b/tests/primitives/test_nist.py @@ -60,10 +60,11 @@ class TestAES_CBC(object):              "CBCVarTxt256.rsp",          ]      ) -    def test_KAT(self, key, iv, plaintext, ciphertext): +    def test_KAT(self, key, iv, plaintext, ciphertext, api):          cipher = BlockCipher(              ciphers.AES(binascii.unhexlify(key)),              modes.CBC(binascii.unhexlify(iv)), +            api          )          actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))          actual_ciphertext += cipher.finalize() @@ -78,10 +79,11 @@ class TestAES_CBC(object):              "CBCMMT256.rsp",          ]      ) -    def test_MMT(self, key, iv, plaintext, ciphertext): +    def test_MMT(self, key, iv, plaintext, ciphertext, api):          cipher = BlockCipher(              ciphers.AES(binascii.unhexlify(key)),              modes.CBC(binascii.unhexlify(iv)), +            api          )          actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))          actual_ciphertext += cipher.finalize() @@ -107,10 +109,11 @@ class TestAES_ECB(object):              "ECBVarTxt256.rsp",          ]      ) -    def test_KAT(self, key, plaintext, ciphertext): +    def test_KAT(self, key, plaintext, ciphertext, api):          cipher = BlockCipher(              ciphers.AES(binascii.unhexlify(key)), -            modes.ECB() +            modes.ECB(), +            api          )          actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))          actual_ciphertext += cipher.finalize() @@ -125,10 +128,11 @@ class TestAES_ECB(object):              "ECBMMT256.rsp",          ]      ) -    def test_MMT(self, key, plaintext, ciphertext): +    def test_MMT(self, key, plaintext, ciphertext, api):          cipher = BlockCipher(              ciphers.AES(binascii.unhexlify(key)), -            modes.ECB() +            modes.ECB(), +            api          )          actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))          actual_ciphertext += cipher.finalize() @@ -154,10 +158,11 @@ class TestAES_OFB(object):              "OFBVarTxt256.rsp",          ]      ) -    def test_KAT(self, key, iv, plaintext, ciphertext): +    def test_KAT(self, key, iv, plaintext, ciphertext, api):          cipher = BlockCipher(              ciphers.AES(binascii.unhexlify(key)), -            modes.OFB(binascii.unhexlify(iv)) +            modes.OFB(binascii.unhexlify(iv)), +            api          )          actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))          actual_ciphertext += cipher.finalize() @@ -172,10 +177,11 @@ class TestAES_OFB(object):              "OFBMMT256.rsp",          ]      ) -    def test_MMT(self, key, iv, plaintext, ciphertext): +    def test_MMT(self, key, iv, plaintext, ciphertext, api):          cipher = BlockCipher(              ciphers.AES(binascii.unhexlify(key)), -            modes.OFB(binascii.unhexlify(iv)) +            modes.OFB(binascii.unhexlify(iv)), +            api          )          actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))          actual_ciphertext += cipher.finalize() @@ -201,10 +207,11 @@ class TestAES_CFB(object):              "CFB128VarTxt256.rsp",          ]      ) -    def test_KAT(self, key, iv, plaintext, ciphertext): +    def test_KAT(self, key, iv, plaintext, ciphertext, api):          cipher = BlockCipher(              ciphers.AES(binascii.unhexlify(key)), -            modes.CFB(binascii.unhexlify(iv)) +            modes.CFB(binascii.unhexlify(iv)), +            api          )          actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))          actual_ciphertext += cipher.finalize() @@ -219,10 +226,11 @@ class TestAES_CFB(object):              "CFB128MMT256.rsp",          ]      ) -    def test_MMT(self, key, iv, plaintext, ciphertext): +    def test_MMT(self, key, iv, plaintext, ciphertext, api):          cipher = BlockCipher(              ciphers.AES(binascii.unhexlify(key)), -            modes.CFB(binascii.unhexlify(iv)) +            modes.CFB(binascii.unhexlify(iv)), +            api          )          actual_ciphertext = cipher.encrypt(binascii.unhexlify(plaintext))          actual_ciphertext += cipher.finalize()  | 
