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