| 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_scalarmult_curve25519_ref10_fe_frombytes |
| 19 | #define fe_tobytes crypto_scalarmult_curve25519_ref10_fe_tobytes |
| 20 | #define fe_copy crypto_scalarmult_curve25519_ref10_fe_copy |
| 21 | #define fe_0 crypto_scalarmult_curve25519_ref10_fe_0 |
| 22 | #define fe_1 crypto_scalarmult_curve25519_ref10_fe_1 |
| 23 | #define fe_cswap crypto_scalarmult_curve25519_ref10_fe_cswap |
| 24 | #define fe_add crypto_scalarmult_curve25519_ref10_fe_add |
| 25 | #define fe_sub crypto_scalarmult_curve25519_ref10_fe_sub |
| 26 | #define fe_mul crypto_scalarmult_curve25519_ref10_fe_mul |
| 27 | #define fe_sq crypto_scalarmult_curve25519_ref10_fe_sq |
| 28 | #define fe_mul121666 crypto_scalarmult_curve25519_ref10_fe_mul121666 |
| 29 | #define fe_invert crypto_scalarmult_curve25519_ref10_fe_invert |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | extern void INTERFACE fe_frombytes(fe,const unsigned char *); |
| 35 | extern void INTERFACE fe_tobytes(unsigned char *,fe); |
| 36 | |
| 37 | extern void INTERFACE fe_copy(fe,fe); |
| 38 | extern void INTERFACE fe_0(fe); |
| 39 | extern void INTERFACE fe_1(fe); |
| 40 | extern void INTERFACE fe_cswap(fe,fe,unsigned int); |
| 41 | |
| 42 | extern void INTERFACE fe_add(fe,fe,fe); |
| 43 | extern void INTERFACE fe_sub(fe,fe,fe); |
| 44 | extern void INTERFACE fe_mul(fe,fe,fe); |
| 45 | extern void INTERFACE fe_sq(fe,fe); |
| 46 | extern void INTERFACE fe_mul121666(fe,fe); |
| 47 | extern void INTERFACE fe_invert(fe,fe); |
| 48 | #ifdef __cplusplus |
| 49 | } |
| 50 | #endif |
| 51 | |
| 52 | #endif |