Fixed computing of intermediate buffer size for maximum-size RSA keys.
[BearSSL] / src / settings.c
1 /*
2 * Copyright (c) 2017 Thomas Pornin <pornin@bolet.org>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25 #include "inner.h"
26
27 static const br_config_option config[] = {
28 { "BR_64",
29 #if BR_64
30 1
31 #else
32 0
33 #endif
34 },
35 { "BR_AES_X86NI",
36 #if BR_AES_X86NI
37 1
38 #else
39 0
40 #endif
41 },
42 { "BR_amd64",
43 #if BR_amd64
44 1
45 #else
46 0
47 #endif
48 },
49 { "BR_ARMEL_CORTEXM_GCC",
50 #if BR_ARMEL_CORTEXM_GCC
51 1
52 #else
53 0
54 #endif
55 },
56 { "BR_BE_UNALIGNED",
57 #if BR_BE_UNALIGNED
58 1
59 #else
60 0
61 #endif
62 },
63 { "BR_CLANG",
64 #if BR_CLANG
65 1
66 #else
67 0
68 #endif
69 },
70 { "BR_CLANG_3_7",
71 #if BR_CLANG_3_7
72 1
73 #else
74 0
75 #endif
76 },
77 { "BR_CLANG_3_8",
78 #if BR_CLANG_3_8
79 1
80 #else
81 0
82 #endif
83 },
84 { "BR_CT_MUL15",
85 #if BR_CT_MUL15
86 1
87 #else
88 0
89 #endif
90 },
91 { "BR_CT_MUL31",
92 #if BR_CT_MUL31
93 1
94 #else
95 0
96 #endif
97 },
98 { "BR_GCC",
99 #if BR_GCC
100 1
101 #else
102 0
103 #endif
104 },
105 { "BR_GCC_4_4",
106 #if BR_GCC_4_4
107 1
108 #else
109 0
110 #endif
111 },
112 { "BR_GCC_4_5",
113 #if BR_GCC_4_5
114 1
115 #else
116 0
117 #endif
118 },
119 { "BR_GCC_4_6",
120 #if BR_GCC_4_6
121 1
122 #else
123 0
124 #endif
125 },
126 { "BR_GCC_4_7",
127 #if BR_GCC_4_7
128 1
129 #else
130 0
131 #endif
132 },
133 { "BR_GCC_4_8",
134 #if BR_GCC_4_8
135 1
136 #else
137 0
138 #endif
139 },
140 { "BR_GCC_4_9",
141 #if BR_GCC_4_9
142 1
143 #else
144 0
145 #endif
146 },
147 { "BR_GCC_5_0",
148 #if BR_GCC_5_0
149 1
150 #else
151 0
152 #endif
153 },
154 { "BR_i386",
155 #if BR_i386
156 1
157 #else
158 0
159 #endif
160 },
161 { "BR_INT128",
162 #if BR_INT128
163 1
164 #else
165 0
166 #endif
167 },
168 { "BR_LE_UNALIGNED",
169 #if BR_LE_UNALIGNED
170 1
171 #else
172 0
173 #endif
174 },
175 { "BR_LOMUL",
176 #if BR_LOMUL
177 1
178 #else
179 0
180 #endif
181 },
182 { "BR_MAX_EC_SIZE", BR_MAX_EC_SIZE },
183 { "BR_MAX_RSA_SIZE", BR_MAX_RSA_SIZE },
184 { "BR_MAX_RSA_FACTOR", BR_MAX_RSA_FACTOR },
185 { "BR_MSC",
186 #if BR_MSC
187 1
188 #else
189 0
190 #endif
191 },
192 { "BR_MSC_2005",
193 #if BR_MSC_2005
194 1
195 #else
196 0
197 #endif
198 },
199 { "BR_MSC_2008",
200 #if BR_MSC_2008
201 1
202 #else
203 0
204 #endif
205 },
206 { "BR_MSC_2010",
207 #if BR_MSC_2010
208 1
209 #else
210 0
211 #endif
212 },
213 { "BR_MSC_2012",
214 #if BR_MSC_2012
215 1
216 #else
217 0
218 #endif
219 },
220 { "BR_MSC_2013",
221 #if BR_MSC_2013
222 1
223 #else
224 0
225 #endif
226 },
227 { "BR_MSC_2015",
228 #if BR_MSC_2015
229 1
230 #else
231 0
232 #endif
233 },
234 { "BR_POWER8",
235 #if BR_POWER8
236 1
237 #else
238 0
239 #endif
240 },
241 { "BR_RDRAND",
242 #if BR_RDRAND
243 1
244 #else
245 0
246 #endif
247 },
248 { "BR_SLOW_MUL",
249 #if BR_SLOW_MUL
250 1
251 #else
252 0
253 #endif
254 },
255 { "BR_SLOW_MUL15",
256 #if BR_SLOW_MUL15
257 1
258 #else
259 0
260 #endif
261 },
262 { "BR_SSE2",
263 #if BR_SSE2
264 1
265 #else
266 0
267 #endif
268 },
269 { "BR_UMUL128",
270 #if BR_UMUL128
271 1
272 #else
273 0
274 #endif
275 },
276 { "BR_USE_UNIX_TIME",
277 #if BR_USE_UNIX_TIME
278 1
279 #else
280 0
281 #endif
282 },
283 { "BR_USE_WIN32_RAND",
284 #if BR_USE_WIN32_RAND
285 1
286 #else
287 0
288 #endif
289 },
290 { "BR_USE_WIN32_TIME",
291 #if BR_USE_WIN32_TIME
292 1
293 #else
294 0
295 #endif
296 },
297
298 { NULL, 0 }
299 };
300
301 /* see bearssl.h */
302 const br_config_option *
303 br_get_config(void)
304 {
305 return config;
306 }