]> git.ipfire.org Git - people/ms/strongswan.git/blame - src/libstrongswan/plugins/bliss/bliss_param_set.h
Skip the unused bits field of the ASN.1 BIT STRING encoding
[people/ms/strongswan.git] / src / libstrongswan / plugins / bliss / bliss_param_set.h
CommitLineData
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
24typedef enum bliss_param_set_id_t bliss_param_set_id_t;
25typedef 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 */
34enum bliss_param_set_id_t {
35 BLISS_I = 1,
36 BLISS_II = 2,
37 BLISS_III = 3,
38 BLISS_IV = 4
39};
40
41extern enum_name_t *bliss_param_set_id_names;
42
43/**
44 * BLISS
45 */
46struct 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
e71813e5
AS
68 /**
69 * Inverse of (q + 2) mod 2q
70 */
71 uint16_t q2_inv;
72
73a32740
AS
73 /**
74 * Ring dimension equal to the number of polynomial coefficients
75 */
76 uint16_t n;
77
78 /**
79 * Number of bits in n
80 */
81 uint16_t n_bits;
82
83 /**
84 * FFT parameters
85 */
86 bliss_fft_params_t *fft_params;
87
88 /**
89 * Number of [-1, +1] secret key coefficients
90 */
91 uint16_t non_zero1;
92
93 /**
94 * Number of [-2, +2] secret key coefficients
95 */
96 uint16_t non_zero2;
97
98 /**
99 * Number of secret key terms that go into Nk(S) norm
100 */
101 uint16_t kappa;
102
103 /**
104 * Maximum Nk(S) tolerable NK(S) norm
105 */
106 uint32_t nks_max;
107
edd72b6b
AS
108 /**
109 * k_sigma = ceiling[ sqrt(2*ln 2) * sigma ]
110 */
111 uint16_t k_sigma;
112
113 /**
114 * Number of bits in k_sigma
115 */
116 uint16_t k_sigma_bits;
117
118 /**
119 * Coefficients for Bernoulli sampling with exponential biases
120 */
121 uint8_t *c;
122
123 /**
124 * Number of columns in Bernoulli coefficient table
125 */
126 size_t c_cols;
127
128 /**
129 * Number of rows in Bernoulli coefficient table
130 */
131 size_t c_rows;
132
e71813e5
AS
133 /**
134 * Number of bits to be dropped after rounding
135 */
136 uint16_t d;
137
138 /**
139 * Modulus p = floor(2q / 2^d) applied after bit dropping
140 */
141 uint16_t p;
142
143 /**
144 * M = sigma^2 / alpha_rejection^2
145 */
146 uint32_t M;
147
148 /**
149 * B_infinity bound
150 */
151 uint16_t B_inf;
152
153 /**
154 * B_verify bound
155 */
156 uint32_t B_l2;
73a32740
AS
157};
158
159/**
160 * Get BLISS signature parameter set by BLISS parameter set ID
161 *
162 * @param id BLISS parameter set ID
163 * @return BLISS parameter set
164*/
165bliss_param_set_t* bliss_param_set_get_by_id(bliss_param_set_id_t id);
166
167/**
168 * Get BLISS signature parameter set by BLISS parameter set OID
169 *
170 * @param oid BLISS parameter set OID
171 * @return BLISS parameter set
172*/
173bliss_param_set_t* bliss_param_set_get_by_oid(int oid);
174
175#endif /** BLISS_PARAM_SET_H_ @}*/