blob: e975550bba1cfcb1903ebe7368c158c8be1abf25 [file] [log] [blame]
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05001#ifndef LBN32_H
2#define LBN32_H
3
4#include "lbn.h"
5
6#ifndef BNWORD32
7#error 32-bit bignum library requires a 32-bit data type
8#endif
9
10#ifndef lbnCopy_32
11void lbnCopy_32(BNWORD32 *dest, BNWORD32 const *src, unsigned len);
12#endif
13#ifndef lbnZero_32
14void lbnZero_32(BNWORD32 *num, unsigned len);
15#endif
16#ifndef lbnNeg_32
17void lbnNeg_32(BNWORD32 *num, unsigned len);
18#endif
19
20#ifndef lbnAdd1_32
21BNWORD32 lbnAdd1_32(BNWORD32 *num, unsigned len, BNWORD32 carry);
22#endif
23#ifndef lbnSub1_32
24BNWORD32 lbnSub1_32(BNWORD32 *num, unsigned len, BNWORD32 borrow);
25#endif
26
27#ifndef lbnAddN_32
28BNWORD32 lbnAddN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len);
29#endif
30#ifndef lbnSubN_32
31BNWORD32 lbnSubN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len);
32#endif
33
34#ifndef lbnCmp_32
35int lbnCmp_32(BNWORD32 const *num1, BNWORD32 const *num2, unsigned len);
36#endif
37
38#ifndef lbnMulN1_32
39void lbnMulN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k);
40#endif
41#ifndef lbnMulAdd1_32
42BNWORD32
43lbnMulAdd1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k);
44#endif
45#ifndef lbnMulSub1_32
46BNWORD32 lbnMulSub1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k);
47#endif
48
49#ifndef lbnLshift_32
50BNWORD32 lbnLshift_32(BNWORD32 *num, unsigned len, unsigned shift);
51#endif
52#ifndef lbnDouble_32
53BNWORD32 lbnDouble_32(BNWORD32 *num, unsigned len);
54#endif
55#ifndef lbnRshift_32
56BNWORD32 lbnRshift_32(BNWORD32 *num, unsigned len, unsigned shift);
57#endif
58
59#ifndef lbnMul_32
60void lbnMul_32(BNWORD32 *prod, BNWORD32 const *num1, unsigned len1,
61 BNWORD32 const *num2, unsigned len2);
62#endif
63#ifndef lbnSquare_32
64void lbnSquare_32(BNWORD32 *prod, BNWORD32 const *num, unsigned len);
65#endif
66
67#ifndef lbnNorm_32
68unsigned lbnNorm_32(BNWORD32 const *num, unsigned len);
69#endif
70#ifndef lbnBits_32
71unsigned lbnBits_32(BNWORD32 const *num, unsigned len);
72#endif
73
74#ifndef lbnExtractBigBytes_32
75void lbnExtractBigBytes_32(BNWORD32 const *bn, unsigned char *buf,
76 unsigned lsbyte, unsigned buflen);
77#endif
78#ifndef lbnInsertBigytes_32
79void lbnInsertBigBytes_32(BNWORD32 *n, unsigned char const *buf,
80 unsigned lsbyte, unsigned buflen);
81#endif
82#ifndef lbnExtractLittleBytes_32
83void lbnExtractLittleBytes_32(BNWORD32 const *bn, unsigned char *buf,
84 unsigned lsbyte, unsigned buflen);
85#endif
86#ifndef lbnInsertLittleBytes_32
87void lbnInsertLittleBytes_32(BNWORD32 *n, unsigned char const *buf,
88 unsigned lsbyte, unsigned buflen);
89#endif
90
91#ifndef lbnDiv21_32
92BNWORD32 lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d);
93#endif
94#ifndef lbnDiv1_32
95BNWORD32 lbnDiv1_32(BNWORD32 *q, BNWORD32 *rem,
96 BNWORD32 const *n, unsigned len, BNWORD32 d);
97#endif
98#ifndef lbnModQ_32
99unsigned lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d);
100#endif
101#ifndef lbnDiv_32
102BNWORD32
103lbnDiv_32(BNWORD32 *q, BNWORD32 *n, unsigned nlen, BNWORD32 *d, unsigned dlen);
104#endif
105
106#ifndef lbnMontInv1_32
107BNWORD32 lbnMontInv1_32(BNWORD32 const x);
108#endif
109#ifndef lbnMontReduce_32
110void lbnMontReduce_32(BNWORD32 *n, BNWORD32 const *mod, unsigned const mlen,
111 BNWORD32 inv);
112#endif
113#ifndef lbnToMont_32
114void lbnToMont_32(BNWORD32 *n, unsigned nlen, BNWORD32 *mod, unsigned mlen);
115#endif
116#ifndef lbnFromMont_32
117void lbnFromMont_32(BNWORD32 *n, BNWORD32 *mod, unsigned len);
118#endif
119
120#ifndef lbnExpMod_32
121int lbnExpMod_32(BNWORD32 *result, BNWORD32 const *n, unsigned nlen,
122 BNWORD32 const *exp, unsigned elen, BNWORD32 *mod, unsigned mlen);
123#endif
124#ifndef lbnDoubleExpMod_32
125int lbnDoubleExpMod_32(BNWORD32 *result,
126 BNWORD32 const *n1, unsigned n1len, BNWORD32 const *e1, unsigned e1len,
127 BNWORD32 const *n2, unsigned n2len, BNWORD32 const *e2, unsigned e2len,
128 BNWORD32 *mod, unsigned mlen);
129#endif
130#ifndef lbnTwoExpMod_32
131int lbnTwoExpMod_32(BNWORD32 *n, BNWORD32 const *exp, unsigned elen,
132 BNWORD32 *mod, unsigned mlen);
133#endif
134#ifndef lbnGcd_32
135int lbnGcd_32(BNWORD32 *a, unsigned alen, BNWORD32 *b, unsigned blen,
136 unsigned *rlen);
137#endif
138#ifndef lbnInv_32
139int lbnInv_32(BNWORD32 *a, unsigned alen, BNWORD32 const *mod, unsigned mlen);
140#endif
141
142int lbnBasePrecompBegin_32(BNWORD32 **array, unsigned n, unsigned bits,
143 BNWORD32 const *g, unsigned glen, BNWORD32 *mod, unsigned mlen);
144int lbnBasePrecompExp_32(BNWORD32 *result, BNWORD32 const * const *array,
145 unsigned bits, BNWORD32 const *exp, unsigned elen,
146 BNWORD32 const *mod, unsigned mlen);
147int lbnDoubleBasePrecompExp_32(BNWORD32 *result, unsigned bits,
148 BNWORD32 const * const *array1, BNWORD32 const *exp1, unsigned elen1,
149 BNWORD32 const * const *array2, BNWORD32 const *exp2,
150 unsigned elen2, BNWORD32 const *mod, unsigned mlen);
151
152#endif /* LBN32_H */