Annotation of embedaddon/strongswan/src/libstrongswan/plugins/bliss/bliss_param_set.h, revision 1.1.1.1
1.1 misho 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 "ntt_fft_params.h"
28: #include "bliss_huffman_code.h"
29:
30: #include <library.h>
31:
32: /**
33: * BLISS signature parameter set ID list
34: */
35: enum bliss_param_set_id_t {
36: BLISS_I = 1,
37: BLISS_II = 2,
38: BLISS_III = 3,
39: BLISS_IV = 4,
40: BLISS_B_I = 5,
41: BLISS_B_II = 6,
42: BLISS_B_III = 7,
43: BLISS_B_IV = 8
44: };
45:
46: extern enum_name_t *bliss_param_set_id_names;
47:
48: /**
49: * BLISS
50: */
51: struct bliss_param_set_t {
52:
53: /**
54: * BLISS parameter set ID
55: */
56: const bliss_param_set_id_t id;
57:
58: /**
59: * BLISS parameter set OID
60: */
61: const int oid;
62:
63: /**
64: * Security strength in bits
65: */
66: const uint16_t strength;
67:
68: /**
69: * Prime modulus
70: */
71: const uint16_t q;
72:
73: /**
74: * Number of bits in q
75: */
76: const uint16_t q_bits;
77:
78: /**
79: * Inverse of (q + 2) mod 2q
80: */
81: const uint16_t q2_inv;
82:
83: /**
84: * Ring dimension equal to the number of polynomial coefficients
85: */
86: const uint16_t n;
87:
88: /**
89: * Number of bits in n
90: */
91: const uint16_t n_bits;
92:
93: /**
94: * FFT parameters
95: */
96: const ntt_fft_params_t *fft_params;
97:
98: /**
99: * Number of [-1, +1] secret key coefficients
100: */
101: const uint16_t non_zero1;
102:
103: /**
104: * Number of [-2, +2] secret key coefficients
105: */
106: const uint16_t non_zero2;
107:
108: /**
109: * Number of secret key terms that go into Nk(S) norm
110: */
111: const uint16_t kappa;
112:
113: /**
114: * Maximum Nk(S) tolerable NK(S) norm (BLISS only)
115: */
116: const uint32_t nks_max;
117:
118: /**
119: * Maximum value Pmax for ||Sc'||^2 norm (BLISS-B only)
120: */
121: const uint32_t p_max;
122:
123: /**
124: * Standard deviation sigma
125: */
126: const uint16_t sigma;
127:
128: /**
129: * k_sigma = ceiling[ sqrt(2*ln 2) * sigma ]
130: */
131: const uint16_t k_sigma;
132:
133: /**
134: * Number of bits in k_sigma
135: */
136: const uint16_t k_sigma_bits;
137:
138: /**
139: * Coefficients for Bernoulli sampling with exponential biases
140: */
141: const uint8_t *c;
142:
143: /**
144: * Number of columns in Bernoulli coefficient table
145: */
146: const size_t c_cols;
147:
148: /**
149: * Number of rows in Bernoulli coefficient table
150: */
151: const size_t c_rows;
152:
153: /**
154: * Number of bits in z1
155: */
156: const uint16_t z1_bits;
157:
158: /**
159: * Number of z2 bits to be dropped after rounding
160: */
161: const uint16_t d;
162:
163: /**
164: * Modulus p = floor(2q / 2^d) applied after bit dropping
165: */
166: const uint16_t p;
167:
168: /**
169: * M = sigma^2 / alpha_rejection^2
170: */
171: const uint32_t M;
172:
173: /**
174: * B_infinity bound
175: */
176: const uint16_t B_inf;
177:
178: /**
179: * B_verify bound
180: */
181: const uint32_t B_l2;
182:
183: };
184:
185: /**
186: * Get BLISS signature parameter set by BLISS parameter set ID
187: *
188: * @param id BLISS parameter set ID
189: * @return BLISS parameter set
190: */
191: const bliss_param_set_t* bliss_param_set_get_by_id(bliss_param_set_id_t id);
192:
193: /**
194: * Get BLISS signature parameter set by BLISS parameter set OID
195: *
196: * @param oid BLISS parameter set OID
197: * @return BLISS parameter set
198: */
199: const bliss_param_set_t* bliss_param_set_get_by_oid(int oid);
200:
201: #endif /** BLISS_PARAM_SET_H_ @}*/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>