| 1 | #ifndef FE_H |
| 2 | #define FE_H |
| 3 | |
| 4 | #include "crypto_int32.h" |
| 5 | |
| 6 | typedef crypto_int32 fe[10]; |
| 7 | |
| 8 | /* |
| 9 | fe means field element. |
| 10 | Here the field is \Z/(2^255-19). |
| 11 | An element t, entries t[0]...t[9], represents the integer |
| 12 | t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9]. |
| 13 | Bounds on each t[i] vary depending on context. |
| 14 | */ |
| 15 | |
| 16 | #define fe_frombytes crypto_sign_ed25519_ref10_fe_frombytes |
| 17 | #define fe_tobytes crypto_sign_ed25519_ref10_fe_tobytes |
| 18 | #define fe_copy crypto_sign_ed25519_ref10_fe_copy |
| 19 | #define fe_isnonzero crypto_sign_ed25519_ref10_fe_isnonzero |
| 20 | #define fe_isnegative crypto_sign_ed25519_ref10_fe_isnegative |
| 21 | #define fe_0 crypto_sign_ed25519_ref10_fe_0 |
| 22 | #define fe_1 crypto_sign_ed25519_ref10_fe_1 |
| 23 | #define fe_cswap crypto_sign_ed25519_ref10_fe_cswap |
| 24 | #define fe_cmov crypto_sign_ed25519_ref10_fe_cmov |
| 25 | #define fe_add crypto_sign_ed25519_ref10_fe_add |
| 26 | #define fe_sub crypto_sign_ed25519_ref10_fe_sub |
| 27 | #define fe_neg crypto_sign_ed25519_ref10_fe_neg |
| 28 | #define fe_mul crypto_sign_ed25519_ref10_fe_mul |
| 29 | #define fe_sq crypto_sign_ed25519_ref10_fe_sq |
| 30 | #define fe_sq2 crypto_sign_ed25519_ref10_fe_sq2 |
| 31 | #define fe_mul121666 crypto_sign_ed25519_ref10_fe_mul121666 |
| 32 | #define fe_invert crypto_sign_ed25519_ref10_fe_invert |
| 33 | #define fe_pow22523 crypto_sign_ed25519_ref10_fe_pow22523 |
| 34 | |
| 35 | extern void fe_frombytes(fe,const unsigned char *); |
| 36 | extern void fe_tobytes(unsigned char *,const fe); |
| 37 | |
| 38 | extern void fe_copy(fe,const fe); |
| 39 | extern int fe_isnonzero(const fe); |
| 40 | extern int fe_isnegative(const fe); |
| 41 | extern void fe_0(fe); |
| 42 | extern void fe_1(fe); |
| 43 | extern void fe_cswap(fe,fe,unsigned int); |
| 44 | extern void fe_cmov(fe,const fe,unsigned int); |
| 45 | |
| 46 | extern void fe_add(fe,const fe,const fe); |
| 47 | extern void fe_sub(fe,const fe,const fe); |
| 48 | extern void fe_neg(fe,const fe); |
| 49 | extern void fe_mul(fe,const fe,const fe); |
| 50 | extern void fe_sq(fe,const fe); |
| 51 | extern void fe_sq2(fe,const fe); |
| 52 | extern void fe_mul121666(fe,const fe); |
| 53 | extern void fe_invert(fe,const fe); |
| 54 | extern void fe_pow22523(fe,const fe); |
| 55 | |
| 56 | #endif |
| 57 | |