fe.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef FE_H
  2. #define FE_H
  3. #include "crypto_int32.h"
  4. #include <stddef.h>
  5. typedef crypto_int32 fe[10];
  6. /*
  7. fe means field element.
  8. Here the field is \Z/(2^255-19).
  9. An element t, entries t[0]...t[9], represents the integer
  10. t[0]+2^26 t[1]+2^51 t[2]+2^77 t[3]+2^102 t[4]+...+2^230 t[9].
  11. Bounds on each t[i] vary depending on context.
  12. */
  13. #define fe_frombytes CRYPTO_NAMESPACE(fe_frombytes)
  14. #define fe_tobytes CRYPTO_NAMESPACE(fe_tobytes)
  15. #define fe_copy CRYPTO_NAMESPACE(fe_copy)
  16. #define fe_isnonzero CRYPTO_NAMESPACE(fe_isnonzero)
  17. #define fe_isnegative CRYPTO_NAMESPACE(fe_isnegative)
  18. #define fe_0 CRYPTO_NAMESPACE(fe_0)
  19. #define fe_1 CRYPTO_NAMESPACE(fe_1)
  20. #define fe_cswap CRYPTO_NAMESPACE(fe_cswap)
  21. #define fe_cmov CRYPTO_NAMESPACE(fe_cmov)
  22. #define fe_add CRYPTO_NAMESPACE(fe_add)
  23. #define fe_sub CRYPTO_NAMESPACE(fe_sub)
  24. #define fe_neg CRYPTO_NAMESPACE(fe_neg)
  25. #define fe_mul CRYPTO_NAMESPACE(fe_mul)
  26. #define fe_sq CRYPTO_NAMESPACE(fe_sq)
  27. #define fe_sq2 CRYPTO_NAMESPACE(fe_sq2)
  28. #define fe_invert CRYPTO_NAMESPACE(fe_invert)
  29. #define fe_batchinvert CRYPTO_NAMESPACE(fe_batchinvert)
  30. #define fe_pow22523 CRYPTO_NAMESPACE(fe_pow22523)
  31. extern void fe_frombytes(fe,const unsigned char *);
  32. extern void fe_tobytes(unsigned char *,const fe);
  33. extern void fe_copy(fe,const fe);
  34. extern int fe_isnonzero(const fe);
  35. extern int fe_isnegative(const fe);
  36. extern void fe_0(fe);
  37. extern void fe_1(fe);
  38. extern void fe_cswap(fe,fe,unsigned int);
  39. extern void fe_cmov(fe,const fe,unsigned int);
  40. extern void fe_add(fe,const fe,const fe);
  41. extern void fe_sub(fe,const fe,const fe);
  42. extern void fe_neg(fe,const fe);
  43. extern void fe_mul(fe,const fe,const fe);
  44. extern void fe_sq(fe,const fe);
  45. extern void fe_sq2(fe,const fe);
  46. extern void fe_invert(fe,const fe);
  47. extern void fe_batchinvert(fe *out,fe *in,fe *tmp,size_t num,size_t shift);
  48. extern void fe_pow22523(fe,const fe);
  49. #endif