aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/primitives/test_aes.py
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2013-12-04 14:21:53 -0800
committerDavid Reid <dreid@dreid.org>2013-12-04 14:21:53 -0800
commit3029fe414a3dba0231a44e72ddfc398634c173de (patch)
tree4cc5e7a8933a6a916bbf7a2712df143d6e2ceb71 /tests/hazmat/primitives/test_aes.py
parentbdb6debe4a9a3ccba6648c56028f849c0e5b6a12 (diff)
parent672843712d6b42404fea27a07a87b70d850cc0dd (diff)
downloadcryptography-3029fe414a3dba0231a44e72ddfc398634c173de.tar.gz
cryptography-3029fe414a3dba0231a44e72ddfc398634c173de.tar.bz2
cryptography-3029fe414a3dba0231a44e72ddfc398634c173de.zip
Merge pull request #176 from reaperhulk/gcm-support
[WIP] GCM support
Diffstat (limited to 'tests/hazmat/primitives/test_aes.py')
-rw-r--r--tests/hazmat/primitives/test_aes.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/hazmat/primitives/test_aes.py b/tests/hazmat/primitives/test_aes.py
index d178da7b..f7b0b9a0 100644
--- a/tests/hazmat/primitives/test_aes.py
+++ b/tests/hazmat/primitives/test_aes.py
@@ -18,7 +18,7 @@ import os
from cryptography.hazmat.primitives.ciphers import algorithms, modes
-from .utils import generate_encrypt_test
+from .utils import generate_encrypt_test, generate_aead_test
from ...utils import (
load_nist_vectors, load_openssl_vectors,
)
@@ -132,3 +132,22 @@ class TestAES(object):
),
skip_message="Does not support AES CTR",
)
+
+ test_GCM = generate_aead_test(
+ load_nist_vectors,
+ os.path.join("ciphers", "AES", "GCM"),
+ [
+ "gcmDecrypt128.rsp",
+ "gcmDecrypt192.rsp",
+ "gcmDecrypt256.rsp",
+ "gcmEncryptExtIV128.rsp",
+ "gcmEncryptExtIV192.rsp",
+ "gcmEncryptExtIV256.rsp",
+ ],
+ lambda key: algorithms.AES(key),
+ lambda iv, tag: modes.GCM(iv, tag),
+ only_if=lambda backend: backend.cipher_supported(
+ algorithms.AES("\x00" * 16), modes.GCM("\x00" * 12)
+ ),
+ skip_message="Does not support AES GCM",
+ )