summaryrefslogtreecommitdiff
path: root/python/genkat_aead.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/genkat_aead.py')
-rwxr-xr-xpython/genkat_aead.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/python/genkat_aead.py b/python/genkat_aead.py
index e9f9101..3a69d72 100755
--- a/python/genkat_aead.py
+++ b/python/genkat_aead.py
@@ -46,6 +46,9 @@ def generate_test_vectors(mode, keylen):
directory, 'LWC_AEAD_KAT_{keylen}_120.txt'.format(keylen=keylen)
)
+ nonce = bytes(range(CRYPTO_NPUBBYTES))
+ key = bytes(range(keylen//8))
+
with open(output_path, 'w') as output:
count = 1
@@ -56,16 +59,16 @@ def generate_test_vectors(mode, keylen):
msg = bytes(range(mlen))
ad = bytes(range(adlen))
- print_bstr(output, 'Key', bytes(range(keylen//8)))
- print_bstr(output, 'Nonce', bytes(range(CRYPTO_NPUBBYTES)))
+ print_bstr(output, 'Key', key)
+ print_bstr(output, 'Nonce', nonce)
print_bstr(output, 'PT', msg)
print_bstr(output, 'AD', ad)
- ct, tag = lilliput.mainEnc(msg, ad, mode, keylen)
+ ct, tag = lilliput.mainEnc(msg, ad, key, nonce, mode, keylen)
print_bstr(output, 'CT', ct+tag)
- msg2 = lilliput.mainDec(ct, tag, ad, mode, keylen)
+ msg2 = lilliput.mainDec(ct, tag, ad, key, nonce, mode, keylen)
if msg != msg2:
raise DecryptionError(msg, msg2, mode, keylen)