Software APIs
context.h
1 // Copyright lowRISC contributors (OpenTitan project).
2 // Licensed under the Apache License, Version 2.0, see LICENSE for details.
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // Derived from code in the SPHINCS+ reference implementation (CC0 license):
6 // https://github.com/sphincs/sphincsplus/blob/ed15dd78658f63288c7492c00260d86154b84637/ref/context.h
7 
8 #ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_SIGVERIFY_SPHINCSPLUS_CONTEXT_H_
9 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_SIGVERIFY_SPHINCSPLUS_CONTEXT_H_
10 
11 #include <stdint.h>
12 
13 #include "sw/device/silicon_creator/lib/drivers/hmac.h"
14 #include "sw/device/silicon_creator/lib/sigverify/sphincsplus/params.h"
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /**
21  * Context object for the SPHINCS+ operation.
22  *
23  * The reference implementation stores `sk_seed` here as well, but we only
24  * performing verification so we don't need it.
25  */
26 typedef struct spx_ctx {
27  /**
28  * Public key seed.
29  */
30  uint32_t pub_seed[kSpxNWords];
31  /**
32  * SHA256 state that absorbed pub_seed and padding.
33  */
35 } spx_ctx_t;
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_SIGVERIFY_SPHINCSPLUS_CONTEXT_H_