twistpoint_fp2.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #ifdef NEW_PARAMETERS
  10. #include "scalar_512.h"
  11. #else
  12. #include "scalar.h"
  13. #endif
  14. typedef struct twistpoint_fp2_struct twistpoint_fp2_struct_t;
  15. struct twistpoint_fp2_struct
  16. {
  17. fp2e_t m_x; // X-Coordinate (Jacobian Coordinate system)
  18. fp2e_t m_y; // Y-Coordinate (Jacobian Coordinate system)
  19. fp2e_t m_z; // Z-Coordinate (Jacobian Coordinate system)
  20. fp2e_t m_t; // T = Z^2, only used during pairing computation, set to zero if not set
  21. };
  22. typedef twistpoint_fp2_struct_t twistpoint_fp2_t[1];
  23. void twistpoint_fp2_set(twistpoint_fp2_t rop, const twistpoint_fp2_t op);
  24. void twistpoint_fp2_setneutral(twistpoint_fp2_t rop);
  25. void twistpoint_fp2_neg(twistpoint_fp2_t rop, const twistpoint_fp2_t op);
  26. void twistpoint_fp2_set_fp2e(twistpoint_fp2_t rop, const fp2e_t x, const fp2e_t y, const fp2e_t z);
  27. void twistpoint_fp2_affineset_fp2e(twistpoint_fp2_t rop, const fp2e_t x, const fp2e_t y);
  28. void twistpoint_fp2_add_vartime(twistpoint_fp2_t rop, const twistpoint_fp2_t op1, const twistpoint_fp2_t op2);
  29. void twistpoint_fp2_double(twistpoint_fp2_t rop, const twistpoint_fp2_t op);
  30. void twistpoint_fp2_scalarmult_vartime(twistpoint_fp2_t rop, const twistpoint_fp2_t op, const scalar_t scalar);
  31. void twistpoint_fp2_print(FILE *outfile, const twistpoint_fp2_t op);
  32. // Transform to Affine Coordinates (z=1)
  33. void twistpoint_fp2_makeaffine(twistpoint_fp2_t op);
  34. #endif // ifdef TWISTPOINT_FP2_H