aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/nist.py
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-23 12:09:52 +0200
committerEgor Tensin <egor@tensin.name>2026-06-23 12:15:17 +0200
commitd23c5c00666fb83cd47a0136034164e8ef5a7df4 (patch)
tree26662afb1b15bcd4abe0e19f6efc78fb9f574a01 /test/nist.py
parenttest: add comments with sources (diff)
downloadaes-tools-d23c5c00666fb83cd47a0136034164e8ef5a7df4.tar.gz
aes-tools-d23c5c00666fb83cd47a0136034164e8ef5a7df4.zip
test: proper logging setup
Diffstat (limited to 'test/nist.py')
-rwxr-xr-xtest/nist.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/test/nist.py b/test/nist.py
index d9b0477..447d34d 100755
--- a/test/nist.py
+++ b/test/nist.py
@@ -11,7 +11,7 @@ import logging
from subprocess import CalledProcessError
import sys
-from toolkit import Algorithm, BlockInput, Mode, Tools
+from toolkit import Algorithm, BlockInput, Mode, Tools, setup_logging
# The data is from "Example Vectors for Modes of Operation of the AES":
# https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf
@@ -226,15 +226,7 @@ def run_decryption_test(tools, algorithm, mode, use_boxes=False):
return TestExitCode.ERROR
-def _setup_logging(verbose=False):
- level = logging.DEBUG if verbose else logging.INFO
- logging.basicConfig(
- format="%(asctime)s | %(module)s | %(levelname)s | %(message)s", level=level
- )
-
-
def run_tests(tools_path=(), use_sde=False, use_boxes=False, verbose=False):
- _setup_logging(verbose)
tools = Tools(tools_path, use_sde=use_sde)
exit_codes = []
@@ -294,7 +286,9 @@ def _parse_args(args=None):
def main(args=None):
- return run_tests(**vars(_parse_args(args)))
+ args = _parse_args(args)
+ with setup_logging(args.verbose):
+ return run_tests(**vars(args))
if __name__ == "__main__":