Commit e76f5b18 by Enrico Pozzobon

added test vector without AD

parent c87607fe
......@@ -601,8 +601,29 @@ def identify_test_vector(kat_path):
return False
return True
def is_nist_aead_kat_no_ad(kat):
if len(kat) != 16:
return False
def genstr(length):
return bytes([b % 256 for b in range(length)])
expected_k = genstr(len(kat[0][3]))
expected_npub = genstr(len(kat[0][4]))
expected_i = 0
expected_ad = b""
for i, m, ad, k, npub, c in kat:
expected_m = genstr(i-1)
expected_i += 1
if not (expected_i == i and expected_m == m and
expected_k == k and expected_ad == ad and
expected_npub == npub):
return False
return True
if is_nist_aead_kat(kat):
return "NIST AEAD KAT"
if is_nist_aead_kat_no_ad(kat):
return "NIST AEAD KAT NO AD"
return None
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment