Alexandre Lision | 7fd5d3d | 2013-12-04 13:06:40 -0500 | [diff] [blame] | 1 | #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 |
| 11 | void lbnCopy_32(BNWORD32 *dest, BNWORD32 const *src, unsigned len); |
| 12 | #endif |
| 13 | #ifndef lbnZero_32 |
| 14 | void lbnZero_32(BNWORD32 *num, unsigned len); |
| 15 | #endif |
| 16 | #ifndef lbnNeg_32 |
| 17 | void lbnNeg_32(BNWORD32 *num, unsigned len); |
| 18 | #endif |
| 19 | |
| 20 | #ifndef lbnAdd1_32 |
| 21 | BNWORD32 lbnAdd1_32(BNWORD32 *num, unsigned len, BNWORD32 carry); |
| 22 | #endif |
| 23 | #ifndef lbnSub1_32 |
| 24 | BNWORD32 lbnSub1_32(BNWORD32 *num, unsigned len, BNWORD32 borrow); |
| 25 | #endif |
| 26 | |
| 27 | #ifndef lbnAddN_32 |
| 28 | BNWORD32 lbnAddN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len); |
| 29 | #endif |
| 30 | #ifndef lbnSubN_32 |
| 31 | BNWORD32 lbnSubN_32(BNWORD32 *num1, BNWORD32 const *num2, unsigned len); |
| 32 | #endif |
| 33 | |
| 34 | #ifndef lbnCmp_32 |
| 35 | int lbnCmp_32(BNWORD32 const *num1, BNWORD32 const *num2, unsigned len); |
| 36 | #endif |
| 37 | |
| 38 | #ifndef lbnMulN1_32 |
| 39 | void lbnMulN1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k); |
| 40 | #endif |
| 41 | #ifndef lbnMulAdd1_32 |
| 42 | BNWORD32 |
| 43 | lbnMulAdd1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k); |
| 44 | #endif |
| 45 | #ifndef lbnMulSub1_32 |
| 46 | BNWORD32 lbnMulSub1_32(BNWORD32 *out, BNWORD32 const *in, unsigned len, BNWORD32 k); |
| 47 | #endif |
| 48 | |
| 49 | #ifndef lbnLshift_32 |
| 50 | BNWORD32 lbnLshift_32(BNWORD32 *num, unsigned len, unsigned shift); |
| 51 | #endif |
| 52 | #ifndef lbnDouble_32 |
| 53 | BNWORD32 lbnDouble_32(BNWORD32 *num, unsigned len); |
| 54 | #endif |
| 55 | #ifndef lbnRshift_32 |
| 56 | BNWORD32 lbnRshift_32(BNWORD32 *num, unsigned len, unsigned shift); |
| 57 | #endif |
| 58 | |
| 59 | #ifndef lbnMul_32 |
| 60 | void lbnMul_32(BNWORD32 *prod, BNWORD32 const *num1, unsigned len1, |
| 61 | BNWORD32 const *num2, unsigned len2); |
| 62 | #endif |
| 63 | #ifndef lbnSquare_32 |
| 64 | void lbnSquare_32(BNWORD32 *prod, BNWORD32 const *num, unsigned len); |
| 65 | #endif |
| 66 | |
| 67 | #ifndef lbnNorm_32 |
| 68 | unsigned lbnNorm_32(BNWORD32 const *num, unsigned len); |
| 69 | #endif |
| 70 | #ifndef lbnBits_32 |
| 71 | unsigned lbnBits_32(BNWORD32 const *num, unsigned len); |
| 72 | #endif |
| 73 | |
| 74 | #ifndef lbnExtractBigBytes_32 |
| 75 | void lbnExtractBigBytes_32(BNWORD32 const *bn, unsigned char *buf, |
| 76 | unsigned lsbyte, unsigned buflen); |
| 77 | #endif |
| 78 | #ifndef lbnInsertBigytes_32 |
| 79 | void lbnInsertBigBytes_32(BNWORD32 *n, unsigned char const *buf, |
| 80 | unsigned lsbyte, unsigned buflen); |
| 81 | #endif |
| 82 | #ifndef lbnExtractLittleBytes_32 |
| 83 | void lbnExtractLittleBytes_32(BNWORD32 const *bn, unsigned char *buf, |
| 84 | unsigned lsbyte, unsigned buflen); |
| 85 | #endif |
| 86 | #ifndef lbnInsertLittleBytes_32 |
| 87 | void lbnInsertLittleBytes_32(BNWORD32 *n, unsigned char const *buf, |
| 88 | unsigned lsbyte, unsigned buflen); |
| 89 | #endif |
| 90 | |
| 91 | #ifndef lbnDiv21_32 |
| 92 | BNWORD32 lbnDiv21_32(BNWORD32 *q, BNWORD32 nh, BNWORD32 nl, BNWORD32 d); |
| 93 | #endif |
| 94 | #ifndef lbnDiv1_32 |
| 95 | BNWORD32 lbnDiv1_32(BNWORD32 *q, BNWORD32 *rem, |
| 96 | BNWORD32 const *n, unsigned len, BNWORD32 d); |
| 97 | #endif |
| 98 | #ifndef lbnModQ_32 |
| 99 | unsigned lbnModQ_32(BNWORD32 const *n, unsigned len, unsigned d); |
| 100 | #endif |
| 101 | #ifndef lbnDiv_32 |
| 102 | BNWORD32 |
| 103 | lbnDiv_32(BNWORD32 *q, BNWORD32 *n, unsigned nlen, BNWORD32 *d, unsigned dlen); |
| 104 | #endif |
| 105 | |
| 106 | #ifndef lbnMontInv1_32 |
| 107 | BNWORD32 lbnMontInv1_32(BNWORD32 const x); |
| 108 | #endif |
| 109 | #ifndef lbnMontReduce_32 |
| 110 | void lbnMontReduce_32(BNWORD32 *n, BNWORD32 const *mod, unsigned const mlen, |
| 111 | BNWORD32 inv); |
| 112 | #endif |
| 113 | #ifndef lbnToMont_32 |
| 114 | void lbnToMont_32(BNWORD32 *n, unsigned nlen, BNWORD32 *mod, unsigned mlen); |
| 115 | #endif |
| 116 | #ifndef lbnFromMont_32 |
| 117 | void lbnFromMont_32(BNWORD32 *n, BNWORD32 *mod, unsigned len); |
| 118 | #endif |
| 119 | |
| 120 | #ifndef lbnExpMod_32 |
| 121 | int 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 |
| 125 | int 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 |
| 131 | int lbnTwoExpMod_32(BNWORD32 *n, BNWORD32 const *exp, unsigned elen, |
| 132 | BNWORD32 *mod, unsigned mlen); |
| 133 | #endif |
| 134 | #ifndef lbnGcd_32 |
| 135 | int lbnGcd_32(BNWORD32 *a, unsigned alen, BNWORD32 *b, unsigned blen, |
| 136 | unsigned *rlen); |
| 137 | #endif |
| 138 | #ifndef lbnInv_32 |
| 139 | int lbnInv_32(BNWORD32 *a, unsigned alen, BNWORD32 const *mod, unsigned mlen); |
| 140 | #endif |
| 141 | |
| 142 | int lbnBasePrecompBegin_32(BNWORD32 **array, unsigned n, unsigned bits, |
| 143 | BNWORD32 const *g, unsigned glen, BNWORD32 *mod, unsigned mlen); |
| 144 | int lbnBasePrecompExp_32(BNWORD32 *result, BNWORD32 const * const *array, |
| 145 | unsigned bits, BNWORD32 const *exp, unsigned elen, |
| 146 | BNWORD32 const *mod, unsigned mlen); |
| 147 | int 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 */ |