Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 1 | #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 |
| 11 | void lbnCopy_64(BNWORD64 *dest, BNWORD64 const *src, unsigned len); |
| 12 | #endif |
| 13 | #ifndef lbnZero_64 |
| 14 | void lbnZero_64(BNWORD64 *num, unsigned len); |
| 15 | #endif |
| 16 | #ifndef lbnNeg_64 |
| 17 | void lbnNeg_64(BNWORD64 *num, unsigned len); |
| 18 | #endif |
| 19 | |
| 20 | #ifndef lbnAdd1_64 |
| 21 | BNWORD64 lbnAdd1_64(BNWORD64 *num, unsigned len, BNWORD64 carry); |
| 22 | #endif |
| 23 | #ifndef lbnSub1_64 |
| 24 | BNWORD64 lbnSub1_64(BNWORD64 *num, unsigned len, BNWORD64 borrow); |
| 25 | #endif |
| 26 | |
| 27 | #ifndef lbnAddN_64 |
| 28 | BNWORD64 lbnAddN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len); |
| 29 | #endif |
| 30 | #ifndef lbnSubN_64 |
| 31 | BNWORD64 lbnSubN_64(BNWORD64 *num1, BNWORD64 const *num2, unsigned len); |
| 32 | #endif |
| 33 | |
| 34 | #ifndef lbnCmp_64 |
| 35 | int lbnCmp_64(BNWORD64 const *num1, BNWORD64 const *num2, unsigned len); |
| 36 | #endif |
| 37 | |
| 38 | #ifndef lbnMulN1_64 |
| 39 | void lbnMulN1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k); |
| 40 | #endif |
| 41 | #ifndef lbnMulAdd1_64 |
| 42 | BNWORD64 |
| 43 | lbnMulAdd1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k); |
| 44 | #endif |
| 45 | #ifndef lbnMulSub1_64 |
| 46 | BNWORD64 lbnMulSub1_64(BNWORD64 *out, BNWORD64 const *in, unsigned len, BNWORD64 k); |
| 47 | #endif |
| 48 | |
| 49 | #ifndef lbnLshift_64 |
| 50 | BNWORD64 lbnLshift_64(BNWORD64 *num, unsigned len, unsigned shift); |
| 51 | #endif |
| 52 | #ifndef lbnDouble_64 |
| 53 | BNWORD64 lbnDouble_64(BNWORD64 *num, unsigned len); |
| 54 | #endif |
| 55 | #ifndef lbnRshift_64 |
| 56 | BNWORD64 lbnRshift_64(BNWORD64 *num, unsigned len, unsigned shift); |
| 57 | #endif |
| 58 | |
| 59 | #ifndef lbnMul_64 |
| 60 | void lbnMul_64(BNWORD64 *prod, BNWORD64 const *num1, unsigned len1, |
| 61 | BNWORD64 const *num2, unsigned len2); |
| 62 | #endif |
| 63 | #ifndef lbnSquare_64 |
| 64 | void lbnSquare_64(BNWORD64 *prod, BNWORD64 const *num, unsigned len); |
| 65 | #endif |
| 66 | |
| 67 | #ifndef lbnNorm_64 |
| 68 | unsigned lbnNorm_64(BNWORD64 const *num, unsigned len); |
| 69 | #endif |
| 70 | #ifndef lbnBits_64 |
| 71 | unsigned lbnBits_64(BNWORD64 const *num, unsigned len); |
| 72 | #endif |
| 73 | |
| 74 | #ifndef lbnExtractBigBytes_64 |
| 75 | void lbnExtractBigBytes_64(BNWORD64 const *bn, unsigned char *buf, |
| 76 | unsigned lsbyte, unsigned buflen); |
| 77 | #endif |
| 78 | #ifndef lbnInsertBigytes_64 |
| 79 | void lbnInsertBigBytes_64(BNWORD64 *n, unsigned char const *buf, |
| 80 | unsigned lsbyte, unsigned buflen); |
| 81 | #endif |
| 82 | #ifndef lbnExtractLittleBytes_64 |
| 83 | void lbnExtractLittleBytes_64(BNWORD64 const *bn, unsigned char *buf, |
| 84 | unsigned lsbyte, unsigned buflen); |
| 85 | #endif |
| 86 | #ifndef lbnInsertLittleBytes_64 |
| 87 | void lbnInsertLittleBytes_64(BNWORD64 *n, unsigned char const *buf, |
| 88 | unsigned lsbyte, unsigned buflen); |
| 89 | #endif |
| 90 | |
| 91 | #ifndef lbnDiv21_64 |
| 92 | BNWORD64 lbnDiv21_64(BNWORD64 *q, BNWORD64 nh, BNWORD64 nl, BNWORD64 d); |
| 93 | #endif |
| 94 | #ifndef lbnDiv1_64 |
| 95 | BNWORD64 lbnDiv1_64(BNWORD64 *q, BNWORD64 *rem, |
| 96 | BNWORD64 const *n, unsigned len, BNWORD64 d); |
| 97 | #endif |
| 98 | #ifndef lbnModQ_64 |
| 99 | unsigned lbnModQ_64(BNWORD64 const *n, unsigned len, unsigned d); |
| 100 | #endif |
| 101 | #ifndef lbnDiv_64 |
| 102 | BNWORD64 |
| 103 | lbnDiv_64(BNWORD64 *q, BNWORD64 *n, unsigned nlen, BNWORD64 *d, unsigned dlen); |
| 104 | #endif |
| 105 | |
| 106 | #ifndef lbnMontInv1_64 |
| 107 | BNWORD64 lbnMontInv1_64(BNWORD64 const x); |
| 108 | #endif |
| 109 | #ifndef lbnMontReduce_64 |
| 110 | void lbnMontReduce_64(BNWORD64 *n, BNWORD64 const *mod, unsigned const mlen, |
| 111 | BNWORD64 inv); |
| 112 | #endif |
| 113 | #ifndef lbnToMont_64 |
| 114 | void lbnToMont_64(BNWORD64 *n, unsigned nlen, BNWORD64 *mod, unsigned mlen); |
| 115 | #endif |
| 116 | #ifndef lbnFromMont_64 |
| 117 | void lbnFromMont_64(BNWORD64 *n, BNWORD64 *mod, unsigned len); |
| 118 | #endif |
| 119 | |
| 120 | #ifndef lbnExpMod_64 |
| 121 | int 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 |
| 125 | int 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 |
| 131 | int lbnTwoExpMod_64(BNWORD64 *n, BNWORD64 const *exp, unsigned elen, |
| 132 | BNWORD64 *mod, unsigned mlen); |
| 133 | #endif |
| 134 | #ifndef lbnGcd_64 |
| 135 | int lbnGcd_64(BNWORD64 *a, unsigned alen, BNWORD64 *b, unsigned blen, |
| 136 | unsigned *rlen); |
| 137 | #endif |
| 138 | #ifndef lbnInv_64 |
| 139 | int lbnInv_64(BNWORD64 *a, unsigned alen, BNWORD64 const *mod, unsigned mlen); |
| 140 | #endif |
| 141 | |
| 142 | int lbnBasePrecompBegin_64(BNWORD64 **array, unsigned n, unsigned bits, |
| 143 | BNWORD64 const *g, unsigned glen, BNWORD64 *mod, unsigned mlen); |
| 144 | int lbnBasePrecompExp_64(BNWORD64 *result, BNWORD64 const * const *array, |
| 145 | unsigned bits, BNWORD64 const *exp, unsigned elen, |
| 146 | BNWORD64 const *mod, unsigned mlen); |
| 147 | int 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 */ |