summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne C. Litzenberger <dlitz@dlitz.net>2009-10-10 16:03:09 -0400
committerDwayne C. Litzenberger <dlitz@dlitz.net>2009-10-12 14:48:57 -0400
commitaf0a596ba610ee63830a889d4c67355144a63b6b (patch)
tree1d1623c29cac8d8565e48f72491d211330f098fb
parentf189a040326eb479ee19a9cd82c54ebf1de0e893 (diff)
downloadpycrypto-af0a596ba610ee63830a889d4c67355144a63b6b.tar.gz
SelfTest: When testing CTR mode ciphers, test both with the shortcut and without the shortcut
-rw-r--r--lib/Crypto/SelfTest/Cipher/common.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Crypto/SelfTest/Cipher/common.py b/lib/Crypto/SelfTest/Cipher/common.py
index b795fb1..7c0beb8 100644
--- a/lib/Crypto/SelfTest/Cipher/common.py
+++ b/lib/Crypto/SelfTest/Cipher/common.py
@@ -213,6 +213,16 @@ def make_block_tests(module, module_name, test_data):
extra_tests_added = 1
if p_mode == 'CTR':
tests.append(CipherStreamingSelfTest(module, params))
+
+ # When using CTR mode, test the non-shortcut code path.
+ if p_mode == 'CTR' and not params.has_key('ctr_class'):
+ params2 = params.copy()
+ params2['description'] += " (shortcut disabled)"
+ ctr_params2 = params.get('ctr_params', {}).copy()
+ params2['ctr_params'] = ctr_params2
+ if not params2['ctr_params'].has_key('disable_shortcut'):
+ params2['ctr_params']['disable_shortcut'] = 1
+ tests.append(CipherSelfTest(module, params2))
return tests
def make_stream_tests(module, module_name, test_data):