twistpoint_fp2.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. * File: dclxvi-20130329/twistpoint_fp2.h
  3. * Author: Ruben Niederhagen, Peter Schwabe
  4. * Public Domain
  5. */
  6. #ifndef TWISTPOINT_FP2_H
  7. #define TWISTPOINT_FP2_H
  8. #include "fp2e.h"
  9. #include "scalar.h"
  10. typedef struct twistpoint_fp2_struct twistpoint_fp2_struct_t;
  11. struct twistpoint_fp2_struct
  12. {
  13. fp2e_t m_x; // X-Coordinate (Jacobian Coordinate system)
  14. fp2e_t m_y; // Y-Coordinate (Jacobian Coordinate system)
  15. fp2e_t m_z; // Z-Coordinate (Jacobian Coordinate system)
  16. fp2e_t m_t; // T = Z^2, only used during pairing computation, set to zero if not set
  17. };
  18. typedef twistpoint_fp2_struct_t twistpoint_fp2_t[1];
  19. void twistpoint_fp2_set(twistpoint_fp2_t rop, const twistpoint_fp2_t op);
  20. void twistpoint_fp2_setneutral(twistpoint_fp2_t rop);
  21. void twistpoint_fp2_neg(twistpoint_fp2_t rop, const twistpoint_fp2_t op);
  22. void twistpoint_fp2_set_fp2e(twistpoint_fp2_t rop, const fp2e_t x, const fp2e_t y, const fp2e_t z);
  23. void twistpoint_fp2_affineset_fp2e(twistpoint_fp2_t rop, const fp2e_t x, const fp2e_t y);
  24. void twistpoint_fp2_add_vartime(twistpoint_fp2_t rop, const twistpoint_fp2_t op1, const twistpoint_fp2_t op2);
  25. void twistpoint_fp2_double(twistpoint_fp2_t rop, const twistpoint_fp2_t op);
  26. void twistpoint_fp2_scalarmult_vartime(twistpoint_fp2_t rop, const twistpoint_fp2_t op, const scalar_t scalar);
  27. void twistpoint_fp2_print(FILE *outfile, const twistpoint_fp2_t op);
  28. // Transform to Affine Coordinates (z=1)
  29. void twistpoint_fp2_makeaffine(twistpoint_fp2_t op);
  30. #endif // ifdef TWISTPOINT_FP2_H