blob 55e95f95b6e9597c90192088e06cbbf38336e632
1 #ifndef GE_H
2 #define GE_H
4 /*
5 ge means group element.
7 Here the group is the set of pairs (x,y) of field elements (see fe.h)
8 satisfying -x^2 + y^2 = 1 + d x^2y^2
9 where d = -121665/121666.
11 Representations:
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)
18 #include "fe.h"
20 typedef struct {
21 fe X;
22 fe Y;
23 fe Z;
24 } ge_p2;
26 typedef struct {
27 fe X;
28 fe Y;
29 fe Z;
30 fe T;
31 } ge_p3;
33 typedef struct {
34 fe X;
35 fe Y;
36 fe Z;
37 fe T;
38 } ge_p1p1;
40 typedef struct {
41 fe yplusx;
42 fe yminusx;
43 fe xy2d;
44 } ge_precomp;
46 typedef struct {
47 fe YplusX;
48 fe YminusX;
49 fe Z;
50 fe T2d;
51 } ge_cached;
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
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
68 #define ge_msub crypto_sign_ed25519_ref10_ge_msub
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
74 extern void ge_tobytes(unsigned char *,const ge_p2 *);
75 extern void ge_p3_tobytes(unsigned char *,const ge_p3 *);
76 extern int ge_frombytes_negate_vartime(ge_p3 *,const unsigned char *);
78 extern void ge_p2_0(ge_p2 *);
79 extern void ge_p3_0(ge_p3 *);
80 extern void ge_precomp_0(ge_precomp *);
81 extern void ge_p3_to_p2(ge_p2 *,const ge_p3 *);
82 extern void ge_p3_to_cached(ge_cached *,const ge_p3 *);
83 extern void ge_p1p1_to_p2(ge_p2 *,const ge_p1p1 *);
84 extern void ge_p1p1_to_p3(ge_p3 *,const ge_p1p1 *);
85 extern void ge_p2_dbl(ge_p1p1 *,const ge_p2 *);
86 extern void ge_p3_dbl(ge_p1p1 *,const ge_p3 *);
88 extern void ge_madd(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
89 extern void ge_msub(ge_p1p1 *,const ge_p3 *,const ge_precomp *);
90 extern void ge_add(ge_p1p1 *,const ge_p3 *,const ge_cached *);
91 extern void ge_sub(ge_p1p1 *,const ge_p3 *,const ge_cached *);
92 extern void ge_scalarmult_base(ge_p3 *,const unsigned char *);
93 extern void ge_double_scalarmult_vartime(ge_p2 *,const unsigned char *,const ge_p3 *,const unsigned char *);
95 #endif