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