dep-libtomcrypt/tests
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
..
asn1 add testvectors from [1] 2018-02-25 20:42:26 +01:00
pem Fix handling of trailing spaces when decoding PEM files 2024-10-12 14:04:49 +02:00
rsa add testvectors from [1] 2018-02-25 20:42:26 +01:00
rsa-pkcs8 Add SHA3-HMAC support to PKCS#8 2025-11-03 13:52:38 +01:00
argon2_test.c Minor changes of argon2 implementation. 2026-04-12 16:06:53 +02:00
base16_test.c Use COMPARE_TESTVECTOR() consistently 2025-09-06 15:00:00 +02:00
base32_test.c Use COMPARE_TESTVECTOR() consistently 2025-09-06 15:00:00 +02:00
base64_test.c Deprecate compare_testvector(). 2025-11-24 14:58:13 +01:00
bcrypt_test.c Use COMPARE_TESTVECTOR() consistently 2025-09-06 15:00:00 +02:00
cipher_hash_test.c Make HW-accel checkers always available. 2026-04-23 09:13:02 +02:00
CMakeLists.txt Use cmake-format to format CMake files 2024-12-03 19:51:26 +01:00
common.c Deprecate compare_testvector(). 2025-11-24 14:58:13 +01:00
common.h Deprecate compare_testvector(). 2025-11-24 14:58:13 +01:00
deprecated_test.c Introduce new RSA API. 2026-04-15 11:12:30 +02:00
der_test.c Add demos/der_print_flexi.c 2025-11-03 13:56:42 +01:00
dh_test.c Use COMPARE_TESTVECTOR() consistently 2025-09-06 15:00:00 +02:00
dsa_test.c Deprecate compare_testvector(). 2025-11-24 14:58:13 +01:00
ecc_test.c Replace int* recid hack in ECC. 2026-04-23 09:13:02 +02:00
ed25519_test.c Add LTC_ARRAY_SIZE() macro 2025-09-06 15:00:00 +02:00
file_test.c Fix build with -DLTC_MINIMAL. 2026-04-23 09:13:02 +02:00
mac_test.c Add Project Wycheproof testvectors for SIV. 2026-04-23 10:30:32 +02:00
misc_test.c The scrypt Password-Based Key Derivation Function (RFC 7914) 2026-04-14 13:59:38 +02:00
modes_test.c Re-factor modes_test(). 2025-11-24 14:58:13 +01:00
mpi_test.c Use COMPARE_TESTVECTOR() consistently 2025-09-06 15:00:00 +02:00
multi_test.c Fix build with -DLTC_MINIMAL. 2026-04-23 09:13:02 +02:00
no_null_termination_check_test.c add test-case that uses LTC_NO_NULL_TERMINATION_CHECK 2022-09-02 11:30:45 +02:00
no_prng.c Minor fixes 2025-11-03 13:52:16 +01:00
padding_test.c Make depadding better against timing attacks. 2026-04-23 10:30:27 +02:00
pem_test.c Fix hang when decoding PEM 2024-10-12 14:04:33 +02:00
pk_oid_test.c Add tests for & fix pk_oid API 2025-09-12 18:25:09 +02:00
pkcs_1_eme_test.c RSA: replace hash_alg + mgf1_hash_alg with hash_idx + mgf1_hash_idx 2026-04-15 11:12:30 +02:00
pkcs_1_emsa_test.c RSA: replace hash_alg + mgf1_hash_alg with hash_idx + mgf1_hash_idx 2026-04-15 11:12:30 +02:00
pkcs_1_oaep_test.c RSA: replace hash_alg + mgf1_hash_alg with hash_idx + mgf1_hash_idx 2026-04-15 11:12:30 +02:00
pkcs_1_pss_test.c RSA: replace hash_alg + mgf1_hash_alg with hash_idx + mgf1_hash_idx 2026-04-15 11:12:30 +02:00
pkcs_1_test.c RSA: replace hash_alg + mgf1_hash_alg with hash_idx + mgf1_hash_idx 2026-04-15 11:12:30 +02:00
prng_test.c Deprecate compare_testvector(). 2025-11-24 14:58:13 +01:00
rotate_test.c update header 2020-07-14 18:41:30 +02:00
rsa_test.c RSA: replace hash_alg + mgf1_hash_alg with hash_idx + mgf1_hash_idx 2026-04-15 11:12:30 +02:00
scrypt_test.c The scrypt Password-Based Key Derivation Function (RFC 7914) 2026-04-14 13:59:38 +02:00
siv_wycheproof.h Add Project Wycheproof testvectors for SIV. 2026-04-23 10:30:32 +02:00
siv_wycheproof_test.c Add Project Wycheproof testvectors for SIV. 2026-04-23 10:30:32 +02:00
sources.cmake Add Project Wycheproof testvectors for SIV. 2026-04-23 10:30:32 +02:00
ssh_test.c prefix the MPI related macros with ltc_ 2025-02-20 14:41:50 +01:00
store_test.c Make store_test() a bit more aggressive. 2025-11-03 13:52:29 +01:00
test.c Make HW-accel checkers always available. 2026-04-23 09:13:02 +02:00
test.der rename 'testprof/' to 'tests/' 2017-06-08 22:20:45 +02:00
test.key rename 'testprof/' to 'tests/' 2017-06-08 22:20:45 +02:00
test_dsa.key rename 'testprof/' to 'tests/' 2017-06-08 22:20:45 +02:00
tomcrypt_test.h Add Project Wycheproof testvectors for SIV. 2026-04-23 10:30:32 +02:00
x25519_test.c Deprecate compare_testvector(). 2025-11-24 14:58:13 +01:00