Debian Codegraph @

others/mbedtls/tf-psa-crypto/drivers/pqcp/mldsa-native/examples/basic/mldsa_native/src/params.h

raw
1 /*
2 * Copyright (c) The mldsa-native project authors
3 * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4 */
5 #ifndef MLD_PARAMS_H
6 #define MLD_PARAMS_H
7
8 #define MLDSA_SEEDBYTES 32
9 #define MLDSA_CRHBYTES 64
10 #define MLDSA_TRBYTES 64
11 #define MLDSA_RNDBYTES 32
12 #define MLDSA_N 256
13 #define MLDSA_Q 8380417
14 #define MLDSA_Q_HALF ((MLDSA_Q + 1) / 2)
15 #define MLDSA_D 13
16
17 #if MLD_CONFIG_PARAMETER_SET == 44
18
19 #define MLDSA_K 4
20 #define MLDSA_L 4
21 #define MLDSA_ETA 2
22 #define MLDSA_TAU 39
23 #define MLDSA_BETA 78
24 #define MLDSA_GAMMA1 (1 << 17)
25 #define MLDSA_GAMMA2 ((MLDSA_Q - 1) / 88)
26 #define MLDSA_OMEGA 80
27 #define MLDSA_CTILDEBYTES 32
28 #define MLDSA_POLYZ_PACKEDBYTES 576
29 #define MLDSA_POLYW1_PACKEDBYTES 192
30 #define MLDSA_POLYETA_PACKEDBYTES 96
31
32 #elif MLD_CONFIG_PARAMETER_SET == 65
33
34 #define MLDSA_K 6
35 #define MLDSA_L 5
36 #define MLDSA_ETA 4
37 #define MLDSA_TAU 49
38 #define MLDSA_BETA 196
39 #define MLDSA_GAMMA1 (1 << 19)
40 #define MLDSA_GAMMA2 ((MLDSA_Q - 1) / 32)
41 #define MLDSA_OMEGA 55
42 #define MLDSA_CTILDEBYTES 48
43 #define MLDSA_POLYZ_PACKEDBYTES 640
44 #define MLDSA_POLYW1_PACKEDBYTES 128
45 #define MLDSA_POLYETA_PACKEDBYTES 128
46
47 #elif MLD_CONFIG_PARAMETER_SET == 87
48
49 #define MLDSA_K 8
50 #define MLDSA_L 7
51 #define MLDSA_ETA 2
52 #define MLDSA_TAU 60
53 #define MLDSA_BETA 120
54 #define MLDSA_GAMMA1 (1 << 19)
55 #define MLDSA_GAMMA2 ((MLDSA_Q - 1) / 32)
56 #define MLDSA_OMEGA 75
57 #define MLDSA_CTILDEBYTES 64
58 #define MLDSA_POLYZ_PACKEDBYTES 640
59 #define MLDSA_POLYW1_PACKEDBYTES 128
60 #define MLDSA_POLYETA_PACKEDBYTES 96
61
62 #endif /* MLD_CONFIG_PARAMETER_SET == 87 */
63
64 #define MLDSA_POLYT1_PACKEDBYTES 320
65 #define MLDSA_POLYT0_PACKEDBYTES 416
66 #define MLDSA_POLYVECH_PACKEDBYTES (MLDSA_OMEGA + MLDSA_K)
67
68 #define MLDSA_CRYPTO_PUBLICKEYBYTES \
69 (MLDSA_SEEDBYTES + MLDSA_K * MLDSA_POLYT1_PACKEDBYTES)
70 #define MLDSA_CRYPTO_SECRETKEYBYTES \
71 (2 * MLDSA_SEEDBYTES + MLDSA_TRBYTES + MLDSA_L * MLDSA_POLYETA_PACKEDBYTES + \
72 MLDSA_K * MLDSA_POLYETA_PACKEDBYTES + MLDSA_K * MLDSA_POLYT0_PACKEDBYTES)
73 #define MLDSA_CRYPTO_BYTES \
74 (MLDSA_CTILDEBYTES + MLDSA_L * MLDSA_POLYZ_PACKEDBYTES + \
75 MLDSA_POLYVECH_PACKEDBYTES)
76
77 #endif /* !MLD_PARAMS_H */