diff --git a/test_common.py b/test_common.py index 2d9166a..90df4af 100644 --- a/test_common.py +++ b/test_common.py @@ -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