snowbridge_amcl/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2
3#[cfg(test)]
4extern crate serde_json;
5#[cfg(test)]
6#[macro_use]
7extern crate serde_derive;
8
9extern crate alloc;
10
11mod std;
12pub mod aes;
13#[cfg(target_pointer_width = "32")]
14#[path = "arch/arch32.rs"]
15pub mod arch;
16#[cfg(target_pointer_width = "64")]
17#[path = "arch/arch64.rs"]
18pub mod arch;
19pub mod errors;
20pub mod gcm;
21pub mod hash256;
22pub mod hash384;
23pub mod hash512;
24pub mod nhs;
25pub mod rand;
26pub mod sha3;
27pub mod types;
28
29#[cfg(feature = "bls48")]
30#[path = "./"]
31pub mod bls48 {
32    #[cfg(target_pointer_width = "32")]
33    #[path = "roms/rom_bls48_32.rs"]
34    pub mod rom;
35    #[cfg(target_pointer_width = "64")]
36    #[path = "roms/rom_bls48_64.rs"]
37    pub mod rom;
38
39    pub mod big;
40    pub mod bls256;
41    pub mod dbig;
42    pub mod ecp;
43    pub mod ecp8;
44    pub mod fp;
45    pub mod fp16;
46    pub mod fp2;
47    pub mod fp4;
48    pub mod fp48;
49    pub mod fp8;
50    pub mod mpin256;
51    pub mod pair256;
52}
53
54#[cfg(feature = "bls461")]
55#[path = "./"]
56pub mod bls461 {
57    #[cfg(target_pointer_width = "32")]
58    #[path = "roms/rom_bls461_32.rs"]
59    pub mod rom;
60    #[cfg(target_pointer_width = "64")]
61    #[path = "roms/rom_bls461_64.rs"]
62    pub mod rom;
63
64    pub mod big;
65    pub mod bls;
66    pub mod dbig;
67    pub mod ecp;
68    pub mod ecp2;
69    pub mod fp;
70    pub mod fp12;
71    pub mod fp2;
72    pub mod fp4;
73    pub mod mpin;
74    pub mod pair;
75}
76
77#[cfg(feature = "bls383")]
78#[path = "./"]
79pub mod bls383 {
80    #[cfg(target_pointer_width = "32")]
81    #[path = "roms/rom_bls383_32.rs"]
82    pub mod rom;
83    #[cfg(target_pointer_width = "64")]
84    #[path = "roms/rom_bls383_64.rs"]
85    pub mod rom;
86
87    pub mod big;
88    pub mod bls;
89    pub mod dbig;
90    pub mod ecp;
91    pub mod ecp2;
92    pub mod fp;
93    pub mod fp12;
94    pub mod fp2;
95    pub mod fp4;
96    pub mod mpin;
97    pub mod pair;
98}
99
100#[cfg(feature = "bls381")]
101#[path = "./"]
102pub mod bls381 {
103    #[cfg(target_pointer_width = "32")]
104    #[path = "roms/rom_bls381_32.rs"]
105    pub mod rom;
106    #[cfg(target_pointer_width = "64")]
107    #[path = "roms/rom_bls381_64.rs"]
108    pub mod rom;
109
110    pub mod big;
111    pub mod bls381;
112    pub mod dbig;
113    pub mod ecp;
114    pub mod ecp2;
115    pub mod fp;
116    pub mod fp12;
117    pub mod fp2;
118    pub mod fp4;
119    pub mod hash_to_curve;
120    pub mod mpin;
121    pub mod pair;
122}
123
124#[cfg(feature = "fp512bn")]
125#[path = "./"]
126pub mod fp512bn {
127    #[cfg(target_pointer_width = "32")]
128    #[path = "roms/rom_fp512bn_32.rs"]
129    pub mod rom;
130    #[cfg(target_pointer_width = "64")]
131    #[path = "roms/rom_fp512bn_64.rs"]
132    pub mod rom;
133
134    pub mod big;
135    pub mod bls;
136    pub mod dbig;
137    pub mod ecp;
138    pub mod ecp2;
139    pub mod fp;
140    pub mod fp12;
141    pub mod fp2;
142    pub mod fp4;
143    pub mod mpin;
144    pub mod pair;
145}
146
147#[cfg(feature = "fp256bn")]
148#[path = "./"]
149pub mod fp256bn {
150    #[cfg(target_pointer_width = "32")]
151    #[path = "roms/rom_fp256bn_32.rs"]
152    pub mod rom;
153    #[cfg(target_pointer_width = "64")]
154    #[path = "roms/rom_fp256bn_64.rs"]
155    pub mod rom;
156
157    pub mod big;
158    pub mod bls;
159    pub mod dbig;
160    pub mod ecp;
161    pub mod ecp2;
162    pub mod fp;
163    pub mod fp12;
164    pub mod fp2;
165    pub mod fp4;
166    pub mod mpin;
167    pub mod pair;
168}
169
170#[cfg(feature = "bls24")]
171#[path = "./"]
172pub mod bls24 {
173    #[cfg(target_pointer_width = "32")]
174    #[path = "roms/rom_bls24_32.rs"]
175    pub mod rom;
176    #[cfg(target_pointer_width = "64")]
177    #[path = "roms/rom_bls24_64.rs"]
178    pub mod rom;
179
180    pub mod big;
181    pub mod bls192;
182    pub mod dbig;
183    pub mod ecp;
184    pub mod ecp4;
185    pub mod fp;
186    pub mod fp2;
187    pub mod fp24;
188    pub mod fp4;
189    pub mod fp8;
190    pub mod mpin192;
191    pub mod pair192;
192}
193
194#[cfg(feature = "anssi")]
195#[path = "./"]
196pub mod anssi {
197    #[cfg(target_pointer_width = "32")]
198    #[path = "roms/rom_anssi_32.rs"]
199    pub mod rom;
200    #[cfg(target_pointer_width = "64")]
201    #[path = "roms/rom_anssi_64.rs"]
202    pub mod rom;
203
204    pub mod big;
205    pub mod dbig;
206    pub mod ecdh;
207    pub mod ecp;
208    pub mod fp;
209}
210
211#[cfg(feature = "brainpool")]
212#[path = "./"]
213pub mod brainpool {
214    #[cfg(target_pointer_width = "32")]
215    #[path = "roms/rom_brainpool_32.rs"]
216    pub mod rom;
217    #[cfg(target_pointer_width = "64")]
218    #[path = "roms/rom_brainpool_64.rs"]
219    pub mod rom;
220
221    pub mod big;
222    pub mod dbig;
223    pub mod ecdh;
224    pub mod ecp;
225    pub mod fp;
226}
227
228#[cfg(feature = "goldilocks")]
229#[path = "./"]
230pub mod goldilocks {
231    #[cfg(target_pointer_width = "32")]
232    #[path = "roms/rom_goldilocks_32.rs"]
233    pub mod rom;
234    #[cfg(target_pointer_width = "64")]
235    #[path = "roms/rom_goldilocks_64.rs"]
236    pub mod rom;
237
238    pub mod big;
239    pub mod dbig;
240    pub mod ecdh;
241    pub mod ecp;
242    pub mod fp;
243}
244
245#[cfg(feature = "hifive")]
246#[path = "./"]
247pub mod hifive {
248    #[cfg(target_pointer_width = "32")]
249    #[path = "roms/rom_hifive_32.rs"]
250    pub mod rom;
251    #[cfg(target_pointer_width = "64")]
252    #[path = "roms/rom_hifive_64.rs"]
253    pub mod rom;
254
255    pub mod big;
256    pub mod dbig;
257    pub mod ecdh;
258    pub mod ecp;
259    pub mod fp;
260}
261
262#[cfg(feature = "nist256")]
263#[path = "./"]
264pub mod nist256 {
265    #[cfg(target_pointer_width = "32")]
266    #[path = "roms/rom_nist256_32.rs"]
267    pub mod rom;
268    #[cfg(target_pointer_width = "64")]
269    #[path = "roms/rom_nist256_64.rs"]
270    pub mod rom;
271
272    pub mod big;
273    pub mod dbig;
274    pub mod ecdh;
275    pub mod ecp;
276    pub mod fp;
277}
278
279#[cfg(feature = "nist384")]
280#[path = "./"]
281pub mod nist384 {
282    #[cfg(target_pointer_width = "32")]
283    #[path = "roms/rom_nist384_32.rs"]
284    pub mod rom;
285    #[cfg(target_pointer_width = "64")]
286    #[path = "roms/rom_nist384_64.rs"]
287    pub mod rom;
288
289    pub mod big;
290    pub mod dbig;
291    pub mod ecdh;
292    pub mod ecp;
293    pub mod fp;
294}
295
296#[cfg(feature = "nist521")]
297#[path = "./"]
298pub mod nist521 {
299    #[cfg(target_pointer_width = "32")]
300    #[path = "roms/rom_nist521_32.rs"]
301    pub mod rom;
302    #[cfg(target_pointer_width = "64")]
303    #[path = "roms/rom_nist521_64.rs"]
304    pub mod rom;
305
306    pub mod big;
307    pub mod dbig;
308    pub mod ecdh;
309    pub mod ecp;
310    pub mod fp;
311}
312
313#[cfg(feature = "nums256e")]
314#[path = "./"]
315pub mod nums256e {
316    #[cfg(target_pointer_width = "32")]
317    #[path = "roms/rom_nums256e_32.rs"]
318    pub mod rom;
319    #[cfg(target_pointer_width = "64")]
320    #[path = "roms/rom_nums256e_64.rs"]
321    pub mod rom;
322
323    pub mod big;
324    pub mod dbig;
325    pub mod ecdh;
326    pub mod ecp;
327    pub mod fp;
328}
329
330#[cfg(feature = "nums256w")]
331#[path = "./"]
332pub mod nums256w {
333    #[cfg(target_pointer_width = "32")]
334    #[path = "roms/rom_nums256w_32.rs"]
335    pub mod rom;
336    #[cfg(target_pointer_width = "64")]
337    #[path = "roms/rom_nums256w_64.rs"]
338    pub mod rom;
339
340    pub mod big;
341    pub mod dbig;
342    pub mod ecdh;
343    pub mod ecp;
344    pub mod fp;
345}
346
347#[cfg(feature = "nums384e")]
348#[path = "./"]
349pub mod nums384e {
350    #[cfg(target_pointer_width = "32")]
351    #[path = "roms/rom_nums384e_32.rs"]
352    pub mod rom;
353    #[cfg(target_pointer_width = "64")]
354    #[path = "roms/rom_nums384e_64.rs"]
355    pub mod rom;
356
357    pub mod big;
358    pub mod dbig;
359    pub mod ecdh;
360    pub mod ecp;
361    pub mod fp;
362}
363
364#[cfg(feature = "nums384w")]
365#[path = "./"]
366pub mod nums384w {
367    #[cfg(target_pointer_width = "32")]
368    #[path = "roms/rom_nums384w_32.rs"]
369    pub mod rom;
370    #[cfg(target_pointer_width = "64")]
371    #[path = "roms/rom_nums384w_64.rs"]
372    pub mod rom;
373
374    pub mod big;
375    pub mod dbig;
376    pub mod ecdh;
377    pub mod ecp;
378    pub mod fp;
379}
380
381#[cfg(feature = "nums512w")]
382#[path = "./"]
383pub mod nums512w {
384    #[cfg(target_pointer_width = "32")]
385    #[path = "roms/rom_nums512w_32.rs"]
386    pub mod rom;
387    #[cfg(target_pointer_width = "64")]
388    #[path = "roms/rom_nums512w_64.rs"]
389    pub mod rom;
390
391    pub mod big;
392    pub mod dbig;
393    pub mod ecdh;
394    pub mod ecp;
395    pub mod fp;
396}
397
398#[cfg(feature = "nums512e")]
399#[path = "./"]
400pub mod nums512e {
401    #[cfg(target_pointer_width = "32")]
402    #[path = "roms/rom_nums512e_32.rs"]
403    pub mod rom;
404    #[cfg(target_pointer_width = "64")]
405    #[path = "roms/rom_nums512e_64.rs"]
406    pub mod rom;
407
408    pub mod big;
409    pub mod dbig;
410    pub mod ecdh;
411    pub mod ecp;
412    pub mod fp;
413}
414
415#[cfg(feature = "secp256k1")]
416#[path = "./"]
417pub mod secp256k1 {
418    #[cfg(target_pointer_width = "32")]
419    #[path = "roms/rom_secp256k1_32.rs"]
420    pub mod rom;
421    #[cfg(target_pointer_width = "64")]
422    #[path = "roms/rom_secp256k1_64.rs"]
423    pub mod rom;
424
425    pub mod big;
426    pub mod dbig;
427    pub mod ecdh;
428    pub mod ecp;
429    pub mod fp;
430}
431
432#[cfg(feature = "c25519")]
433#[path = "./"]
434pub mod c25519 {
435    #[cfg(target_pointer_width = "32")]
436    #[path = "roms/rom_c25519_32.rs"]
437    pub mod rom;
438    #[cfg(target_pointer_width = "64")]
439    #[path = "roms/rom_c25519_64.rs"]
440    pub mod rom;
441
442    pub mod big;
443    pub mod dbig;
444    pub mod ecdh;
445    pub mod ecp;
446    pub mod fp;
447}
448
449#[cfg(feature = "c41417")]
450#[path = "./"]
451pub mod c41417 {
452    #[cfg(target_pointer_width = "32")]
453    #[path = "roms/rom_c41417_32.rs"]
454    pub mod rom;
455    #[cfg(target_pointer_width = "64")]
456    #[path = "roms/rom_c41417_64.rs"]
457    pub mod rom;
458
459    pub mod big;
460    pub mod dbig;
461    pub mod ecdh;
462    pub mod ecp;
463    pub mod fp;
464}
465
466#[cfg(feature = "ed25519")]
467#[path = "./"]
468pub mod ed25519 {
469    #[cfg(target_pointer_width = "32")]
470    #[path = "roms/rom_ed25519_32.rs"]
471    pub mod rom;
472    #[cfg(target_pointer_width = "64")]
473    #[path = "roms/rom_ed25519_64.rs"]
474    pub mod rom;
475
476    pub mod big;
477    pub mod dbig;
478    pub mod ecdh;
479    pub mod ecp;
480    pub mod fp;
481}
482
483#[cfg(feature = "bn254cx")]
484#[path = "./"]
485pub mod bn254cx {
486    #[cfg(target_pointer_width = "32")]
487    #[path = "roms/rom_bn254cx_32.rs"]
488    pub mod rom;
489    #[cfg(target_pointer_width = "64")]
490    #[path = "roms/rom_bn254cx_64.rs"]
491    pub mod rom;
492
493    pub mod big;
494    pub mod bls;
495    pub mod dbig;
496    pub mod ecdh;
497    pub mod ecp;
498    pub mod ecp2;
499    pub mod fp;
500    pub mod fp12;
501    pub mod fp2;
502    pub mod fp4;
503    pub mod mpin;
504    pub mod pair;
505}
506
507#[cfg(feature = "bn254")]
508#[path = "./"]
509pub mod bn254 {
510    #[cfg(target_pointer_width = "32")]
511    #[path = "roms/rom_bn254_32.rs"]
512    pub mod rom;
513    #[cfg(target_pointer_width = "64")]
514    #[path = "roms/rom_bn254_64.rs"]
515    pub mod rom;
516
517    pub mod big;
518    pub mod bls;
519    pub mod dbig;
520    pub mod ecdh;
521    pub mod ecp;
522    pub mod ecp2;
523    pub mod fp;
524    pub mod fp12;
525    pub mod fp2;
526    pub mod fp4;
527    pub mod mpin;
528    pub mod pair;
529}
530
531#[cfg(feature = "rsa2048")]
532#[path = "./"]
533pub mod rsa2048 {
534    pub mod big;
535    pub mod dbig;
536    pub mod ff;
537    #[cfg(target_pointer_width = "32")]
538    #[path = "roms/rom_rsa2048_32.rs"]
539    pub mod rom;
540    #[cfg(target_pointer_width = "64")]
541    #[path = "roms/rom_rsa2048_64.rs"]
542    pub mod rom;
543    pub mod rsa;
544}
545
546#[cfg(feature = "rsa3072")]
547#[path = "./"]
548pub mod rsa3072 {
549    pub mod big;
550    pub mod dbig;
551    pub mod ff;
552    #[cfg(target_pointer_width = "32")]
553    #[path = "roms/rom_rsa3072_32.rs"]
554    pub mod rom;
555    #[cfg(target_pointer_width = "64")]
556    #[path = "roms/rom_rsa3072_64.rs"]
557    pub mod rom;
558    pub mod rsa;
559}
560
561#[cfg(feature = "rsa4096")]
562#[path = "./"]
563pub mod rsa4096 {
564    pub mod big;
565    pub mod dbig;
566    pub mod ff;
567    #[cfg(target_pointer_width = "32")]
568    #[path = "roms/rom_rsa4096_32.rs"]
569    mod rom;
570    #[cfg(target_pointer_width = "64")]
571    #[path = "roms/rom_rsa4096_64.rs"]
572    mod rom;
573    pub mod rsa;
574}
575
576#[cfg(test)]
577pub mod test_utils;