Commit graph

10 commits

Author SHA1 Message Date
Karel Miko
37a2e345a4 AES-GCM-SIV 2026-05-19 13:12:32 +02:00
Karel Miko
9b268d6258 KMAC - NIST SP 800-185 2026-05-19 13:03:25 +02:00
Steffen Jaeckel
800e5ce319 Remove OCB v1.
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-24 10:45:24 +02:00
Steffen Jaeckel
760d09031e Add Project Wycheproof testvectors for SIV.
Gemini proposed this to convert
```
import json
import requests

def to_c_hex(hex_str):
    if not hex_str: return "NULL"
    bytes_list = [f"0x{hex_str[i:i+2]}" for i in range(0, len(hex_str), 2)]
    return "{" + ",".join(bytes_list) + "}"

url = "https://raw.githubusercontent.com/C2SP/wycheproof/main/testvectors_v1/aes_siv_cmac_test.json"
data = requests.get(url).json()

print("#include <stdint.h>\n#include <stddef.h>\n")
print("typedef struct { int tcId; const char* comment; uint8_t key[64]; size_t keyLen; const uint8_t* aad; size_t aadLen; const uint8_t* msg; size_t msgLen; const uint8_t* ct; size_t ctLen; const char* result; } aes_siv_test_case;\n")

for group in data['testGroups']:
    for test in group['tests']:
        tid = test['tcId']
        if test['aad']: print(f"static const uint8_t aad_{tid}[] = {to_c_hex(test['aad'])};")
        if test['msg']: print(f"static const uint8_t msg_{tid}[] = {to_c_hex(test['msg'])};")
        if test['ct']:  print(f"static const uint8_t ct_{tid}[]  = {to_c_hex(test['ct'])};")

print("\nstatic const aes_siv_test_case aes_siv_tests[] = {")
for group in data['testGroups']:
    for test in group['tests']:
        tid = test['tcId']
        key_hex = to_c_hex(test['key'])
        aad_ptr = f"aad_{tid}" if test['aad'] else "NULL"
        msg_ptr = f"msg_{tid}" if test['msg'] else "NULL"
        ct_ptr  = f"ct_{tid}"  if test['ct']  else "NULL"

        print(f"    {{ {tid}, \"{test['comment']}\", {key_hex}, {len(test['key'])//2}, {aad_ptr}, {len(test['aad'])//2}, {msg_ptr}, {len(test['msg'])//2}, {ct_ptr}, {len(test['ct'])//2}, \"{test['result']}\" }},")
print("};")
```

I manually modified the result type to be an enum.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2026-04-23 10:30:32 +02:00
Steffen Jaeckel
faa8cd71e5 add SIV
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
2024-12-17 18:24:26 +01:00
Steffen Jaeckel
9824af8e3b update header 2020-07-14 18:41:30 +02:00
Steffen Jaeckel
24765c30c5 remove footer 2020-07-14 18:41:29 +02:00
Steffen Jaeckel
6fc0a90a1e fix headers & footers in demos & tests 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
fe19dad623 replace SVN tags 2017-06-20 15:16:11 +02:00
Steffen Jaeckel
e1a1145802 rename 'testprof/' to 'tests/' 2017-06-08 22:20:45 +02:00
Renamed from testprof/mac_test.c (Browse further)