fe.h 1.9 KB

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