]>
Commit | Line | Data |
---|---|---|
73a32740 AS |
1 | /* |
2 | * Copyright (C) 2014 Andreas Steffen | |
3 | * HSR Hochschule fuer Technik Rapperswil | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU General Public License as published by the | |
7 | * Free Software Foundation; either version 2 of the License, or (at your | |
8 | * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, but | |
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | |
12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
13 | * for more details. | |
14 | */ | |
15 | ||
16 | /** | |
17 | * @defgroup bliss_param_set bliss_param_set | |
18 | * @{ @ingroup bliss_p | |
19 | */ | |
20 | ||
21 | #ifndef BLISS_PARAM_SET_H_ | |
22 | #define BLISS_PARAM_SET_H_ | |
23 | ||
24 | typedef enum bliss_param_set_id_t bliss_param_set_id_t; | |
25 | typedef struct bliss_param_set_t bliss_param_set_t; | |
26 | ||
27 | #include "bliss_fft_params.h" | |
28 | ||
29 | #include <library.h> | |
30 | ||
31 | /** | |
32 | * BLISS signature parameter set ID list | |
33 | */ | |
34 | enum bliss_param_set_id_t { | |
35 | BLISS_I = 1, | |
36 | BLISS_II = 2, | |
37 | BLISS_III = 3, | |
38 | BLISS_IV = 4 | |
39 | }; | |
40 | ||
41 | extern enum_name_t *bliss_param_set_id_names; | |
42 | ||
43 | /** | |
44 | * BLISS | |
45 | */ | |
46 | struct bliss_param_set_t { | |
47 | ||
48 | /** | |
49 | * BLISS parameter set ID | |
50 | */ | |
51 | bliss_param_set_id_t id; | |
52 | ||
53 | /** | |
54 | * BLISS parameter set OID | |
55 | */ | |
56 | int oid; | |
57 | ||
58 | /** | |
59 | * Security strength in bits | |
60 | */ | |
61 | uint16_t strength; | |
62 | ||
63 | /** | |
64 | * Prime modulus | |
65 | */ | |
66 | uint16_t q; | |
67 | ||
0d8a3f5d AS |
68 | /** |
69 | * Number of bits in q | |
70 | */ | |
71 | uint16_t q_bits; | |
72 | ||
e71813e5 AS |
73 | /** |
74 | * Inverse of (q + 2) mod 2q | |
75 | */ | |
76 | uint16_t q2_inv; | |
77 | ||
73a32740 AS |
78 | /** |
79 | * Ring dimension equal to the number of polynomial coefficients | |
80 | */ | |
81 | uint16_t n; | |
82 | ||
83 | /** | |
84 | * Number of bits in n | |
85 | */ | |
86 | uint16_t n_bits; | |
87 | ||
88 | /** | |
89 | * FFT parameters | |
90 | */ | |
91 | bliss_fft_params_t *fft_params; | |
92 | ||
93 | /** | |
94 | * Number of [-1, +1] secret key coefficients | |
95 | */ | |
96 | uint16_t non_zero1; | |
97 | ||
98 | /** | |
99 | * Number of [-2, +2] secret key coefficients | |
100 | */ | |
101 | uint16_t non_zero2; | |
102 | ||
103 | /** | |
104 | * Number of secret key terms that go into Nk(S) norm | |
105 | */ | |
106 | uint16_t kappa; | |
107 | ||
108 | /** | |
109 | * Maximum Nk(S) tolerable NK(S) norm | |
110 | */ | |
111 | uint32_t nks_max; | |
112 | ||
edd72b6b AS |
113 | /** |
114 | * k_sigma = ceiling[ sqrt(2*ln 2) * sigma ] | |
115 | */ | |
116 | uint16_t k_sigma; | |
117 | ||
118 | /** | |
119 | * Number of bits in k_sigma | |
120 | */ | |
121 | uint16_t k_sigma_bits; | |
122 | ||
123 | /** | |
124 | * Coefficients for Bernoulli sampling with exponential biases | |
125 | */ | |
126 | uint8_t *c; | |
127 | ||
128 | /** | |
129 | * Number of columns in Bernoulli coefficient table | |
130 | */ | |
131 | size_t c_cols; | |
132 | ||
133 | /** | |
134 | * Number of rows in Bernoulli coefficient table | |
135 | */ | |
136 | size_t c_rows; | |
137 | ||
e71813e5 | 138 | /** |
b352ee42 AS |
139 | * Number of bits in z1 |
140 | */ | |
141 | uint16_t z1_bits; | |
142 | ||
143 | /** | |
144 | * Number of z2 bits to be dropped after rounding | |
e71813e5 AS |
145 | */ |
146 | uint16_t d; | |
147 | ||
148 | /** | |
149 | * Modulus p = floor(2q / 2^d) applied after bit dropping | |
150 | */ | |
151 | uint16_t p; | |
152 | ||
153 | /** | |
154 | * M = sigma^2 / alpha_rejection^2 | |
155 | */ | |
156 | uint32_t M; | |
157 | ||
158 | /** | |
159 | * B_infinity bound | |
160 | */ | |
161 | uint16_t B_inf; | |
162 | ||
163 | /** | |
164 | * B_verify bound | |
165 | */ | |
166 | uint32_t B_l2; | |
73a32740 AS |
167 | }; |
168 | ||
169 | /** | |
170 | * Get BLISS signature parameter set by BLISS parameter set ID | |
171 | * | |
172 | * @param id BLISS parameter set ID | |
173 | * @return BLISS parameter set | |
174 | */ | |
175 | bliss_param_set_t* bliss_param_set_get_by_id(bliss_param_set_id_t id); | |
176 | ||
177 | /** | |
178 | * Get BLISS signature parameter set by BLISS parameter set OID | |
179 | * | |
180 | * @param oid BLISS parameter set OID | |
181 | * @return BLISS parameter set | |
182 | */ | |
183 | bliss_param_set_t* bliss_param_set_get_by_oid(int oid); | |
184 | ||
185 | #endif /** BLISS_PARAM_SET_H_ @}*/ |