You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

6 jaren geleden
12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef FP_H
  2. #define FP_H
  3. #include "u512.h"
  4. /* fp is in the Montgomery domain, so interpreting that
  5. as an integer should never make sense.
  6. enable compiler warnings when mixing up u512 and fp. */
  7. typedef struct fp {
  8. u512 x;
  9. } fp;
  10. extern const fp fp_0;
  11. extern const fp fp_1;
  12. void fp_set(fp *x, uint64_t y);
  13. void fp_cswap(fp *x, fp *y, bool c);
  14. void fp_enc(fp *x, u512 const *y); /* encode to Montgomery representation */
  15. void fp_dec(u512 *x, fp const *y); /* decode from Montgomery representation */
  16. void fp_add2(fp *x, fp const *y);
  17. void fp_sub2(fp *x, fp const *y);
  18. void fp_mul2(fp *x, fp const *y);
  19. void fp_add3(fp *x, fp const *y, fp const *z);
  20. void fp_sub3(fp *x, fp const *y, fp const *z);
  21. void fp_mul3(fp *x, fp const *y, fp const *z);
  22. void fp_sq1(fp *x);
  23. void fp_sq2(fp *x, fp const *y);
  24. void fp_inv(fp *x);
  25. bool fp_issquare(fp const *x);
  26. void fp_random(fp *x);
  27. #endif