xref: /aosp_15_r20/external/boringssl/src/crypto/spx/wots.h (revision 8fb009dc861624b67b6cdb62ea21f0f22d0c584b)
1 /* Copyright (c) 2023, Google LLC
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #ifndef OPENSSL_HEADER_CRYPTO_SPX_WOTS_H
16 #define OPENSSL_HEADER_CRYPTO_SPX_WOTS_H
17 
18 #include <openssl/base.h>
19 
20 #include "./params.h"
21 
22 #if defined(__cplusplus)
23 extern "C" {
24 #endif
25 
26 
27 // Algorithm 5: Generate a WOTS+ public key.
28 void spx_wots_pk_gen(uint8_t *pk, const uint8_t sk_seed[SPX_N],
29                      const uint8_t pub_seed[SPX_N], uint8_t addr[32]);
30 
31 // Algorithm 6: Generate a WOTS+ signature on an n-byte message.
32 void spx_wots_sign(uint8_t *sig, const uint8_t msg[SPX_N],
33                    const uint8_t sk_seed[SPX_N], const uint8_t pub_seed[SPX_N],
34                    uint8_t addr[32]);
35 
36 // Algorithm 7: Compute a WOTS+ public key from a message and its signature.
37 void spx_wots_pk_from_sig(uint8_t *pk, const uint8_t *sig, const uint8_t *msg,
38                           const uint8_t pub_seed[SPX_N], uint8_t addr[32]);
39 
40 
41 #if defined(__cplusplus)
42 }  // extern C
43 #endif
44 
45 #endif  // OPENSSL_HEADER_CRYPTO_SPX_WOTS_H
46