| 1 | #ifndef FE_H |
| 2 | #define FE_H |
| 3 | |
| 4 | #include "fixedint.h" |
| 5 | |
| 6 | |
| 7 | /* |
| 8 | fe means field element. |
| 9 | Here the field is \Z/(2^255-19). |
| 10 | An element t, entries t[0]...t[9], represents the integer |
| 11 | t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. |
| 12 | Bounds on each t[i] vary depending on context. |
| 13 | */ |
| 14 | |
| 15 | |
| 16 | typedef int32_t fe[10]; |
| 17 | |
| 18 | |
| 19 | void fe_0(fe h); |
| 20 | void fe_1(fe h); |
| 21 | |
| 22 | void fe_frombytes(fe h, const unsigned char *s); |
| 23 | void fe_tobytes(unsigned char *s, const fe h); |
| 24 | |
| 25 | void fe_copy(fe h, const fe f); |
| 26 | int fe_isnegative(const fe f); |
| 27 | int fe_isnonzero(const fe f); |
| 28 | void fe_cmov(fe f, const fe g, unsigned int b); |
| 29 | void fe_cswap(fe f, fe g, unsigned int b); |
| 30 | |
| 31 | void fe_neg(fe h, const fe f); |
| 32 | void fe_add(fe h, const fe f, const fe g); |
| 33 | void fe_invert(fe out, const fe z); |
| 34 | void fe_sq(fe h, const fe f); |
| 35 | void fe_sq2(fe h, const fe f); |
| 36 | void fe_mul(fe h, const fe f, const fe g); |
| 37 | void fe_mul121666(fe h, fe f); |
| 38 | void fe_pow22523(fe out, const fe z); |
| 39 | void fe_sub(fe h, const fe f, const fe g); |
| 40 | |
| 41 | #endif |
| 42 | |