Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 1 | #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 |
| 11 | void lbnCopy_16(BNWORD16 *dest, BNWORD16 const *src, unsigned len); |
| 12 | #endif |
| 13 | #ifndef lbnZero_16 |
| 14 | void lbnZero_16(BNWORD16 *num, unsigned len); |
| 15 | #endif |
| 16 | #ifndef lbnNeg_16 |
| 17 | void lbnNeg_16(BNWORD16 *num, unsigned len); |
| 18 | #endif |
| 19 | |
| 20 | #ifndef lbnAdd1_16 |
| 21 | BNWORD16 lbnAdd1_16(BNWORD16 *num, unsigned len, BNWORD16 carry); |
| 22 | #endif |
| 23 | #ifndef lbnSub1_16 |
| 24 | BNWORD16 lbnSub1_16(BNWORD16 *num, unsigned len, BNWORD16 borrow); |
| 25 | #endif |
| 26 | |
| 27 | #ifndef lbnAddN_16 |
| 28 | BNWORD16 lbnAddN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len); |
| 29 | #endif |
| 30 | #ifndef lbnSubN_16 |
| 31 | BNWORD16 lbnSubN_16(BNWORD16 *num1, BNWORD16 const *num2, unsigned len); |
| 32 | #endif |
| 33 | |
| 34 | #ifndef lbnCmp_16 |
| 35 | int lbnCmp_16(BNWORD16 const *num1, BNWORD16 const *num2, unsigned len); |
| 36 | #endif |
| 37 | |
| 38 | #ifndef lbnMulN1_16 |
| 39 | void lbnMulN1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k); |
| 40 | #endif |
| 41 | #ifndef lbnMulAdd1_16 |
| 42 | BNWORD16 |
| 43 | lbnMulAdd1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k); |
| 44 | #endif |
| 45 | #ifndef lbnMulSub1_16 |
| 46 | BNWORD16 lbnMulSub1_16(BNWORD16 *out, BNWORD16 const *in, unsigned len, BNWORD16 k); |
| 47 | #endif |
| 48 | |
| 49 | #ifndef lbnLshift_16 |
| 50 | BNWORD16 lbnLshift_16(BNWORD16 *num, unsigned len, unsigned shift); |
| 51 | #endif |
| 52 | #ifndef lbnDouble_16 |
| 53 | BNWORD16 lbnDouble_16(BNWORD16 *num, unsigned len); |
| 54 | #endif |
| 55 | #ifndef lbnRshift_16 |
| 56 | BNWORD16 lbnRshift_16(BNWORD16 *num, unsigned len, unsigned shift); |
| 57 | #endif |
| 58 | |
| 59 | #ifndef lbnMul_16 |
| 60 | void lbnMul_16(BNWORD16 *prod, BNWORD16 const *num1, unsigned len1, |
| 61 | BNWORD16 const *num2, unsigned len2); |
| 62 | #endif |
| 63 | #ifndef lbnSquare_16 |
| 64 | void lbnSquare_16(BNWORD16 *prod, BNWORD16 const *num, unsigned len); |
| 65 | #endif |
| 66 | |
| 67 | #ifndef lbnNorm_16 |
| 68 | unsigned lbnNorm_16(BNWORD16 const *num, unsigned len); |
| 69 | #endif |
| 70 | #ifndef lbnBits_16 |
| 71 | unsigned lbnBits_16(BNWORD16 const *num, unsigned len); |
| 72 | #endif |
| 73 | |
| 74 | #ifndef lbnExtractBigBytes_16 |
| 75 | void lbnExtractBigBytes_16(BNWORD16 const *bn, unsigned char *buf, |
| 76 | unsigned lsbyte, unsigned buflen); |
| 77 | #endif |
| 78 | #ifndef lbnInsertBigytes_16 |
| 79 | void lbnInsertBigBytes_16(BNWORD16 *n, unsigned char const *buf, |
| 80 | unsigned lsbyte, unsigned buflen); |
| 81 | #endif |
| 82 | #ifndef lbnExtractLittleBytes_16 |
| 83 | void lbnExtractLittleBytes_16(BNWORD16 const *bn, unsigned char *buf, |
| 84 | unsigned lsbyte, unsigned buflen); |
| 85 | #endif |
| 86 | #ifndef lbnInsertLittleBytes_16 |
| 87 | void lbnInsertLittleBytes_16(BNWORD16 *n, unsigned char const *buf, |
| 88 | unsigned lsbyte, unsigned buflen); |
| 89 | #endif |
| 90 | |
| 91 | #ifndef lbnDiv21_16 |
| 92 | BNWORD16 lbnDiv21_16(BNWORD16 *q, BNWORD16 nh, BNWORD16 nl, BNWORD16 d); |
| 93 | #endif |
| 94 | #ifndef lbnDiv1_16 |
| 95 | BNWORD16 lbnDiv1_16(BNWORD16 *q, BNWORD16 *rem, |
| 96 | BNWORD16 const *n, unsigned len, BNWORD16 d); |
| 97 | #endif |
| 98 | #ifndef lbnModQ_16 |
| 99 | unsigned lbnModQ_16(BNWORD16 const *n, unsigned len, unsigned d); |
| 100 | #endif |
| 101 | #ifndef lbnDiv_16 |
| 102 | BNWORD16 |
| 103 | lbnDiv_16(BNWORD16 *q, BNWORD16 *n, unsigned nlen, BNWORD16 *d, unsigned dlen); |
| 104 | #endif |
| 105 | |
| 106 | #ifndef lbnMontInv1_16 |
| 107 | BNWORD16 lbnMontInv1_16(BNWORD16 const x); |
| 108 | #endif |
| 109 | #ifndef lbnMontReduce_16 |
| 110 | void lbnMontReduce_16(BNWORD16 *n, BNWORD16 const *mod, unsigned const mlen, |
| 111 | BNWORD16 inv); |
| 112 | #endif |
| 113 | #ifndef lbnToMont_16 |
| 114 | void lbnToMont_16(BNWORD16 *n, unsigned nlen, BNWORD16 *mod, unsigned mlen); |
| 115 | #endif |
| 116 | #ifndef lbnFromMont_16 |
| 117 | void lbnFromMont_16(BNWORD16 *n, BNWORD16 *mod, unsigned len); |
| 118 | #endif |
| 119 | |
| 120 | #ifndef lbnExpMod_16 |
| 121 | int 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 |
| 125 | int 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 |
| 131 | int lbnTwoExpMod_16(BNWORD16 *n, BNWORD16 const *exp, unsigned elen, |
| 132 | BNWORD16 *mod, unsigned mlen); |
| 133 | #endif |
| 134 | #ifndef lbnGcd_16 |
| 135 | int lbnGcd_16(BNWORD16 *a, unsigned alen, BNWORD16 *b, unsigned blen, |
| 136 | unsigned *rlen); |
| 137 | #endif |
| 138 | #ifndef lbnInv_16 |
| 139 | int lbnInv_16(BNWORD16 *a, unsigned alen, BNWORD16 const *mod, unsigned mlen); |
| 140 | #endif |
| 141 | |
| 142 | int lbnBasePrecompBegin_16(BNWORD16 **array, unsigned n, unsigned bits, |
| 143 | BNWORD16 const *g, unsigned glen, BNWORD16 *mod, unsigned mlen); |
| 144 | int lbnBasePrecompExp_16(BNWORD16 *result, BNWORD16 const * const *array, |
| 145 | unsigned bits, BNWORD16 const *exp, unsigned elen, |
| 146 | BNWORD16 const *mod, unsigned mlen); |
| 147 | int 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 */ |