xref: /freebsd/crypto/openssl/crypto/slh_dsa/slh_params.h (revision e7be843b4a162e68651d3911f0357ed464915629)
1 /*
2  * Copyright 2024-2025 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9 
10 #include <openssl/e_os2.h>
11 
12 /*
13  * PRF(), F() use this value to calculate the number of zeros
14  * H(), T() use this to calculate the number of zeros for security cat 1
15  */
16 #define OSSL_SLH_DSA_SHA2_NUM_ZEROS_H_AND_T_BOUND1 64
17 
18 /*
19  * Refer to FIPS 205 Section 11 parameter sets.
20  * lgw has been omitted since it is 4 for all algorithms i.e. log(16)
21  */
22 typedef struct slh_dsa_params_st {
23     const char *alg;
24     int type;
25     int is_shake;
26     uint32_t n;  /* Security parameter (Hash output size in bytes) (16, 24, 32) */
27     uint32_t h;  /* The total height of the tree (63, 64, 66, 68). #keypairs = 2^h */
28     uint32_t d;  /* The number of tree layers (7, 8, 17, 22) */
29     uint32_t hm; /* The height (h') of each merkle tree. (h = hm * d ) */
30     uint32_t a;  /* Height of a FORS tree */
31     uint32_t k;  /* The number of FORS trees */
32     uint32_t m;  /* The size of H_MSG() output */
33     uint32_t security_category;
34     uint32_t pk_len;
35     uint32_t sig_len;
36     size_t sha2_h_and_t_bound;
37 } SLH_DSA_PARAMS;
38 
39 const SLH_DSA_PARAMS *ossl_slh_dsa_params_get(const char *alg);
40