1
0

ge.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef GE_H
  2. #define GE_H
  3. /*
  4. ge means group element.
  5. Here the group is the set of pairs (x,y) of field elements (see fe.h)
  6. satisfying -x^2 + y^2 = 1 + d x^2y^2
  7. where d = -121665/121666.
  8. Representations:
  9. ge_p2 (projective): (X:Y:Z) satisfying x=X/Z, y=Y/Z
  10. ge_p3 (extended): (X:Y:Z:T) satisfying x=X/Z, y=Y/Z, XY=ZT
  11. ge_p1p1 (completed): ((X:Z),(Y:T)) satisfying x=X/Z, y=Y/T
  12. ge_precomp (Duif): (y+x,y-x,2dxy)
  13. */
  14. #include "fe.h"
  15. typedef struct {
  16. fe X;
  17. fe Y;
  18. fe Z;
  19. } ge_p2;
  20. typedef struct {
  21. fe X;
  22. fe Y;
  23. fe Z;
  24. fe T;
  25. } ge_p3;
  26. typedef struct {
  27. fe X;
  28. fe Y;
  29. fe Z;
  30. fe T;
  31. } ge_p1p1;
  32. typedef struct {
  33. fe yplusx;
  34. fe yminusx;
  35. fe xy2d;
  36. } ge_precomp;
  37. typedef struct {
  38. fe YplusX;
  39. fe YminusX;
  40. fe Z;
  41. fe T2d;
  42. } ge_cached;
  43. #define ge_frombytes_negate_vartime crypto_sign_ed25519_ref10_ge_frombytes_negate_vartime
  44. #define ge_tobytes crypto_sign_ed25519_ref10_ge_tobytes
  45. #define ge_p3_tobytes crypto_sign_ed25519_ref10_ge_p3_tobytes
  46. #define ge_p2_0 crypto_sign_ed25519_ref10_ge_p2_0
  47. #define ge_p3_0 crypto_sign_ed25519_ref10_ge_p3_0
  48. #define ge_precomp_0 crypto_sign_ed25519_ref10_ge_precomp_0
  49. #define ge_p3_to_p2 crypto_sign_ed25519_ref10_ge_p3_to_p2
  50. #define ge_p3_to_cached crypto_sign_ed25519_ref10_ge_p3_to_cached
  51. #define ge_p1p1_to_p2 crypto_sign_ed25519_ref10_ge_p1p1_to_p2
  52. #define ge_p1p1_to_p3 crypto_sign_ed25519_ref10_ge_p1p1_to_p3
  53. #define ge_p2_dbl crypto_sign_ed25519_ref10_ge_p2_dbl
  54. #define ge_p3_dbl crypto_sign_ed25519_ref10_ge_p3_dbl
  55. #define ge_madd crypto_sign_ed25519_ref10_ge_madd
  56. #define ge_msub crypto_sign_ed25519_ref10_ge_msub
  57. #define ge_add crypto_sign_ed25519_ref10_ge_add
  58. #define ge_sub crypto_sign_ed25519_ref10_ge_sub
  59. #define ge_scalarmult_base crypto_sign_ed25519_ref10_ge_scalarmult_base
  60. #define ge_double_scalarmult_vartime crypto_sign_ed25519_ref10_ge_double_scalarmult_vartime
  61. extern void ge_tobytes(unsigned char *,const ge_p2 *);
  62. extern void ge_p3_tobytes(unsigned char *,const ge_p3 *);
  63. extern int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *);
  64. extern void ge_p2_0(ge_p2 *);
  65. extern void ge_p3_0(ge_p3 *);
  66. extern void ge_precomp_0(ge_precomp *);
  67. extern void ge_p3_to_p2(ge_p2 *,const ge_p3 *);
  68. extern void ge_p3_to_cached(ge_cached *,const ge_p3 *);
  69. extern void ge_p1p1_to_p2(ge_p2 *,const ge_p1p1 *);
  70. extern void ge_p1p1_to_p3(ge_p3 *,const ge_p1p1 *);
  71. extern void ge_p2_dbl(ge_p1p1 *,const ge_p2 *);
  72. extern void ge_p3_dbl(ge_p1p1 *,const ge_p3 *);
  73. extern void ge_madd(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
  74. extern void ge_msub(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
  75. extern void ge_add(ge_p1p1 *,const ge_p3 *,const ge_cached *);
  76. extern void ge_sub(ge_p1p1 *,const ge_p3 *,const ge_cached *);
  77. extern void ge_scalarmult_base(ge_p3 *,const unsigned char *);
  78. extern void ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *,const ge_p3 *,const unsigned char *);
  79. #endif