diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-02 16:09:07 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-07-02 17:11:13 +0200 |
| commit | c766de8194c31b97173ba3f207c794a91f49c365 (patch) | |
| tree | fcd91a27df9f1f0c03950a8046b5022746128db8 /test/python/genkat_aead.py | |
| parent | b16148d754f1f09586afd76e4f23c90d00c06320 (diff) | |
| download | lilliput-ae-implem-c766de8194c31b97173ba3f207c794a91f49c365.tar.xz | |
Parallélisation de la génération des vecteurs Python
Diffstat (limited to 'test/python/genkat_aead.py')
| -rwxr-xr-x | test/python/genkat_aead.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/python/genkat_aead.py b/test/python/genkat_aead.py index db3a89c..846155f 100755 --- a/test/python/genkat_aead.py +++ b/test/python/genkat_aead.py @@ -15,6 +15,9 @@ """Python port of the genkat_aead.c program.""" +from os import path +from sys import argv + import crypto_aead @@ -31,7 +34,7 @@ def print_bstr(output, label, buf): print('{l} = {b}'.format(l=label, b=buf.hex().upper()), file=output) -def generate_test_vectors(): +def generate_test_vectors(output_dir): count = 1 filename = 'LWC_AEAD_KAT_{key}_{npub}.txt'.format( key=crypto_aead.KEYBYTES*8, npub=crypto_aead.NPUBBYTES*8 @@ -40,7 +43,7 @@ def generate_test_vectors(): npub = bytes(range(crypto_aead.NPUBBYTES)) key = bytes(range(crypto_aead.KEYBYTES)) - with open(filename, 'w') as output: + with open(path.join(output_dir, filename), 'w') as output: for mlen in range(MAX_MESSAGE_LENGTH+1): for adlen in range(MAX_ASSOCIATED_DATA_LENGTH+1): @@ -68,5 +71,13 @@ def generate_test_vectors(): print(file=output) +def main(argv): + output_dir = path.curdir + if len(argv) > 1: + output_dir = argv[1] + + generate_test_vectors(output_dir) + + if __name__ == '__main__': - generate_test_vectors() + main(argv) |
