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