Software APIs
wots.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/wots.h
7 
8 #ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_SIGVERIFY_SPHINCSPLUS_WOTS_H_
9 #define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_SIGVERIFY_SPHINCSPLUS_WOTS_H_
10 
11 #include <stdint.h>
12 
14 #include "sw/device/silicon_creator/lib/error.h"
15 #include "sw/device/silicon_creator/lib/sigverify/sphincsplus/address.h"
16 #include "sw/device/silicon_creator/lib/sigverify/sphincsplus/context.h"
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /**
23  * Compute a WOTS public key from a signature and message.
24  *
25  * The caller is responsible for ensuring `kSpxWotsPkWords` of space are
26  * available at `pk`.
27  *
28  * @param sig Input signature (`kSpxWotsBytes` bytes).
29  * @param msg Input message (`kSpxWotsLen1 * kSpxWotsLogW` bytes).
30  * @param ctx Context object.
31  * @param addr Hypertree address.
32  * @param[out] pk Resulting WOTS public key.
33  */
34 void wots_pk_from_sig(const uint32_t *sig, const uint32_t *msg,
35  const spx_ctx_t *ctx, spx_addr_t *addr, uint32_t *pk);
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 
41 #endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_SIGVERIFY_SPHINCSPLUS_WOTS_H_