diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-25 05:10:40 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-25 05:10:40 +0300 |
commit | 8ebebf9f27070bccd4df8949aadf4ca2860bf4b1 (patch) | |
tree | 9c1c9519dcbaf6cbaabeef3d6785b2d1b7f153ca /test | |
parent | cxx: import more stuff (diff) | |
download | aes-tools-8ebebf9f27070bccd4df8949aadf4ca2860bf4b1.tar.gz aes-tools-8ebebf9f27070bccd4df8949aadf4ca2860bf4b1.zip |
merge specialized block utils into general ones
... taking advantage of the new template interface.
Diffstat (limited to '')
-rw-r--r-- | test/README.md | 4 | ||||
-rw-r--r-- | test/cavp.py | 4 | ||||
-rw-r--r-- | test/nist-sp-800-38a.py | 4 | ||||
-rw-r--r-- | test/toolkit.py | 5 |
4 files changed, 12 insertions, 5 deletions
diff --git a/test/README.md b/test/README.md index 7b3b128..5121a33 100644 --- a/test/README.md +++ b/test/README.md @@ -41,11 +41,11 @@ Use `--help` to see the script's usage details. To test the implementation against the vectors from [NIST SP 800-38A](http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf) using `nist-sp-800-32a.py`. - python nist-sp-800-38a.py -p C:\build\utils\block\cxx\Debug + python nist-sp-800-38a.py -p C:\build\utils\block\Debug ### Cryptographic Algorithm Validation Program To test the implementation against the vectors from [CAVP](http://csrc.nist.gov/groups/STM/cavp/) using `cavp.py`. The AES Known Answer Test (KAT) Vectors are used and read from `KAT_AES.zip`. - python cavp.py -p C:\build\utils\block\cxx\Debug + python cavp.py -p C:\build\utils\block\Debug diff --git a/test/cavp.py b/test/cavp.py index 474818d..059bcd2 100644 --- a/test/cavp.py +++ b/test/cavp.py @@ -178,6 +178,8 @@ if __name__ == '__main__': help='set path to block encryption utilities') parser.add_argument('--sde', '-e', action='store_true', help='use Intel SDE to run *.exe files') + parser.add_argument('--box', '-b', action='store_true', + help='use the "boxes" interface') parser.add_argument('--log', '-l', help='set log file path') args = parser.parse_args() @@ -189,5 +191,5 @@ if __name__ == '__main__': logging_options['filename'] = args.log logging.basicConfig(**logging_options) - tools = toolkit.Tools(args.path, use_sde=args.sde) + tools = toolkit.Tools(args.path, use_sde=args.sde, use_boxes=args.box) _parse_test_vectors_archive(tools) diff --git a/test/nist-sp-800-38a.py b/test/nist-sp-800-38a.py index c5c0af8..8a7d010 100644 --- a/test/nist-sp-800-38a.py +++ b/test/nist-sp-800-38a.py @@ -148,10 +148,12 @@ if __name__ == '__main__': help='set path to block encryption utilities') parser.add_argument('--sde', '-e', action='store_true', help='use Intel SDE to run *.exe files') + parser.add_argument('--box', '-b', action='store_true', + help='use the "boxes" interface') parser.add_argument('--log', '-l', help='set log file path') args = parser.parse_args() - tools = toolkit.Tools(args.path, args.sde) + tools = toolkit.Tools(args.path, use_sde=args.sde, use_boxes=args.box) logging_options = {'format': '%(asctime)s | %(module)s | %(levelname)s | %(message)s', 'level': logging.DEBUG} diff --git a/test/toolkit.py b/test/toolkit.py index bd50edc..39bc350 100644 --- a/test/toolkit.py +++ b/test/toolkit.py @@ -67,7 +67,7 @@ class ToolkitError(RuntimeError): pass class Tools: - def __init__(self, search_dirs, use_sde=False): + def __init__(self, search_dirs, use_sde=False, use_boxes=False): if search_dirs: if isinstance(search_dirs, str): os.environ['PATH'] += os.pathsep + search_dirs @@ -76,6 +76,7 @@ class Tools: else: os.environ['PATH'] += os.pathsep + str(search_dirs) self._use_sde = use_sde + self._use_boxes = use_boxes self._logger = logging.getLogger(__name__) _ENCRYPT_BLOCK = 'aes_encrypt_block.exe' @@ -83,6 +84,8 @@ class Tools: def run(self, tool_path, algo, mode, args): cmd_list = ['sde', '--', tool_path] if self._use_sde else [tool_path] + if self._use_boxes: + cmd_list.append('-b') cmd_list.extend(('-a', algo, '-m', mode, '--')) cmd_list.extend(args) logging.info('Trying to execute: {0}'.format(subprocess.list2cmdline(cmd_list))) |