5 #include "sw/device/silicon_creator/lib/sigverify/sphincsplus/thash.h"
11 #include "sw/device/lib/testing/test_framework/check.h"
13 #include "sw/device/silicon_creator/lib/sigverify/sphincsplus/hash.h"
15 OTTF_DEFINE_TEST_CONFIG();
18 static uint32_t kTestMsg[2 * kSpxNWords] = {
19 0x03020100, 0x07060504, 0x0b0a0908, 0x0f0e0d0c,
20 0x13121110, 0x17161514, 0x1b1a1918, 0x1f1e1d1c,
39 static uint32_t kExpectedResult[kSpxNWords] = {
47 static rom_error_t thash_test(
void) {
48 RETURN_IF_ERROR(spx_hash_initialize(&kTestCtx));
50 size_t msg_blocks =
sizeof(kTestMsg) / kSpxN;
51 uint32_t result[kSpxNWords];
52 thash(kTestMsg, msg_blocks, &kTestCtx, &kTestAddr, result);
54 CHECK_ARRAYS_EQ(result, kExpectedResult, kSpxNWords);
61 spx_addr_layer_set(&kTestAddr, 0xa3);
62 spx_addr_tree_set(&kTestAddr, 0xafaeadacabaaa9a8);
63 spx_addr_type_set(&kTestAddr, kSpxAddrTypeForsTree);
64 spx_addr_keypair_set(&kTestAddr, 0xb4b5b6b7);
67 return status_ok(result);