diff options
author | Legrandin <helderijs@gmail.com> | 2013-01-23 22:37:53 +0100 |
---|---|---|
committer | Dwayne Litzenberger <dlitz@dlitz.net> | 2013-10-20 13:30:21 -0700 |
commit | 57104488faa9fc386ea1aee249bafb6e2a529a57 (patch) | |
tree | c9f2245c097fbf4a0b00b29356c95dab2c3841aa /pct-speedtest.py | |
parent | da79b781af41ff815b812c49d9be434f5de52aa4 (diff) | |
download | pycrypto-57104488faa9fc386ea1aee249bafb6e2a529a57.tar.gz |
Add support for CCM mode (AES only).
[dlitz@dlitz.net: Included changes from the following commits from the author's pull request:]
- [5306cf3] Added support for CCM mode (AES cipher only)
- [9abe301] Added CCM tests
- [f0c1395] Add MacMismatchError and ApiUsageError
- [fb62fae] ApiUsageError becomes TypeError
- [9c13f9c] Rename 'IV' parameter to 'nonce' for AEAD modes.
- [4ec64d8] Removed last references to ApiUsageError
- [80bfd35] Corrected AES-CCM examples
[dlitz@dlitz.net: Removed unrelated documentation change]
[dlitz@dlitz.net: Renamed 'targs' back to 'args']
[dlitz@dlitz.net: Whitespace fixed with "git rebase --whitespace=fix"]
Diffstat (limited to 'pct-speedtest.py')
-rw-r--r-- | pct-speedtest.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pct-speedtest.py b/pct-speedtest.py index e84cf81..378604f 100644 --- a/pct-speedtest.py +++ b/pct-speedtest.py @@ -167,6 +167,8 @@ class Benchmark: elif mode == "CTR-LE": from Crypto.Util import Counter cipher = module.new(key, module.MODE_CTR, counter=Counter.new(module.block_size*8, little_endian=True)) + elif hasattr(module, 'MODE_CCM') and mode==module.MODE_CCM: + cipher = module.new(key, mode, iv[:8], msg_len=len(rand)*len(blocks)) elif mode==module.MODE_CTR: ctr = Crypto.Util.Counter.new(module.block_size*8, initial_value=bytes_to_long(iv), @@ -359,6 +361,8 @@ class Benchmark: self.test_encryption("%s-OPENPGP" % (cipher_name,), module, key_bytes, module.MODE_OPENPGP) self.test_encryption("%s-CTR-BE" % (cipher_name,), module, key_bytes, "CTR-BE") self.test_encryption("%s-CTR-LE" % (cipher_name,), module, key_bytes, "CTR-LE") + if hasattr(module, "MODE_CCM"): + self.test_encryption("%s-CCM" % (cipher_name,), module, key_bytes, module.MODE_CCM) # Crypto.Cipher (stream ciphers) for cipher_name, module, key_bytes in stream_specs: |