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