blob: 283e248c5d3b6fea677a8983797184d0f1b58d81 [file] [log] [blame]
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05001#ifndef LBN64_H
2#define LBN64_H
3
4#include "lbn.h"
5
6#ifndef BNWORD64
7#error 64-bit bignum library requires a 64-bit data type
8#endif
9
10#ifndef lbnCopy_64
11void lbnCopy_64(BNWORD64 *dest, BNWORD64 const *src, unsigned len);
12#endif
13#ifndef lbnZero_64
14void lbnZero_64(BNWORD64 *num, unsigned len);
15#endif
16#ifndef lbnNeg_64
17void lbnNeg_64(BNWORD64 *num, unsigned len);
18#endif
19
20#ifndef lbnAdd1_64
21BNWORD64 lbnAdd1_64(BNWORD64 *num, unsigned len, BNWORD64 carry);
22#endif
23#ifndef lbnSub1_64
24BNWORD64 lbnSub1_64(BNWORD64 *num, unsigned len, BNWORD64 borrow);
25#endif
26
27#ifndef lbnAddN_64
28BNWORD64 lbnAddN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len);
29#endif
30#ifndef lbnSubN_64
31BNWORD64 lbnSubN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len);
32#endif
33
34#ifndef lbnCmp_64
35int lbnCmp_64(BNWORD64 const *num1, BNWORD64 const *num2, unsigned len);
36#endif
37
38#ifndef lbnMulN1_64
39void lbnMulN1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k);
40#endif
41#ifndef lbnMulAdd1_64
42BNWORD64
43lbnMulAdd1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k);
44#endif
45#ifndef lbnMulSub1_64
46BNWORD64 lbnMulSub1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k);
47#endif
48
49#ifndef lbnLshift_64
50BNWORD64 lbnLshift_64(BNWORD64 *num, unsigned len, unsigned shift);
51#endif
52#ifndef lbnDouble_64
53BNWORD64 lbnDouble_64(BNWORD64 *num, unsigned len);
54#endif
55#ifndef lbnRshift_64
56BNWORD64 lbnRshift_64(BNWORD64 *num, unsigned len, unsigned shift);
57#endif
58
59#ifndef lbnMul_64
60void lbnMul_64(BNWORD64 *prod, BNWORD64 const *num1, unsigned len1,
61 BNWORD64 const *num2, unsigned len2);
62#endif
63#ifndef lbnSquare_64
64void lbnSquare_64(BNWORD64 *prod, BNWORD64 const *num, unsigned len);
65#endif
66
67#ifndef lbnNorm_64
68unsigned lbnNorm_64(BNWORD64 const *num, unsigned len);
69#endif
70#ifndef lbnBits_64
71unsigned lbnBits_64(BNWORD64 const *num, unsigned len);
72#endif
73
74#ifndef lbnExtractBigBytes_64
75void lbnExtractBigBytes_64(BNWORD64 const *bn, unsigned char *buf,
76 unsigned lsbyte, unsigned buflen);
77#endif
78#ifndef lbnInsertBigytes_64
79void lbnInsertBigBytes_64(BNWORD64 *n, unsigned char const *buf,
80 unsigned lsbyte, unsigned buflen);
81#endif
82#ifndef lbnExtractLittleBytes_64
83void lbnExtractLittleBytes_64(BNWORD64 const *bn, unsigned char *buf,
84 unsigned lsbyte, unsigned buflen);
85#endif
86#ifndef lbnInsertLittleBytes_64
87void lbnInsertLittleBytes_64(BNWORD64 *n, unsigned char const *buf,
88 unsigned lsbyte, unsigned buflen);
89#endif
90
91#ifndef lbnDiv21_64
92BNWORD64 lbnDiv21_64(BNWORD64 *q, BNWORD64 nh, BNWORD64 nl, BNWORD64 d);
93#endif
94#ifndef lbnDiv1_64
95BNWORD64 lbnDiv1_64(BNWORD64 *q, BNWORD64 *rem,
96 BNWORD64 const *n, unsigned len, BNWORD64 d);
97#endif
98#ifndef lbnModQ_64
99unsigned lbnModQ_64(BNWORD64 const *n, unsigned len, unsigned d);
100#endif
101#ifndef lbnDiv_64
102BNWORD64
103lbnDiv_64(BNWORD64 *q, BNWORD64 *n, unsigned nlen, BNWORD64 *d, unsigned dlen);
104#endif
105
106#ifndef lbnMontInv1_64
107BNWORD64 lbnMontInv1_64(BNWORD64 const x);
108#endif
109#ifndef lbnMontReduce_64
110void lbnMontReduce_64(BNWORD64 *n, BNWORD64 const *mod, unsigned const mlen,
111 BNWORD64 inv);
112#endif
113#ifndef lbnToMont_64
114void lbnToMont_64(BNWORD64 *n, unsigned nlen, BNWORD64 *mod, unsigned mlen);
115#endif
116#ifndef lbnFromMont_64
117void lbnFromMont_64(BNWORD64 *n, BNWORD64 *mod, unsigned len);
118#endif
119
120#ifndef lbnExpMod_64
121int lbnExpMod_64(BNWORD64 *result, BNWORD64 const *n, unsigned nlen,
122 BNWORD64 const *exp, unsigned elen, BNWORD64 *mod, unsigned mlen);
123#endif
124#ifndef lbnDoubleExpMod_64
125int lbnDoubleExpMod_64(BNWORD64 *result,
126 BNWORD64 const *n1, unsigned n1len, BNWORD64 const *e1, unsigned e1len,
127 BNWORD64 const *n2, unsigned n2len, BNWORD64 const *e2, unsigned e2len,
128 BNWORD64 *mod, unsigned mlen);
129#endif
130#ifndef lbnTwoExpMod_64
131int lbnTwoExpMod_64(BNWORD64 *n, BNWORD64 const *exp, unsigned elen,
132 BNWORD64 *mod, unsigned mlen);
133#endif
134#ifndef lbnGcd_64
135int lbnGcd_64(BNWORD64 *a, unsigned alen, BNWORD64 *b, unsigned blen,
136 unsigned *rlen);
137#endif
138#ifndef lbnInv_64
139int lbnInv_64(BNWORD64 *a, unsigned alen, BNWORD64 const *mod, unsigned mlen);
140#endif
141
142int lbnBasePrecompBegin_64(BNWORD64 **array, unsigned n, unsigned bits,
143 BNWORD64 const *g, unsigned glen, BNWORD64 *mod, unsigned mlen);
144int lbnBasePrecompExp_64(BNWORD64 *result, BNWORD64 const * const *array,
145 unsigned bits, BNWORD64 const *exp, unsigned elen,
146 BNWORD64 const *mod, unsigned mlen);
147int lbnDoubleBasePrecompExp_64(BNWORD64 *result, unsigned bits,
148 BNWORD64 const * const *array1, BNWORD64 const *exp1, unsigned elen1,
149 BNWORD64 const * const *array2, BNWORD64 const *exp2,
150 unsigned elen2, BNWORD64 const *mod, unsigned mlen);
151
152#endif /* LBN64_H */