Mercurial > dropbear
annotate tommath_class.h @ 283:bd240aa12ba7 libtommath-dropbear
* Changes imported from Dropbear 0.47.
* bn_mp_clear.c is changed so that some vars are volatile,
so that the compiler won't optimise away
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 08 Mar 2006 13:22:52 +0000 |
parents | 91fbc376f010 |
children | fa7a368e12b1 |
rev | line source |
---|---|
282 | 1 #if !(defined(LTM1) && defined(LTM2) && defined(LTM3)) |
2 #if defined(LTM2) | |
3 #define LTM3 | |
4 #endif | |
5 #if defined(LTM1) | |
6 #define LTM2 | |
7 #endif | |
8 #define LTM1 | |
9 | |
10 #if defined(LTM_ALL) | |
11 #define BN_ERROR_C | |
12 #define BN_FAST_MP_INVMOD_C | |
13 #define BN_FAST_MP_MONTGOMERY_REDUCE_C | |
14 #define BN_FAST_S_MP_MUL_DIGS_C | |
15 #define BN_FAST_S_MP_MUL_HIGH_DIGS_C | |
16 #define BN_FAST_S_MP_SQR_C | |
17 #define BN_MP_2EXPT_C | |
18 #define BN_MP_ABS_C | |
19 #define BN_MP_ADD_C | |
20 #define BN_MP_ADD_D_C | |
21 #define BN_MP_ADDMOD_C | |
22 #define BN_MP_AND_C | |
23 #define BN_MP_CLAMP_C | |
24 #define BN_MP_CLEAR_C | |
25 #define BN_MP_CLEAR_MULTI_C | |
26 #define BN_MP_CMP_C | |
27 #define BN_MP_CMP_D_C | |
28 #define BN_MP_CMP_MAG_C | |
29 #define BN_MP_CNT_LSB_C | |
30 #define BN_MP_COPY_C | |
31 #define BN_MP_COUNT_BITS_C | |
32 #define BN_MP_DIV_C | |
33 #define BN_MP_DIV_2_C | |
34 #define BN_MP_DIV_2D_C | |
35 #define BN_MP_DIV_3_C | |
36 #define BN_MP_DIV_D_C | |
37 #define BN_MP_DR_IS_MODULUS_C | |
38 #define BN_MP_DR_REDUCE_C | |
39 #define BN_MP_DR_SETUP_C | |
40 #define BN_MP_EXCH_C | |
41 #define BN_MP_EXPT_D_C | |
42 #define BN_MP_EXPTMOD_C | |
43 #define BN_MP_EXPTMOD_FAST_C | |
44 #define BN_MP_EXTEUCLID_C | |
45 #define BN_MP_FREAD_C | |
46 #define BN_MP_FWRITE_C | |
47 #define BN_MP_GCD_C | |
48 #define BN_MP_GET_INT_C | |
49 #define BN_MP_GROW_C | |
50 #define BN_MP_INIT_C | |
51 #define BN_MP_INIT_COPY_C | |
52 #define BN_MP_INIT_MULTI_C | |
53 #define BN_MP_INIT_SET_C | |
54 #define BN_MP_INIT_SET_INT_C | |
55 #define BN_MP_INIT_SIZE_C | |
56 #define BN_MP_INVMOD_C | |
57 #define BN_MP_INVMOD_SLOW_C | |
58 #define BN_MP_IS_SQUARE_C | |
59 #define BN_MP_JACOBI_C | |
60 #define BN_MP_KARATSUBA_MUL_C | |
61 #define BN_MP_KARATSUBA_SQR_C | |
62 #define BN_MP_LCM_C | |
63 #define BN_MP_LSHD_C | |
64 #define BN_MP_MOD_C | |
65 #define BN_MP_MOD_2D_C | |
66 #define BN_MP_MOD_D_C | |
67 #define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C | |
68 #define BN_MP_MONTGOMERY_REDUCE_C | |
69 #define BN_MP_MONTGOMERY_SETUP_C | |
70 #define BN_MP_MUL_C | |
71 #define BN_MP_MUL_2_C | |
72 #define BN_MP_MUL_2D_C | |
73 #define BN_MP_MUL_D_C | |
74 #define BN_MP_MULMOD_C | |
75 #define BN_MP_N_ROOT_C | |
76 #define BN_MP_NEG_C | |
77 #define BN_MP_OR_C | |
78 #define BN_MP_PRIME_FERMAT_C | |
79 #define BN_MP_PRIME_IS_DIVISIBLE_C | |
80 #define BN_MP_PRIME_IS_PRIME_C | |
81 #define BN_MP_PRIME_MILLER_RABIN_C | |
82 #define BN_MP_PRIME_NEXT_PRIME_C | |
83 #define BN_MP_PRIME_RABIN_MILLER_TRIALS_C | |
84 #define BN_MP_PRIME_RANDOM_EX_C | |
85 #define BN_MP_RADIX_SIZE_C | |
86 #define BN_MP_RADIX_SMAP_C | |
87 #define BN_MP_RAND_C | |
88 #define BN_MP_READ_RADIX_C | |
89 #define BN_MP_READ_SIGNED_BIN_C | |
90 #define BN_MP_READ_UNSIGNED_BIN_C | |
91 #define BN_MP_REDUCE_C | |
92 #define BN_MP_REDUCE_2K_C | |
93 #define BN_MP_REDUCE_2K_L_C | |
94 #define BN_MP_REDUCE_2K_SETUP_C | |
95 #define BN_MP_REDUCE_2K_SETUP_L_C | |
96 #define BN_MP_REDUCE_IS_2K_C | |
97 #define BN_MP_REDUCE_IS_2K_L_C | |
98 #define BN_MP_REDUCE_SETUP_C | |
99 #define BN_MP_RSHD_C | |
100 #define BN_MP_SET_C | |
101 #define BN_MP_SET_INT_C | |
102 #define BN_MP_SHRINK_C | |
103 #define BN_MP_SIGNED_BIN_SIZE_C | |
104 #define BN_MP_SQR_C | |
105 #define BN_MP_SQRMOD_C | |
106 #define BN_MP_SQRT_C | |
107 #define BN_MP_SUB_C | |
108 #define BN_MP_SUB_D_C | |
109 #define BN_MP_SUBMOD_C | |
110 #define BN_MP_TO_SIGNED_BIN_C | |
111 #define BN_MP_TO_SIGNED_BIN_N_C | |
112 #define BN_MP_TO_UNSIGNED_BIN_C | |
113 #define BN_MP_TO_UNSIGNED_BIN_N_C | |
114 #define BN_MP_TOOM_MUL_C | |
115 #define BN_MP_TOOM_SQR_C | |
116 #define BN_MP_TORADIX_C | |
117 #define BN_MP_TORADIX_N_C | |
118 #define BN_MP_UNSIGNED_BIN_SIZE_C | |
119 #define BN_MP_XOR_C | |
120 #define BN_MP_ZERO_C | |
121 #define BN_PRIME_TAB_C | |
122 #define BN_REVERSE_C | |
123 #define BN_S_MP_ADD_C | |
124 #define BN_S_MP_EXPTMOD_C | |
125 #define BN_S_MP_MUL_DIGS_C | |
126 #define BN_S_MP_MUL_HIGH_DIGS_C | |
127 #define BN_S_MP_SQR_C | |
128 #define BN_S_MP_SUB_C | |
129 #define BNCORE_C | |
130 #endif | |
131 | |
132 #if defined(BN_ERROR_C) | |
133 #define BN_MP_ERROR_TO_STRING_C | |
134 #endif | |
135 | |
136 #if defined(BN_FAST_MP_INVMOD_C) | |
137 #define BN_MP_ISEVEN_C | |
138 #define BN_MP_INIT_MULTI_C | |
139 #define BN_MP_COPY_C | |
140 #define BN_MP_MOD_C | |
141 #define BN_MP_SET_C | |
142 #define BN_MP_DIV_2_C | |
143 #define BN_MP_ISODD_C | |
144 #define BN_MP_SUB_C | |
145 #define BN_MP_CMP_C | |
146 #define BN_MP_ISZERO_C | |
147 #define BN_MP_CMP_D_C | |
148 #define BN_MP_ADD_C | |
149 #define BN_MP_EXCH_C | |
150 #define BN_MP_CLEAR_MULTI_C | |
151 #endif | |
152 | |
153 #if defined(BN_FAST_MP_MONTGOMERY_REDUCE_C) | |
154 #define BN_MP_GROW_C | |
155 #define BN_MP_RSHD_C | |
156 #define BN_MP_CLAMP_C | |
157 #define BN_MP_CMP_MAG_C | |
158 #define BN_S_MP_SUB_C | |
159 #endif | |
160 | |
161 #if defined(BN_FAST_S_MP_MUL_DIGS_C) | |
162 #define BN_MP_GROW_C | |
163 #define BN_MP_CLAMP_C | |
164 #endif | |
165 | |
166 #if defined(BN_FAST_S_MP_MUL_HIGH_DIGS_C) | |
167 #define BN_MP_GROW_C | |
168 #define BN_MP_CLAMP_C | |
169 #endif | |
170 | |
171 #if defined(BN_FAST_S_MP_SQR_C) | |
172 #define BN_MP_GROW_C | |
173 #define BN_MP_CLAMP_C | |
174 #endif | |
175 | |
176 #if defined(BN_MP_2EXPT_C) | |
177 #define BN_MP_ZERO_C | |
178 #define BN_MP_GROW_C | |
179 #endif | |
180 | |
181 #if defined(BN_MP_ABS_C) | |
182 #define BN_MP_COPY_C | |
183 #endif | |
184 | |
185 #if defined(BN_MP_ADD_C) | |
186 #define BN_S_MP_ADD_C | |
187 #define BN_MP_CMP_MAG_C | |
188 #define BN_S_MP_SUB_C | |
189 #endif | |
190 | |
191 #if defined(BN_MP_ADD_D_C) | |
192 #define BN_MP_GROW_C | |
193 #define BN_MP_SUB_D_C | |
194 #define BN_MP_CLAMP_C | |
195 #endif | |
196 | |
197 #if defined(BN_MP_ADDMOD_C) | |
198 #define BN_MP_INIT_C | |
199 #define BN_MP_ADD_C | |
200 #define BN_MP_CLEAR_C | |
201 #define BN_MP_MOD_C | |
202 #endif | |
203 | |
204 #if defined(BN_MP_AND_C) | |
205 #define BN_MP_INIT_COPY_C | |
206 #define BN_MP_CLAMP_C | |
207 #define BN_MP_EXCH_C | |
208 #define BN_MP_CLEAR_C | |
209 #endif | |
210 | |
211 #if defined(BN_MP_CLAMP_C) | |
212 #endif | |
213 | |
214 #if defined(BN_MP_CLEAR_C) | |
215 #endif | |
216 | |
217 #if defined(BN_MP_CLEAR_MULTI_C) | |
218 #define BN_MP_CLEAR_C | |
219 #endif | |
220 | |
221 #if defined(BN_MP_CMP_C) | |
222 #define BN_MP_CMP_MAG_C | |
223 #endif | |
224 | |
225 #if defined(BN_MP_CMP_D_C) | |
226 #endif | |
227 | |
228 #if defined(BN_MP_CMP_MAG_C) | |
229 #endif | |
230 | |
231 #if defined(BN_MP_CNT_LSB_C) | |
232 #define BN_MP_ISZERO_C | |
233 #endif | |
234 | |
235 #if defined(BN_MP_COPY_C) | |
236 #define BN_MP_GROW_C | |
237 #endif | |
238 | |
239 #if defined(BN_MP_COUNT_BITS_C) | |
240 #endif | |
241 | |
242 #if defined(BN_MP_DIV_C) | |
243 #define BN_MP_ISZERO_C | |
244 #define BN_MP_CMP_MAG_C | |
245 #define BN_MP_COPY_C | |
246 #define BN_MP_ZERO_C | |
247 #define BN_MP_INIT_MULTI_C | |
248 #define BN_MP_SET_C | |
249 #define BN_MP_COUNT_BITS_C | |
250 #define BN_MP_ABS_C | |
251 #define BN_MP_MUL_2D_C | |
252 #define BN_MP_CMP_C | |
253 #define BN_MP_SUB_C | |
254 #define BN_MP_ADD_C | |
255 #define BN_MP_DIV_2D_C | |
256 #define BN_MP_EXCH_C | |
257 #define BN_MP_CLEAR_MULTI_C | |
258 #define BN_MP_INIT_SIZE_C | |
259 #define BN_MP_INIT_C | |
260 #define BN_MP_INIT_COPY_C | |
261 #define BN_MP_LSHD_C | |
262 #define BN_MP_RSHD_C | |
263 #define BN_MP_MUL_D_C | |
264 #define BN_MP_CLAMP_C | |
265 #define BN_MP_CLEAR_C | |
266 #endif | |
267 | |
268 #if defined(BN_MP_DIV_2_C) | |
269 #define BN_MP_GROW_C | |
270 #define BN_MP_CLAMP_C | |
271 #endif | |
272 | |
273 #if defined(BN_MP_DIV_2D_C) | |
274 #define BN_MP_COPY_C | |
275 #define BN_MP_ZERO_C | |
276 #define BN_MP_INIT_C | |
277 #define BN_MP_MOD_2D_C | |
278 #define BN_MP_CLEAR_C | |
279 #define BN_MP_RSHD_C | |
280 #define BN_MP_CLAMP_C | |
281 #define BN_MP_EXCH_C | |
282 #endif | |
283 | |
284 #if defined(BN_MP_DIV_3_C) | |
285 #define BN_MP_INIT_SIZE_C | |
286 #define BN_MP_CLAMP_C | |
287 #define BN_MP_EXCH_C | |
288 #define BN_MP_CLEAR_C | |
289 #endif | |
290 | |
291 #if defined(BN_MP_DIV_D_C) | |
292 #define BN_MP_ISZERO_C | |
293 #define BN_MP_COPY_C | |
294 #define BN_MP_DIV_2D_C | |
295 #define BN_MP_DIV_3_C | |
296 #define BN_MP_INIT_SIZE_C | |
297 #define BN_MP_CLAMP_C | |
298 #define BN_MP_EXCH_C | |
299 #define BN_MP_CLEAR_C | |
300 #endif | |
301 | |
302 #if defined(BN_MP_DR_IS_MODULUS_C) | |
303 #endif | |
304 | |
305 #if defined(BN_MP_DR_REDUCE_C) | |
306 #define BN_MP_GROW_C | |
307 #define BN_MP_CLAMP_C | |
308 #define BN_MP_CMP_MAG_C | |
309 #define BN_S_MP_SUB_C | |
310 #endif | |
311 | |
312 #if defined(BN_MP_DR_SETUP_C) | |
313 #endif | |
314 | |
315 #if defined(BN_MP_EXCH_C) | |
316 #endif | |
317 | |
318 #if defined(BN_MP_EXPT_D_C) | |
319 #define BN_MP_INIT_COPY_C | |
320 #define BN_MP_SET_C | |
321 #define BN_MP_SQR_C | |
322 #define BN_MP_CLEAR_C | |
323 #define BN_MP_MUL_C | |
324 #endif | |
325 | |
326 #if defined(BN_MP_EXPTMOD_C) | |
327 #define BN_MP_INIT_C | |
328 #define BN_MP_INVMOD_C | |
329 #define BN_MP_CLEAR_C | |
330 #define BN_MP_ABS_C | |
331 #define BN_MP_CLEAR_MULTI_C | |
332 #define BN_MP_REDUCE_IS_2K_L_C | |
333 #define BN_S_MP_EXPTMOD_C | |
334 #define BN_MP_DR_IS_MODULUS_C | |
335 #define BN_MP_REDUCE_IS_2K_C | |
336 #define BN_MP_ISODD_C | |
337 #define BN_MP_EXPTMOD_FAST_C | |
338 #endif | |
339 | |
340 #if defined(BN_MP_EXPTMOD_FAST_C) | |
341 #define BN_MP_COUNT_BITS_C | |
342 #define BN_MP_INIT_C | |
343 #define BN_MP_CLEAR_C | |
344 #define BN_MP_MONTGOMERY_SETUP_C | |
345 #define BN_FAST_MP_MONTGOMERY_REDUCE_C | |
346 #define BN_MP_MONTGOMERY_REDUCE_C | |
347 #define BN_MP_DR_SETUP_C | |
348 #define BN_MP_DR_REDUCE_C | |
349 #define BN_MP_REDUCE_2K_SETUP_C | |
350 #define BN_MP_REDUCE_2K_C | |
351 #define BN_MP_MONTGOMERY_CALC_NORMALIZATION_C | |
352 #define BN_MP_MULMOD_C | |
353 #define BN_MP_SET_C | |
354 #define BN_MP_MOD_C | |
355 #define BN_MP_COPY_C | |
356 #define BN_MP_SQR_C | |
357 #define BN_MP_MUL_C | |
358 #define BN_MP_EXCH_C | |
359 #endif | |
360 | |
361 #if defined(BN_MP_EXTEUCLID_C) | |
362 #define BN_MP_INIT_MULTI_C | |
363 #define BN_MP_SET_C | |
364 #define BN_MP_COPY_C | |
365 #define BN_MP_ISZERO_C | |
366 #define BN_MP_DIV_C | |
367 #define BN_MP_MUL_C | |
368 #define BN_MP_SUB_C | |
369 #define BN_MP_NEG_C | |
370 #define BN_MP_EXCH_C | |
371 #define BN_MP_CLEAR_MULTI_C | |
372 #endif | |
373 | |
374 #if defined(BN_MP_FREAD_C) | |
375 #define BN_MP_ZERO_C | |
376 #define BN_MP_S_RMAP_C | |
377 #define BN_MP_MUL_D_C | |
378 #define BN_MP_ADD_D_C | |
379 #define BN_MP_CMP_D_C | |
380 #endif | |
381 | |
382 #if defined(BN_MP_FWRITE_C) | |
383 #define BN_MP_RADIX_SIZE_C | |
384 #define BN_MP_TORADIX_C | |
385 #endif | |
386 | |
387 #if defined(BN_MP_GCD_C) | |
388 #define BN_MP_ISZERO_C | |
389 #define BN_MP_ABS_C | |
390 #define BN_MP_ZERO_C | |
391 #define BN_MP_INIT_COPY_C | |
392 #define BN_MP_CNT_LSB_C | |
393 #define BN_MP_DIV_2D_C | |
394 #define BN_MP_CMP_MAG_C | |
395 #define BN_MP_EXCH_C | |
396 #define BN_S_MP_SUB_C | |
397 #define BN_MP_MUL_2D_C | |
398 #define BN_MP_CLEAR_C | |
399 #endif | |
400 | |
401 #if defined(BN_MP_GET_INT_C) | |
402 #endif | |
403 | |
404 #if defined(BN_MP_GROW_C) | |
405 #endif | |
406 | |
407 #if defined(BN_MP_INIT_C) | |
408 #endif | |
409 | |
410 #if defined(BN_MP_INIT_COPY_C) | |
411 #define BN_MP_COPY_C | |
412 #endif | |
413 | |
414 #if defined(BN_MP_INIT_MULTI_C) | |
415 #define BN_MP_ERR_C | |
416 #define BN_MP_INIT_C | |
417 #define BN_MP_CLEAR_C | |
418 #endif | |
419 | |
420 #if defined(BN_MP_INIT_SET_C) | |
421 #define BN_MP_INIT_C | |
422 #define BN_MP_SET_C | |
423 #endif | |
424 | |
425 #if defined(BN_MP_INIT_SET_INT_C) | |
426 #define BN_MP_INIT_C | |
427 #define BN_MP_SET_INT_C | |
428 #endif | |
429 | |
430 #if defined(BN_MP_INIT_SIZE_C) | |
431 #define BN_MP_INIT_C | |
432 #endif | |
433 | |
434 #if defined(BN_MP_INVMOD_C) | |
435 #define BN_MP_ISZERO_C | |
436 #define BN_MP_ISODD_C | |
437 #define BN_FAST_MP_INVMOD_C | |
438 #define BN_MP_INVMOD_SLOW_C | |
439 #endif | |
440 | |
441 #if defined(BN_MP_INVMOD_SLOW_C) | |
442 #define BN_MP_ISZERO_C | |
443 #define BN_MP_INIT_MULTI_C | |
444 #define BN_MP_MOD_C | |
445 #define BN_MP_COPY_C | |
446 #define BN_MP_ISEVEN_C | |
447 #define BN_MP_SET_C | |
448 #define BN_MP_DIV_2_C | |
449 #define BN_MP_ISODD_C | |
450 #define BN_MP_ADD_C | |
451 #define BN_MP_SUB_C | |
452 #define BN_MP_CMP_C | |
453 #define BN_MP_CMP_D_C | |
454 #define BN_MP_CMP_MAG_C | |
455 #define BN_MP_EXCH_C | |
456 #define BN_MP_CLEAR_MULTI_C | |
457 #endif | |
458 | |
459 #if defined(BN_MP_IS_SQUARE_C) | |
460 #define BN_MP_MOD_D_C | |
461 #define BN_MP_INIT_SET_INT_C | |
462 #define BN_MP_MOD_C | |
463 #define BN_MP_GET_INT_C | |
464 #define BN_MP_SQRT_C | |
465 #define BN_MP_SQR_C | |
466 #define BN_MP_CMP_MAG_C | |
467 #define BN_MP_CLEAR_C | |
468 #endif | |
469 | |
470 #if defined(BN_MP_JACOBI_C) | |
471 #define BN_MP_CMP_D_C | |
472 #define BN_MP_ISZERO_C | |
473 #define BN_MP_INIT_COPY_C | |
474 #define BN_MP_CNT_LSB_C | |
475 #define BN_MP_DIV_2D_C | |
476 #define BN_MP_MOD_C | |
477 #define BN_MP_CLEAR_C | |
478 #endif | |
479 | |
480 #if defined(BN_MP_KARATSUBA_MUL_C) | |
481 #define BN_MP_MUL_C | |
482 #define BN_MP_INIT_SIZE_C | |
483 #define BN_MP_CLAMP_C | |
484 #define BN_MP_SUB_C | |
485 #define BN_MP_ADD_C | |
486 #define BN_MP_LSHD_C | |
487 #define BN_MP_CLEAR_C | |
488 #endif | |
489 | |
490 #if defined(BN_MP_KARATSUBA_SQR_C) | |
491 #define BN_MP_INIT_SIZE_C | |
492 #define BN_MP_CLAMP_C | |
493 #define BN_MP_SQR_C | |
494 #define BN_MP_SUB_C | |
495 #define BN_S_MP_ADD_C | |
496 #define BN_MP_LSHD_C | |
497 #define BN_MP_ADD_C | |
498 #define BN_MP_CLEAR_C | |
499 #endif | |
500 | |
501 #if defined(BN_MP_LCM_C) | |
502 #define BN_MP_INIT_MULTI_C | |
503 #define BN_MP_GCD_C | |
504 #define BN_MP_CMP_MAG_C | |
505 #define BN_MP_DIV_C | |
506 #define BN_MP_MUL_C | |
507 #define BN_MP_CLEAR_MULTI_C | |
508 #endif | |
509 | |
510 #if defined(BN_MP_LSHD_C) | |
511 #define BN_MP_GROW_C | |
512 #define BN_MP_RSHD_C | |
513 #endif | |
514 | |
515 #if defined(BN_MP_MOD_C) | |
516 #define BN_MP_INIT_C | |
517 #define BN_MP_DIV_C | |
518 #define BN_MP_CLEAR_C | |
519 #define BN_MP_ADD_C | |
520 #define BN_MP_EXCH_C | |
521 #endif | |
522 | |
523 #if defined(BN_MP_MOD_2D_C) | |
524 #define BN_MP_ZERO_C | |
525 #define BN_MP_COPY_C | |
526 #define BN_MP_CLAMP_C | |
527 #endif | |
528 | |
529 #if defined(BN_MP_MOD_D_C) | |
530 #define BN_MP_DIV_D_C | |
531 #endif | |
532 | |
533 #if defined(BN_MP_MONTGOMERY_CALC_NORMALIZATION_C) | |
534 #define BN_MP_COUNT_BITS_C | |
535 #define BN_MP_2EXPT_C | |
536 #define BN_MP_SET_C | |
537 #define BN_MP_MUL_2_C | |
538 #define BN_MP_CMP_MAG_C | |
539 #define BN_S_MP_SUB_C | |
540 #endif | |
541 | |
542 #if defined(BN_MP_MONTGOMERY_REDUCE_C) | |
543 #define BN_FAST_MP_MONTGOMERY_REDUCE_C | |
544 #define BN_MP_GROW_C | |
545 #define BN_MP_CLAMP_C | |
546 #define BN_MP_RSHD_C | |
547 #define BN_MP_CMP_MAG_C | |
548 #define BN_S_MP_SUB_C | |
549 #endif | |
550 | |
551 #if defined(BN_MP_MONTGOMERY_SETUP_C) | |
552 #endif | |
553 | |
554 #if defined(BN_MP_MUL_C) | |
555 #define BN_MP_TOOM_MUL_C | |
556 #define BN_MP_KARATSUBA_MUL_C | |
557 #define BN_FAST_S_MP_MUL_DIGS_C | |
558 #define BN_S_MP_MUL_C | |
559 #define BN_S_MP_MUL_DIGS_C | |
560 #endif | |
561 | |
562 #if defined(BN_MP_MUL_2_C) | |
563 #define BN_MP_GROW_C | |
564 #endif | |
565 | |
566 #if defined(BN_MP_MUL_2D_C) | |
567 #define BN_MP_COPY_C | |
568 #define BN_MP_GROW_C | |
569 #define BN_MP_LSHD_C | |
570 #define BN_MP_CLAMP_C | |
571 #endif | |
572 | |
573 #if defined(BN_MP_MUL_D_C) | |
574 #define BN_MP_GROW_C | |
575 #define BN_MP_CLAMP_C | |
576 #endif | |
577 | |
578 #if defined(BN_MP_MULMOD_C) | |
579 #define BN_MP_INIT_C | |
580 #define BN_MP_MUL_C | |
581 #define BN_MP_CLEAR_C | |
582 #define BN_MP_MOD_C | |
583 #endif | |
584 | |
585 #if defined(BN_MP_N_ROOT_C) | |
586 #define BN_MP_INIT_C | |
587 #define BN_MP_SET_C | |
588 #define BN_MP_COPY_C | |
589 #define BN_MP_EXPT_D_C | |
590 #define BN_MP_MUL_C | |
591 #define BN_MP_SUB_C | |
592 #define BN_MP_MUL_D_C | |
593 #define BN_MP_DIV_C | |
594 #define BN_MP_CMP_C | |
595 #define BN_MP_SUB_D_C | |
596 #define BN_MP_EXCH_C | |
597 #define BN_MP_CLEAR_C | |
598 #endif | |
599 | |
600 #if defined(BN_MP_NEG_C) | |
601 #define BN_MP_COPY_C | |
602 #define BN_MP_ISZERO_C | |
603 #endif | |
604 | |
605 #if defined(BN_MP_OR_C) | |
606 #define BN_MP_INIT_COPY_C | |
607 #define BN_MP_CLAMP_C | |
608 #define BN_MP_EXCH_C | |
609 #define BN_MP_CLEAR_C | |
610 #endif | |
611 | |
612 #if defined(BN_MP_PRIME_FERMAT_C) | |
613 #define BN_MP_CMP_D_C | |
614 #define BN_MP_INIT_C | |
615 #define BN_MP_EXPTMOD_C | |
616 #define BN_MP_CMP_C | |
617 #define BN_MP_CLEAR_C | |
618 #endif | |
619 | |
620 #if defined(BN_MP_PRIME_IS_DIVISIBLE_C) | |
621 #define BN_MP_MOD_D_C | |
622 #endif | |
623 | |
624 #if defined(BN_MP_PRIME_IS_PRIME_C) | |
625 #define BN_MP_CMP_D_C | |
626 #define BN_MP_PRIME_IS_DIVISIBLE_C | |
627 #define BN_MP_INIT_C | |
628 #define BN_MP_SET_C | |
629 #define BN_MP_PRIME_MILLER_RABIN_C | |
630 #define BN_MP_CLEAR_C | |
631 #endif | |
632 | |
633 #if defined(BN_MP_PRIME_MILLER_RABIN_C) | |
634 #define BN_MP_CMP_D_C | |
635 #define BN_MP_INIT_COPY_C | |
636 #define BN_MP_SUB_D_C | |
637 #define BN_MP_CNT_LSB_C | |
638 #define BN_MP_DIV_2D_C | |
639 #define BN_MP_EXPTMOD_C | |
640 #define BN_MP_CMP_C | |
641 #define BN_MP_SQRMOD_C | |
642 #define BN_MP_CLEAR_C | |
643 #endif | |
644 | |
645 #if defined(BN_MP_PRIME_NEXT_PRIME_C) | |
646 #define BN_MP_CMP_D_C | |
647 #define BN_MP_SET_C | |
648 #define BN_MP_SUB_D_C | |
649 #define BN_MP_ISEVEN_C | |
650 #define BN_MP_MOD_D_C | |
651 #define BN_MP_INIT_C | |
652 #define BN_MP_ADD_D_C | |
653 #define BN_MP_PRIME_MILLER_RABIN_C | |
654 #define BN_MP_CLEAR_C | |
655 #endif | |
656 | |
657 #if defined(BN_MP_PRIME_RABIN_MILLER_TRIALS_C) | |
658 #endif | |
659 | |
660 #if defined(BN_MP_PRIME_RANDOM_EX_C) | |
661 #define BN_MP_READ_UNSIGNED_BIN_C | |
662 #define BN_MP_PRIME_IS_PRIME_C | |
663 #define BN_MP_SUB_D_C | |
664 #define BN_MP_DIV_2_C | |
665 #define BN_MP_MUL_2_C | |
666 #define BN_MP_ADD_D_C | |
667 #endif | |
668 | |
669 #if defined(BN_MP_RADIX_SIZE_C) | |
670 #define BN_MP_COUNT_BITS_C | |
671 #define BN_MP_INIT_COPY_C | |
672 #define BN_MP_ISZERO_C | |
673 #define BN_MP_DIV_D_C | |
674 #define BN_MP_CLEAR_C | |
675 #endif | |
676 | |
677 #if defined(BN_MP_RADIX_SMAP_C) | |
678 #define BN_MP_S_RMAP_C | |
679 #endif | |
680 | |
681 #if defined(BN_MP_RAND_C) | |
682 #define BN_MP_ZERO_C | |
683 #define BN_MP_ADD_D_C | |
684 #define BN_MP_LSHD_C | |
685 #endif | |
686 | |
687 #if defined(BN_MP_READ_RADIX_C) | |
688 #define BN_MP_ZERO_C | |
689 #define BN_MP_S_RMAP_C | |
690 #define BN_MP_MUL_D_C | |
691 #define BN_MP_ADD_D_C | |
692 #define BN_MP_ISZERO_C | |
693 #endif | |
694 | |
695 #if defined(BN_MP_READ_SIGNED_BIN_C) | |
696 #define BN_MP_READ_UNSIGNED_BIN_C | |
697 #endif | |
698 | |
699 #if defined(BN_MP_READ_UNSIGNED_BIN_C) | |
700 #define BN_MP_GROW_C | |
701 #define BN_MP_ZERO_C | |
702 #define BN_MP_MUL_2D_C | |
703 #define BN_MP_CLAMP_C | |
704 #endif | |
705 | |
706 #if defined(BN_MP_REDUCE_C) | |
707 #define BN_MP_REDUCE_SETUP_C | |
708 #define BN_MP_INIT_COPY_C | |
709 #define BN_MP_RSHD_C | |
710 #define BN_MP_MUL_C | |
711 #define BN_S_MP_MUL_HIGH_DIGS_C | |
712 #define BN_FAST_S_MP_MUL_HIGH_DIGS_C | |
713 #define BN_MP_MOD_2D_C | |
714 #define BN_S_MP_MUL_DIGS_C | |
715 #define BN_MP_SUB_C | |
716 #define BN_MP_CMP_D_C | |
717 #define BN_MP_SET_C | |
718 #define BN_MP_LSHD_C | |
719 #define BN_MP_ADD_C | |
720 #define BN_MP_CMP_C | |
721 #define BN_S_MP_SUB_C | |
722 #define BN_MP_CLEAR_C | |
723 #endif | |
724 | |
725 #if defined(BN_MP_REDUCE_2K_C) | |
726 #define BN_MP_INIT_C | |
727 #define BN_MP_COUNT_BITS_C | |
728 #define BN_MP_DIV_2D_C | |
729 #define BN_MP_MUL_D_C | |
730 #define BN_S_MP_ADD_C | |
731 #define BN_MP_CMP_MAG_C | |
732 #define BN_S_MP_SUB_C | |
733 #define BN_MP_CLEAR_C | |
734 #endif | |
735 | |
736 #if defined(BN_MP_REDUCE_2K_L_C) | |
737 #define BN_MP_INIT_C | |
738 #define BN_MP_COUNT_BITS_C | |
739 #define BN_MP_DIV_2D_C | |
740 #define BN_MP_MUL_C | |
741 #define BN_S_MP_ADD_C | |
742 #define BN_MP_CMP_MAG_C | |
743 #define BN_S_MP_SUB_C | |
744 #define BN_MP_CLEAR_C | |
745 #endif | |
746 | |
747 #if defined(BN_MP_REDUCE_2K_SETUP_C) | |
748 #define BN_MP_INIT_C | |
749 #define BN_MP_COUNT_BITS_C | |
750 #define BN_MP_2EXPT_C | |
751 #define BN_MP_CLEAR_C | |
752 #define BN_S_MP_SUB_C | |
753 #endif | |
754 | |
755 #if defined(BN_MP_REDUCE_2K_SETUP_L_C) | |
756 #define BN_MP_INIT_C | |
757 #define BN_MP_2EXPT_C | |
758 #define BN_MP_COUNT_BITS_C | |
759 #define BN_S_MP_SUB_C | |
760 #define BN_MP_CLEAR_C | |
761 #endif | |
762 | |
763 #if defined(BN_MP_REDUCE_IS_2K_C) | |
764 #define BN_MP_REDUCE_2K_C | |
765 #define BN_MP_COUNT_BITS_C | |
766 #endif | |
767 | |
768 #if defined(BN_MP_REDUCE_IS_2K_L_C) | |
769 #endif | |
770 | |
771 #if defined(BN_MP_REDUCE_SETUP_C) | |
772 #define BN_MP_2EXPT_C | |
773 #define BN_MP_DIV_C | |
774 #endif | |
775 | |
776 #if defined(BN_MP_RSHD_C) | |
777 #define BN_MP_ZERO_C | |
778 #endif | |
779 | |
780 #if defined(BN_MP_SET_C) | |
781 #define BN_MP_ZERO_C | |
782 #endif | |
783 | |
784 #if defined(BN_MP_SET_INT_C) | |
785 #define BN_MP_ZERO_C | |
786 #define BN_MP_MUL_2D_C | |
787 #define BN_MP_CLAMP_C | |
788 #endif | |
789 | |
790 #if defined(BN_MP_SHRINK_C) | |
791 #endif | |
792 | |
793 #if defined(BN_MP_SIGNED_BIN_SIZE_C) | |
794 #define BN_MP_UNSIGNED_BIN_SIZE_C | |
795 #endif | |
796 | |
797 #if defined(BN_MP_SQR_C) | |
798 #define BN_MP_TOOM_SQR_C | |
799 #define BN_MP_KARATSUBA_SQR_C | |
800 #define BN_FAST_S_MP_SQR_C | |
801 #define BN_S_MP_SQR_C | |
802 #endif | |
803 | |
804 #if defined(BN_MP_SQRMOD_C) | |
805 #define BN_MP_INIT_C | |
806 #define BN_MP_SQR_C | |
807 #define BN_MP_CLEAR_C | |
808 #define BN_MP_MOD_C | |
809 #endif | |
810 | |
811 #if defined(BN_MP_SQRT_C) | |
812 #define BN_MP_N_ROOT_C | |
813 #define BN_MP_ISZERO_C | |
814 #define BN_MP_ZERO_C | |
815 #define BN_MP_INIT_COPY_C | |
816 #define BN_MP_RSHD_C | |
817 #define BN_MP_DIV_C | |
818 #define BN_MP_ADD_C | |
819 #define BN_MP_DIV_2_C | |
820 #define BN_MP_CMP_MAG_C | |
821 #define BN_MP_EXCH_C | |
822 #define BN_MP_CLEAR_C | |
823 #endif | |
824 | |
825 #if defined(BN_MP_SUB_C) | |
826 #define BN_S_MP_ADD_C | |
827 #define BN_MP_CMP_MAG_C | |
828 #define BN_S_MP_SUB_C | |
829 #endif | |
830 | |
831 #if defined(BN_MP_SUB_D_C) | |
832 #define BN_MP_GROW_C | |
833 #define BN_MP_ADD_D_C | |
834 #define BN_MP_CLAMP_C | |
835 #endif | |
836 | |
837 #if defined(BN_MP_SUBMOD_C) | |
838 #define BN_MP_INIT_C | |
839 #define BN_MP_SUB_C | |
840 #define BN_MP_CLEAR_C | |
841 #define BN_MP_MOD_C | |
842 #endif | |
843 | |
844 #if defined(BN_MP_TO_SIGNED_BIN_C) | |
845 #define BN_MP_TO_UNSIGNED_BIN_C | |
846 #endif | |
847 | |
848 #if defined(BN_MP_TO_SIGNED_BIN_N_C) | |
849 #define BN_MP_SIGNED_BIN_SIZE_C | |
850 #define BN_MP_TO_SIGNED_BIN_C | |
851 #endif | |
852 | |
853 #if defined(BN_MP_TO_UNSIGNED_BIN_C) | |
854 #define BN_MP_INIT_COPY_C | |
855 #define BN_MP_ISZERO_C | |
856 #define BN_MP_DIV_2D_C | |
857 #define BN_MP_CLEAR_C | |
858 #endif | |
859 | |
860 #if defined(BN_MP_TO_UNSIGNED_BIN_N_C) | |
861 #define BN_MP_UNSIGNED_BIN_SIZE_C | |
862 #define BN_MP_TO_UNSIGNED_BIN_C | |
863 #endif | |
864 | |
865 #if defined(BN_MP_TOOM_MUL_C) | |
866 #define BN_MP_INIT_MULTI_C | |
867 #define BN_MP_MOD_2D_C | |
868 #define BN_MP_COPY_C | |
869 #define BN_MP_RSHD_C | |
870 #define BN_MP_MUL_C | |
871 #define BN_MP_MUL_2_C | |
872 #define BN_MP_ADD_C | |
873 #define BN_MP_SUB_C | |
874 #define BN_MP_DIV_2_C | |
875 #define BN_MP_MUL_2D_C | |
876 #define BN_MP_MUL_D_C | |
877 #define BN_MP_DIV_3_C | |
878 #define BN_MP_LSHD_C | |
879 #define BN_MP_CLEAR_MULTI_C | |
880 #endif | |
881 | |
882 #if defined(BN_MP_TOOM_SQR_C) | |
883 #define BN_MP_INIT_MULTI_C | |
884 #define BN_MP_MOD_2D_C | |
885 #define BN_MP_COPY_C | |
886 #define BN_MP_RSHD_C | |
887 #define BN_MP_SQR_C | |
888 #define BN_MP_MUL_2_C | |
889 #define BN_MP_ADD_C | |
890 #define BN_MP_SUB_C | |
891 #define BN_MP_DIV_2_C | |
892 #define BN_MP_MUL_2D_C | |
893 #define BN_MP_MUL_D_C | |
894 #define BN_MP_DIV_3_C | |
895 #define BN_MP_LSHD_C | |
896 #define BN_MP_CLEAR_MULTI_C | |
897 #endif | |
898 | |
899 #if defined(BN_MP_TORADIX_C) | |
900 #define BN_MP_ISZERO_C | |
901 #define BN_MP_INIT_COPY_C | |
902 #define BN_MP_DIV_D_C | |
903 #define BN_MP_CLEAR_C | |
904 #define BN_MP_S_RMAP_C | |
905 #endif | |
906 | |
907 #if defined(BN_MP_TORADIX_N_C) | |
908 #define BN_MP_ISZERO_C | |
909 #define BN_MP_INIT_COPY_C | |
910 #define BN_MP_DIV_D_C | |
911 #define BN_MP_CLEAR_C | |
912 #define BN_MP_S_RMAP_C | |
913 #endif | |
914 | |
915 #if defined(BN_MP_UNSIGNED_BIN_SIZE_C) | |
916 #define BN_MP_COUNT_BITS_C | |
917 #endif | |
918 | |
919 #if defined(BN_MP_XOR_C) | |
920 #define BN_MP_INIT_COPY_C | |
921 #define BN_MP_CLAMP_C | |
922 #define BN_MP_EXCH_C | |
923 #define BN_MP_CLEAR_C | |
924 #endif | |
925 | |
926 #if defined(BN_MP_ZERO_C) | |
927 #endif | |
928 | |
929 #if defined(BN_PRIME_TAB_C) | |
930 #endif | |
931 | |
932 #if defined(BN_REVERSE_C) | |
933 #endif | |
934 | |
935 #if defined(BN_S_MP_ADD_C) | |
936 #define BN_MP_GROW_C | |
937 #define BN_MP_CLAMP_C | |
938 #endif | |
939 | |
940 #if defined(BN_S_MP_EXPTMOD_C) | |
941 #define BN_MP_COUNT_BITS_C | |
942 #define BN_MP_INIT_C | |
943 #define BN_MP_CLEAR_C | |
944 #define BN_MP_REDUCE_SETUP_C | |
945 #define BN_MP_REDUCE_C | |
946 #define BN_MP_REDUCE_2K_SETUP_L_C | |
947 #define BN_MP_REDUCE_2K_L_C | |
948 #define BN_MP_MOD_C | |
949 #define BN_MP_COPY_C | |
950 #define BN_MP_SQR_C | |
951 #define BN_MP_MUL_C | |
952 #define BN_MP_SET_C | |
953 #define BN_MP_EXCH_C | |
954 #endif | |
955 | |
956 #if defined(BN_S_MP_MUL_DIGS_C) | |
957 #define BN_FAST_S_MP_MUL_DIGS_C | |
958 #define BN_MP_INIT_SIZE_C | |
959 #define BN_MP_CLAMP_C | |
960 #define BN_MP_EXCH_C | |
961 #define BN_MP_CLEAR_C | |
962 #endif | |
963 | |
964 #if defined(BN_S_MP_MUL_HIGH_DIGS_C) | |
965 #define BN_FAST_S_MP_MUL_HIGH_DIGS_C | |
966 #define BN_MP_INIT_SIZE_C | |
967 #define BN_MP_CLAMP_C | |
968 #define BN_MP_EXCH_C | |
969 #define BN_MP_CLEAR_C | |
970 #endif | |
971 | |
972 #if defined(BN_S_MP_SQR_C) | |
973 #define BN_MP_INIT_SIZE_C | |
974 #define BN_MP_CLAMP_C | |
975 #define BN_MP_EXCH_C | |
976 #define BN_MP_CLEAR_C | |
977 #endif | |
978 | |
979 #if defined(BN_S_MP_SUB_C) | |
980 #define BN_MP_GROW_C | |
981 #define BN_MP_CLAMP_C | |
982 #endif | |
983 | |
984 #if defined(BNCORE_C) | |
985 #endif | |
986 | |
987 #ifdef LTM3 | |
988 #define LTM_LAST | |
989 #endif | |
990 #include <tommath_superclass.h> | |
991 #include <tommath_class.h> | |
992 #else | |
993 #define LTM_LAST | |
994 #endif | |
283
bd240aa12ba7
* Changes imported from Dropbear 0.47.
Matt Johnston <matt@ucc.asn.au>
parents:
282
diff
changeset
|
995 |
bd240aa12ba7
* Changes imported from Dropbear 0.47.
Matt Johnston <matt@ucc.asn.au>
parents:
282
diff
changeset
|
996 /* Dropbear doesn't need these. */ |
bd240aa12ba7
* Changes imported from Dropbear 0.47.
Matt Johnston <matt@ucc.asn.au>
parents:
282
diff
changeset
|
997 #undef BN_MP_KARATSUBA_MUL_C |
bd240aa12ba7
* Changes imported from Dropbear 0.47.
Matt Johnston <matt@ucc.asn.au>
parents:
282
diff
changeset
|
998 #undef BN_MP_KARATSUBA_SQR_C |
bd240aa12ba7
* Changes imported from Dropbear 0.47.
Matt Johnston <matt@ucc.asn.au>
parents:
282
diff
changeset
|
999 #undef BN_MP_TOOM_MUL_C |
bd240aa12ba7
* Changes imported from Dropbear 0.47.
Matt Johnston <matt@ucc.asn.au>
parents:
282
diff
changeset
|
1000 #undef BN_MP_TOOM_SQR_C |