-
Notifications
You must be signed in to change notification settings - Fork 0
/
relic_conf.h
717 lines (638 loc) · 19.2 KB
/
relic_conf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
/*
* RELIC is an Efficient LIbrary for Cryptography
* Copyright (c) 2009 RELIC Authors
*
* This file is part of RELIC. RELIC is legal property of its developers,
* whose names are not listed here. Please refer to the COPYRIGHT file
* for contact information.
*
* RELIC is free software; you can redistribute it and/or modify it under the
* terms of the version 2.1 (or later) of the GNU Lesser General Public License
* as published by the Free Software Foundation; or version 2.0 of the Apache
* License as published by the Apache Software Foundation. See the LICENSE files
* for more details.
*
* RELIC is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the LICENSE files for more details.
*
* You should have received a copy of the GNU Lesser General Public or the
* Apache License along with RELIC. If not, see <https://www.gnu.org/licenses/>
* or <https://www.apache.org/licenses/>.
*/
/**
* @file
*
* Project configuration.
*
* @version $Id: relic_conf.h.in 45 2009-07-04 23:45:48Z dfaranha $
* @ingroup relic
*/
#ifndef RLC_CONF_H
#define RLC_CONF_H
/** Project version. */
#define RLC_VERSION "0.5.0"
/** Debugging support. */
/* #undef DEBUG */
/** Profiling support. */
/* #undef PROFL */
/** Error handling support. */
/* #undef CHECK */
/** Verbose error messages. */
/* #undef VERBS */
/** Build with overhead estimation. */
/* #undef OVERH */
/** Build documentation. */
/* #undef DOCUM */
/** Build only the selected algorithms. */
/* #undef STRIP */
/** Build with printing disabled. */
//#define QUIET
/** Build with colored output. */
#define COLOR
/** Build with big-endian support. */
/* #undef BIGED */
/** Build shared library. */
/* #undef SHLIB */
/** Build static library. */
#define STLIB
/** Number of times each test is ran. */
#define TESTS 0
/** Number of times each benchmark is ran. */
#define BENCH 0
/** Number of available cores. */
#define CORES 1
/** Atmel AVR ATMega128 8-bit architecture. */
#define AVR 1
/** MSP430 16-bit architecture. */
#define MSP 2
/** ARM 32-bit architecture. */
#define ARM 3
/** Intel x86-compatible 32-bit architecture. */
#define X86 4
/** AMD64-compatible 64-bit architecture. */
#define X64 5
/** Architecture. */
#define ARCH X64
/** Size of word in this architecture. */
#define WSIZE 64
/** Byte boundary to align digit vectors. */
#define ALIGN 1
/** Build multiple precision integer module. */
#define WITH_BN
/** Build prime field module. */
#define WITH_FP
/** Build prime field extension module. */
#define WITH_FPX
/** Build binary field module. */
#define WITH_FB
/** Build prime elliptic curve module. */
#define WITH_EP
/** Build prime field extension elliptic curve module. */
#define WITH_EPX
/** Build binary elliptic curve module. */
#define WITH_EB
/** Build elliptic Edwards curve module. */
#define WITH_ED
/** Build elliptic curve cryptography module. */
#define WITH_EC
/** Build pairings over prime curves module. */
#define WITH_PP
/** Build pairing-based cryptography module. */
#define WITH_PC
/** Build block ciphers. */
#define WITH_BC
/** Build hash functions. */
#define WITH_MD
/** Build cryptographic protocols. */
#define WITH_CP
/** Build Multi-party computation primitives. */
#define WITH_MPC
/** Easy C-only backend. */
#define EASY 1
/** GMP backend. */
#define GMP 2
/** GMP constant-time backend. */
#define GMP_SEC 3
/** Arithmetic backend. */
#define ARITH EASY
/** Required precision in bits. */
#define BN_PRECI 1024
/** A multiple precision integer can store w words. */
#define SINGLE 0
/** A multiple precision integer can store the result of an addition. */
#define CARRY 1
/** A multiple precision integer can store the result of a multiplication. */
#define DOUBLE 2
/** Effective size of a multiple precision integer. */
#define BN_MAGNI DOUBLE
/** Number of Karatsuba steps. */
#define BN_KARAT 0
/** Schoolbook multiplication. */
#define BASIC 1
/** Comba multiplication. */
#define COMBA 2
/** Chosen multiple precision multiplication method. */
#define BN_MUL BASIC
/** Schoolbook squaring. */
#define BASIC 1
/** Comba squaring. */
#define COMBA 2
/** Reuse multiplication for squaring. */
#define MULTP 4
/** Chosen multiple precision multiplication method. */
#define BN_SQR BASIC
/** Division modular reduction. */
#define BASIC 1
/** Barrett modular reduction. */
#define BARRT 2
/** Montgomery modular reduction. */
#define MONTY 3
/** Pseudo-Mersenne modular reduction. */
#define PMERS 4
/** Chosen multiple precision modular reduction method. */
#define BN_MOD BASIC
/** Binary modular exponentiation. */
#define BASIC 1
/** Sliding window modular exponentiation. */
#define SLIDE 2
/** Montgomery powering ladder. */
#define MONTY 3
/** Chosen multiple precision modular exponentiation method. */
#define BN_MXP BASIC
/** Basic Euclidean GCD Algorithm. */
#define BASIC 1
/** Lehmer's fast GCD Algorithm. */
#define LEHME 2
/** Stein's binary GCD Algorithm. */
#define STEIN 3
/** Chosen multiple precision greatest common divisor method. */
#define BN_GCD BASIC
/** Basic prime generation. */
#define BASIC 1
/** Safe prime generation. */
#define SAFEP 2
/** Strong prime generation. */
#define STRON 3
/** Chosen prime generation algorithm. */
#define BN_GEN BASIC
/** Multiple precision arithmetic method */
#define BN_METHD "BASIC;BASIC;BASIC;BASIC;BASIC;BASIC"
/** Prime field size in bits. */
#define FP_PRIME 381
/** Number of Karatsuba steps. */
#define FP_KARAT 0
/** Prefer Pseudo-Mersenne primes over random primes. */
/* #undef FP_PMERS */
/** Use -1 as quadratic non-residue. */
#define FP_QNRES
/** Width of window processing for exponentiation methods. */
#define FP_WIDTH 4
/** Schoolbook addition. */
#define BASIC 1
/** Integrated modular addtion. */
#define INTEG 3
/** Chosen prime field multiplication method. */
#define FP_ADD BASIC
/** Schoolbook multiplication. */
#define BASIC 1
/** Comba multiplication. */
#define COMBA 2
/** Integrated modular multiplication. */
#define INTEG 3
/** Chosen prime field multiplication method. */
#define FP_MUL BASIC
/** Schoolbook squaring. */
#define BASIC 1
/** Comba squaring. */
#define COMBA 2
/** Integrated modular squaring. */
#define INTEG 3
/** Reuse multiplication for squaring. */
#define MULTP 4
/** Chosen prime field multiplication method. */
#define FP_SQR BASIC
/** Division-based reduction. */
#define BASIC 1
/** Fast reduction modulo special form prime. */
#define QUICK 2
/** Montgomery modular reduction. */
#define MONTY 3
/** Chosen prime field reduction method. */
#define FP_RDC BASIC
/** Inversion by Fermat's Little Theorem. */
#define BASIC 1
/** Binary inversion. */
#define BINAR 2
/** Integrated modular multiplication. */
#define MONTY 3
/** Extended Euclidean algorithm. */
#define EXGCD 4
/** Constant-time inversion by Bernstein-Yang division steps. */
#define DIVST 5
/** Use implementation provided by the lower layer. */
#define LOWER 8
/** Chosen prime field inversion method. */
#define FP_INV BASIC
/** Binary modular exponentiation. */
#define BASIC 1
/** Sliding window modular exponentiation. */
#define SLIDE 2
/** Constant-time Montgomery powering ladder. */
#define MONTY 3
/** Chosen multiple precision modular exponentiation method. */
#define FP_EXP BASIC
/** Prime field arithmetic method */
#define FP_METHD "BASIC;BASIC;BASIC;BASIC;BASIC;BASIC"
/** Basic quadratic extension field arithmetic. */
#define BASIC 1
/** Integrated extension field arithmetic. */
#define INTEG 3
/* Chosen extension field arithmetic method. */
#define FPX_QDR BASIC
/** Basic cubic extension field arithmetic. */
#define BASIC 1
/** Integrated extension field arithmetic. */
#define INTEG 3
/* Chosen extension field arithmetic method. */
#define FPX_CBC INTEG
/** Basic quadratic extension field arithmetic. */
#define BASIC 1
/** Lazy-reduced extension field arithmetic. */
#define LAZYR 2
/* Chosen extension field arithmetic method. */
#define FPX_RDC LAZYR
/** Prime extension field arithmetic method */
#define FPX_METHD "INTEG;INTEG;LAZYR"
/** Irreducible polynomial size in bits. */
#define FB_POLYN 283
/** Number of Karatsuba steps. */
#define FB_KARAT 0
/** Prefer trinomials over pentanomials. */
#define FB_TRINO
/** Prefer square-root friendly polynomials. */
/* #undef FB_SQRTF */
/** Precompute multiplication table for sqrt(z). */
#define FB_PRECO
/** Width of window processing for exponentiation methods. */
#define FB_WIDTH 4
/** Shift-and-add multiplication. */
#define BASIC 1
/** Lopez-Dahab multiplication. */
#define LODAH 2
/** Integrated modular multiplication. */
#define INTEG 3
/** Chosen binary field multiplication method. */
#define FB_MUL LODAH
/** Basic squaring. */
#define BASIC 1
/** Table-based squaring. */
#define QUICK 2
/** Integrated modular squaring. */
#define INTEG 3
/** Chosen binary field squaring method. */
#define FB_SQR QUICK
/** Shift-and-add modular reduction. */
#define BASIC 1
/** Fast reduction modulo a trinomial or pentanomial. */
#define QUICK 2
/** Chosen binary field modular reduction method. */
#define FB_RDC QUICK
/** Square root by repeated squaring. */
#define BASIC 1
/** Fast square root extraction. */
#define QUICK 2
/** Chosen binary field modular reduction method. */
#define FB_SRT QUICK
/** Trace by repeated squaring. */
#define BASIC 1
/** Fast trace computation. */
#define QUICK 2
/** Chosen trace computation method. */
#define FB_TRC QUICK
/** Solve by half-trace computation. */
#define BASIC 1
/** Solve with precomputed half-traces. */
#define QUICK 2
/** Chosen method to solve a quadratic equation. */
#define FB_SLV QUICK
/** Inversion by Fermat's Little Theorem. */
#define BASIC 1
/** Binary inversion. */
#define BINAR 2
/** Almost inverse algorithm. */
#define ALMOS 3
/** Extended Euclidean algorithm. */
#define EXGCD 4
/** Itoh-Tsuji inversion. */
#define ITOHT 5
/** Hardware-friendly inversion by Brunner-Curiger-Hofstetter.*/
#define BRUCH 6
/** Constant-time version of almost inverse. */
#define CTAIA 7
/** Use implementation provided by the lower layer. */
#define LOWER 8
/** Chosen binary field inversion method. */
#define FB_INV EXGCD
/** Binary modular exponentiation. */
#define BASIC 1
/** Sliding window modular exponentiation. */
#define SLIDE 2
/** Constant-time Montgomery powering ladder. */
#define MONTY 3
/** Chosen multiple precision modular exponentiation method. */
#define FB_EXP SLIDE
/** Iterated squaring/square-root by consecutive squaring/square-root. */
#define BASIC 1
/** Iterated squaring/square-root by table-based method. */
#define QUICK 2
/** Chosen method to solve a quadratic equation. */
#define FB_ITR QUICK
/** Binary field arithmetic method */
#define FB_METHD "LODAH;QUICK;QUICK;QUICK;QUICK;QUICK;EXGCD;SLIDE;QUICK"
/** Support for ordinary curves. */
/* #undef EP_PLAIN */
/** Support for supersingular curves. */
/* #undef EP_SUPER */
/** Support for prime curves with efficient endormorphisms. */
#define EP_ENDOM
/** Use mixed coordinates. */
#define EP_MIXED
/** Build precomputation table for generator. */
#define EP_PRECO
/** Enable isogeny map for SSWU map-to-curve. */
#define EP_CTMAP
/** Width of precomputation table for fixed point methods. */
#define EP_DEPTH 4
/** Width of window processing for unknown point methods. */
#define EP_WIDTH 4
/** Affine coordinates. */
#define BASIC 1
/** Projective coordinates. */
#define PROJC 2
/** Jacobian coordinates. */
#define JACOB 3
/** Chosen prime elliptic curve coordinate method. */
#define EP_ADD PROJC
/** Binary point multiplication. */
#define BASIC 1
/** Sliding window. */
#define SLIDE 2
/** Montgomery powering ladder. */
#define MONTY 3
/** Left-to-right Width-w NAF. */
#define LWNAF 4
/** Left-to-right Width-w NAF. */
#define LWREG 5
/** Chosen prime elliptic curve point multiplication method. */
#define EP_MUL BASIC
/** Binary point multiplication. */
#define BASIC 1
/** Single-table comb method. */
#define COMBS 2
/** Double-table comb method. */
#define COMBD 3
/** Left-to-right Width-w NAF. */
#define LWNAF 4
/** Chosen prime elliptic curve point multiplication method. */
#define EP_FIX BASIC
/** Basic simultaneouns point multiplication. */
#define BASIC 1
/** Shamir's trick. */
#define TRICK 2
/** Interleaving of w-(T)NAFs. */
#define INTER 3
/** Joint sparse form. */
#define JOINT 4
/** Chosen prime elliptic curve simulteanous point multiplication method. */
#define EP_SIM INTER
/** Prime elliptic curve arithmetic method. */
#define EP_METHD "PROJC;LWNAF;COMBS;INTER"
/** Support for ordinary curves without endormorphisms. */
#define EB_PLAIN
/** Support for Koblitz anomalous binary curves. */
#define EB_KBLTZ
/** Use mixed coordinates. */
#define EB_MIXED
/** Build precomputation table for generator. */
#define EB_PRECO
/** Width of precomputation table for fixed point methods. */
#define EB_DEPTH 4
/** Width of window processing for unknown point methods. */
#define EB_WIDTH 4
/** Binary elliptic curve arithmetic method. */
#define EB_METHD "PROJC;LWNAF;COMBS;INTER"
/** Affine coordinates. */
#define BASIC 1
/** López-Dahab Projective coordinates. */
#define PROJC 2
/** Chosen binary elliptic curve coordinate method. */
#define EB_ADD PROJC
/** Binary point multiplication. */
#define BASIC 1
/** L�pez-Dahab point multiplication. */
#define LODAH 2
/** Halving. */
#define HALVE 3
/** Left-to-right width-w (T)NAF. */
#define LWNAF 4
/** Right-to-left width-w (T)NAF. */
#define RWNAF 5
/** Chosen binary elliptic curve point multiplication method. */
#define EB_MUL LWNAF
/** Binary point multiplication. */
#define BASIC 1
/** Single-table comb method. */
#define COMBS 2
/** Double-table comb method. */
#define COMBD 3
/** Left-to-right Width-w NAF. */
#define LWNAF 4
/** Chosen binary elliptic curve point multiplication method. */
#define EB_FIX COMBS
/** Basic simultaneouns point multiplication. */
#define BASIC 1
/** Shamir's trick. */
#define TRICK 2
/** Interleaving of w-(T)NAFs. */
#define INTER 3
/** Joint sparse form. */
#define JOINT 4
/** Chosen binary elliptic curve simulteanous point multiplication method. */
#define EB_SIM INTER
/** Build precomputation table for generator. */
#define ED_PRECO
/** Width of precomputation table for fixed point methods. */
#define ED_DEPTH 4
/** Width of window processing for unknown point methods. */
#define ED_WIDTH 4
/** Edwards elliptic curve arithmetic method. */
#define ED_METHD "PROJC;LWNAF;COMBS;INTER"
/** Affine coordinates. */
#define BASIC 1
/** Simple projective twisted Edwards coordinates */
#define PROJC 2
/** Extended projective twisted Edwards coordinates */
#define EXTND 3
/** Chosen binary elliptic curve coordinate method. */
#define ED_ADD PROJC
/** Binary point multiplication. */
#define BASIC 1
/** Sliding window. */
#define SLIDE 2
/** Montgomery powering ladder. */
#define MONTY 3
/** Left-to-right Width-w NAF. */
#define LWNAF 4
/** Left-to-right Width-w NAF. */
#define LWREG 5
/** Chosen prime elliptic twisted Edwards curve point multiplication method. */
#define ED_MUL LWNAF
/** Binary point multiplication. */
#define BASIC 1
/** Single-table comb method. */
#define COMBS 2
/** Double-table comb method. */
#define COMBD 3
/** Left-to-right Width-w NAF. */
#define LWNAF 4
/** Chosen prime elliptic twisted Edwards curve point multiplication method. */
#define ED_FIX COMBS
/** Basic simultaneouns point multiplication. */
#define BASIC 1
/** Shamir's trick. */
#define TRICK 2
/** Interleaving of w-(T)NAFs. */
#define INTER 3
/** Joint sparse form. */
#define JOINT 4
/** Chosen prime elliptic curve simulteanous point multiplication method. */
#define ED_SIM INTER
/** Prime curves. */
#define PRIME 1
/** Binary curves. */
#define CHAR2 2
/** Edwards curves */
#define EDDIE 3
/** Chosen elliptic curve type. */
#define EC_CUR PRIME
/** Chosen elliptic curve cryptography method. */
#define EC_METHD "PRIME"
/** Prefer curves with efficient endomorphisms. */
/* #undef EC_ENDOM */
/** Basic quadratic extension field arithmetic. */
#define BASIC 1
/** Lazy-reduced extension field arithmetic. */
#define LAZYR 2
/* Chosen extension field arithmetic method. */
#define PP_EXT LAZYR
/** Bilinear pairing method. */
#define PP_METHD "LAZYR;OATEP"
/** Tate pairing. */
#define TATEP 1
/** Weil pairing. */
#define WEILP 2
/** Optimal ate pairing. */
#define OATEP 3
/** Chosen pairing method over prime elliptic curves. */
#define PP_MAP OATEP
/** SHA-224 hash function. */
#define SH224 2
/** SHA-256 hash function. */
#define SH256 3
/** SHA-384 hash function. */
#define SH384 4
/** SHA-512 hash function. */
#define SH512 5
/** BLAKE2s-160 hash function. */
#define B2S160 6
/** BLAKE2s-256 hash function. */
#define B2S256 7
/** Chosen hash function. */
#define MD_MAP SH256
/** Choice of hash function. */
#define MD_METHD "SH256"
/** Chosen RSA method. */
#define CP_CRT
/** RSA without padding. */
#define BASIC 1
/** RSA PKCS#1 v1.5 padding. */
#define PKCS1 2
/** RSA PKCS#1 v2.1 padding. */
#define PKCS2 3
/** Chosen RSA padding method. */
#define CP_RSAPD PKCS2
/** Automatic memory allocation. */
#define AUTO 1
/** Dynamic memory allocation. */
#define DYNAMIC 2
/** Chosen memory allocation policy. */
#define ALLOC AUTO
/** NIST HASH-DRBG generator. */
#define HASHD 1
/** Intel RdRand instruction. */
#define RDRND 2
/** Operating system underlying generator. */
#define UDEV 3
/** Override library generator with the callback. */
#define CALL 4
/** Chosen random generator. */
#define RAND HASHD
/** Standard C library generator. */
#define LIBC 1
/** Intel RdRand instruction. */
#define RDRND 2
/** Device node generator. */
#define UDEV 3
/** Use Windows' CryptGenRandom. */
#define WCGR 4
/** Chosen random generator seeder. */
#define SEED UDEV
/** GNU/Linux operating system. */
#define LINUX 1
/** FreeBSD operating system. */
#define FREEBSD 2
/** Windows operating system. */
#define MACOSX 3
/** Windows operating system. */
#define WINDOWS 4
/** Android operating system. */
#define DROID 5
/** Arduino platform. */
#define DUINO 6
/** OpenBSD operating system. */
#define OPENBSD 7
/** Detected operation system. */
#define OPSYS LINUX
/** OpenMP multithreading support. */
#define OPENMP 1
/** POSIX multithreading support. */
#define PTHREAD 2
/** Chosen multithreading API. */
#define MULTI PTHREAD
/** Per-process high-resolution timer. */
#define HREAL 1
/** Per-process high-resolution timer. */
#define HPROC 2
/** Per-thread high-resolution timer. */
#define HTHRD 3
/** POSIX-compatible timer. */
#define POSIX 4
/** ANSI-compatible timer. */
#define ANSI 5
/** Cycle-counting timer. */
#define CYCLE 6
/** Performance monitoring framework. */
#define PERF 7
/** Chosen timer. */
#define TIMER CYCLE
/** Prefix to identity this build of the library. */
/* #undef LABEL */
#ifndef ASM
#include "relic_label.h"
/**
* Prints the project options selected at build time.
*/
void conf_print(void);
#endif /* ASM */
#endif /* !RLC_CONF_H */