fe25519.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #ifndef FE25519_H
  2. #define FE25519_H
  3. #include "crypto_int32.h"
  4. #include "crypto_uint32.h"
  5. #define fe25519 crypto_sign_ed25519_ref_fe25519
  6. #define fe25519_freeze crypto_sign_ed25519_ref_fe25519_freeze
  7. #define fe25519_unpack crypto_sign_ed25519_ref_fe25519_unpack
  8. #define fe25519_pack crypto_sign_ed25519_ref_fe25519_pack
  9. #define fe25519_iszero crypto_sign_ed25519_ref_fe25519_iszero
  10. #define fe25519_iseq_vartime crypto_sign_ed25519_ref_fe25519_iseq_vartime
  11. #define fe25519_cmov crypto_sign_ed25519_ref_fe25519_cmov
  12. #define fe25519_setone crypto_sign_ed25519_ref_fe25519_setone
  13. #define fe25519_setzero crypto_sign_ed25519_ref_fe25519_setzero
  14. #define fe25519_neg crypto_sign_ed25519_ref_fe25519_neg
  15. #define fe25519_getparity crypto_sign_ed25519_ref_fe25519_getparity
  16. #define fe25519_add crypto_sign_ed25519_ref_fe25519_add
  17. #define fe25519_sub crypto_sign_ed25519_ref_fe25519_sub
  18. #define fe25519_mul crypto_sign_ed25519_ref_fe25519_mul
  19. #define fe25519_square crypto_sign_ed25519_ref_fe25519_square
  20. #define fe25519_invert crypto_sign_ed25519_ref_fe25519_invert
  21. #define fe25519_pow2523 crypto_sign_ed25519_ref_fe25519_pow2523
  22. typedef struct
  23. {
  24. crypto_uint32 v[32];
  25. }
  26. fe25519;
  27. void fe25519_freeze(fe25519 *r);
  28. void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
  29. void fe25519_pack(unsigned char r[32], const fe25519 *x);
  30. int fe25519_iszero(const fe25519 *x);
  31. int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y);
  32. void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b);
  33. void fe25519_setone(fe25519 *r);
  34. void fe25519_setzero(fe25519 *r);
  35. void fe25519_neg(fe25519 *r, const fe25519 *x);
  36. unsigned char fe25519_getparity(const fe25519 *x);
  37. void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
  38. void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
  39. void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
  40. void fe25519_square(fe25519 *r, const fe25519 *x);
  41. void fe25519_invert(fe25519 *r, const fe25519 *x);
  42. void fe25519_pow2523(fe25519 *r, const fe25519 *x);
  43. #endif