blob: f2237ceb69d04e7fbdefd6026fdb9ab470b01460 [file] [log] [blame]
Alexandre Lision7fd5d3d2013-12-04 13:06:40 -05001#ifndef LBN16_H
2#define LBN16_H
3
4#include "lbn.h"
5
6#ifndef BNWORD16
7#error 16-bit bignum library requires a 16-bit data type
8#endif
9
10#ifndef lbnCopy_16
11void lbnCopy_16(BNWORD16 *dest, BNWORD16 const *src, unsigned len);
12#endif
13#ifndef lbnZero_16
14void lbnZero_16(BNWORD16 *num, unsigned len);
15#endif
16#ifndef lbnNeg_16
17void lbnNeg_16(BNWORD16 *num, unsigned len);
18#endif
19
20#ifndef lbnAdd1_16
21BNWORD16 lbnAdd1_16(BNWORD16 *num, unsigned len, BNWORD16 carry);
22#endif
23#ifndef lbnSub1_16
24BNWORD16 lbnSub1_16(BNWORD16 *num, unsigned len, BNWORD16 borrow);
25#endif
26
27#ifndef lbnAddN_16
28BNWORD16 lbnAddN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len);
29#endif
30#ifndef lbnSubN_16
31BNWORD16 lbnSubN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len);
32#endif
33
34#ifndef lbnCmp_16
35int lbnCmp_16(BNWORD16 const *num1, BNWORD16 const *num2, unsigned len);
36#endif
37
38#ifndef lbnMulN1_16
39void lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k);
40#endif
41#ifndef lbnMulAdd1_16
42BNWORD16
43lbnMulAdd1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k);
44#endif
45#ifndef lbnMulSub1_16
46BNWORD16 lbnMulSub1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k);
47#endif
48
49#ifndef lbnLshift_16
50BNWORD16 lbnLshift_16(BNWORD16 *num, unsigned len, unsigned shift);
51#endif
52#ifndef lbnDouble_16
53BNWORD16 lbnDouble_16(BNWORD16 *num, unsigned len);
54#endif
55#ifndef lbnRshift_16
56BNWORD16 lbnRshift_16(BNWORD16 *num, unsigned len, unsigned shift);
57#endif
58
59#ifndef lbnMul_16
60void lbnMul_16(BNWORD16 *prod, BNWORD16 const *num1, unsigned len1,
61 BNWORD16 const *num2, unsigned len2);
62#endif
63#ifndef lbnSquare_16
64void lbnSquare_16(BNWORD16 *prod, BNWORD16 const *num, unsigned len);
65#endif
66
67#ifndef lbnNorm_16
68unsigned lbnNorm_16(BNWORD16 const *num, unsigned len);
69#endif
70#ifndef lbnBits_16
71unsigned lbnBits_16(BNWORD16 const *num, unsigned len);
72#endif
73
74#ifndef lbnExtractBigBytes_16
75void lbnExtractBigBytes_16(BNWORD16 const *bn, unsigned char *buf,
76 unsigned lsbyte, unsigned buflen);
77#endif
78#ifndef lbnInsertBigytes_16
79void lbnInsertBigBytes_16(BNWORD16 *n, unsigned char const *buf,
80 unsigned lsbyte, unsigned buflen);
81#endif
82#ifndef lbnExtractLittleBytes_16
83void lbnExtractLittleBytes_16(BNWORD16 const *bn, unsigned char *buf,
84 unsigned lsbyte, unsigned buflen);
85#endif
86#ifndef lbnInsertLittleBytes_16
87void lbnInsertLittleBytes_16(BNWORD16 *n, unsigned char const *buf,
88 unsigned lsbyte, unsigned buflen);
89#endif
90
91#ifndef lbnDiv21_16
92BNWORD16 lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d);
93#endif
94#ifndef lbnDiv1_16
95BNWORD16 lbnDiv1_16(BNWORD16 *q, BNWORD16 *rem,
96 BNWORD16 const *n, unsigned len, BNWORD16 d);
97#endif
98#ifndef lbnModQ_16
99unsigned lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d);
100#endif
101#ifndef lbnDiv_16
102BNWORD16
103lbnDiv_16(BNWORD16 *q, BNWORD16 *n, unsigned nlen, BNWORD16 *d, unsigned dlen);
104#endif
105
106#ifndef lbnMontInv1_16
107BNWORD16 lbnMontInv1_16(BNWORD16 const x);
108#endif
109#ifndef lbnMontReduce_16
110void lbnMontReduce_16(BNWORD16 *n, BNWORD16 const *mod, unsigned const mlen,
111 BNWORD16 inv);
112#endif
113#ifndef lbnToMont_16
114void lbnToMont_16(BNWORD16 *n, unsigned nlen, BNWORD16 *mod, unsigned mlen);
115#endif
116#ifndef lbnFromMont_16
117void lbnFromMont_16(BNWORD16 *n, BNWORD16 *mod, unsigned len);
118#endif
119
120#ifndef lbnExpMod_16
121int lbnExpMod_16(BNWORD16 *result, BNWORD16 const *n, unsigned nlen,
122 BNWORD16 const *exp, unsigned elen, BNWORD16 *mod, unsigned mlen);
123#endif
124#ifndef lbnDoubleExpMod_16
125int lbnDoubleExpMod_16(BNWORD16 *result,
126 BNWORD16 const *n1, unsigned n1len, BNWORD16 const *e1, unsigned e1len,
127 BNWORD16 const *n2, unsigned n2len, BNWORD16 const *e2, unsigned e2len,
128 BNWORD16 *mod, unsigned mlen);
129#endif
130#ifndef lbnTwoExpMod_16
131int lbnTwoExpMod_16(BNWORD16 *n, BNWORD16 const *exp, unsigned elen,
132 BNWORD16 *mod, unsigned mlen);
133#endif
134#ifndef lbnGcd_16
135int lbnGcd_16(BNWORD16 *a, unsigned alen, BNWORD16 *b, unsigned blen,
136 unsigned *rlen);
137#endif
138#ifndef lbnInv_16
139int lbnInv_16(BNWORD16 *a, unsigned alen, BNWORD16 const *mod, unsigned mlen);
140#endif
141
142int lbnBasePrecompBegin_16(BNWORD16 **array, unsigned n, unsigned bits,
143 BNWORD16 const *g, unsigned glen, BNWORD16 *mod, unsigned mlen);
144int lbnBasePrecompExp_16(BNWORD16 *result, BNWORD16 const * const *array,
145 unsigned bits, BNWORD16 const *exp, unsigned elen,
146 BNWORD16 const *mod, unsigned mlen);
147int lbnDoubleBasePrecompExp_16(BNWORD16 *result, unsigned bits,
148 BNWORD16 const * const *array1, BNWORD16 const *exp1, unsigned elen1,
149 BNWORD16 const * const *array2, BNWORD16 const *exp2,
150 unsigned elen2, BNWORD16 const *mod, unsigned mlen);
151
152#endif /* LBN16_H */