aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-02-12 22:32:18 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-02-12 22:32:18 +0300
commitf2c8c71de58646d8e200a9f8cc0a126db8ef7871 (patch)
tree2b48111e11fff0eb8612ebfa28b5d2f4d3d74739
parenttest: refactoring (diff)
downloadaes-tools-f2c8c71de58646d8e200a9f8cc0a126db8ef7871.tar.gz
aes-tools-f2c8c71de58646d8e200a9f8cc0a126db8ef7871.zip
test: refactoring
-rw-r--r--test/nist-sp-800-38a.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/nist-sp-800-38a.py b/test/nist-sp-800-38a.py
index 07bf817..a8fb57e 100644
--- a/test/nist-sp-800-38a.py
+++ b/test/nist-sp-800-38a.py
@@ -3,6 +3,7 @@
# See LICENSE.txt for details.
from datetime import datetime
+from enum import Enum
import logging
import os.path
import sys
@@ -22,15 +23,15 @@ _TEST_KEYS = {
toolkit.AES256: '603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4'
}
-_TEST_IV = '000102030405060708090a0b0c0d0e0f'
-_TEST_IV_CTR = 'f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff'
+_TEST_INIT_VECTOR = '000102030405060708090a0b0c0d0e0f'
+_TEST_INIT_VECTOR_CTR = 'f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff'
_TEST_INIT_VECTORS = {
toolkit.AES128: {
- toolkit.CBC: _TEST_IV,
- toolkit.CFB: _TEST_IV,
- toolkit.OFB: _TEST_IV,
- toolkit.CTR: _TEST_IV_CTR
+ toolkit.CBC: _TEST_INIT_VECTOR,
+ toolkit.CFB: _TEST_INIT_VECTOR,
+ toolkit.OFB: _TEST_INIT_VECTOR,
+ toolkit.CTR: _TEST_INIT_VECTOR_CTR
}
}
@@ -164,8 +165,8 @@ def verify_test_output(actual, expected):
return False
return True
-class TestExitCode:
- SUCCESS, FAILURE, ERROR, SKIPPED = range(4)
+class TestExitCode(Enum):
+ SUCCESS, FAILURE, ERROR, SKIPPED = range(1, 5)
def run_encryption_test(tools, algorithm, mode, use_boxes=False):
logging.info('Running encryption test...')
@@ -244,8 +245,7 @@ if __name__ == '__main__':
logging.basicConfig(filename=args.log,
format='%(asctime)s | %(module)s | %(levelname)s | %(message)s',
- level=logging.DEBUG,
- datefmt='%Y-%m-%d %H:%M:%S')
+ level=logging.DEBUG)
exit_codes = []
for algorithm, mode in get_tested_algorithms_and_modes():