Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
group.h
Go to the documentation of this file.
1/***********************************************************************
2 * Copyright (c) 2013, 2014 Pieter Wuille *
3 * Distributed under the MIT software license, see the accompanying *
4 * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
5 ***********************************************************************/
6
7#ifndef SECP256K1_GROUP_H
8#define SECP256K1_GROUP_H
9
10#include "field.h"
11
16typedef struct {
19 int infinity; /* whether this represents the point at infinity */
21
22#define SECP256K1_GE_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_CONST((i),(j),(k),(l),(m),(n),(o),(p)), 0}
23#define SECP256K1_GE_CONST_INFINITY {SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), 1}
24
28typedef struct {
29 secp256k1_fe x; /* actual X: x/z^2 */
30 secp256k1_fe y; /* actual Y: y/z^3 */
32 int infinity; /* whether this represents the point at infinity */
34
35#define SECP256K1_GEJ_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_CONST((i),(j),(k),(l),(m),(n),(o),(p)), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 1), 0}
36#define SECP256K1_GEJ_CONST_INFINITY {SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), SECP256K1_FE_CONST(0, 0, 0, 0, 0, 0, 0, 0), 1}
37
42
43#define SECP256K1_GE_STORAGE_CONST(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) {SECP256K1_FE_STORAGE_CONST((a),(b),(c),(d),(e),(f),(g),(h)), SECP256K1_FE_STORAGE_CONST((i),(j),(k),(l),(m),(n),(o),(p))}
44
45#define SECP256K1_GE_STORAGE_CONST_GET(t) SECP256K1_FE_STORAGE_CONST_GET(t.x), SECP256K1_FE_STORAGE_CONST_GET(t.y)
46
48static void secp256k1_ge_set_xy(secp256k1_ge *r, const secp256k1_fe *x, const secp256k1_fe *y);
49
52static int secp256k1_ge_set_xo_var(secp256k1_ge *r, const secp256k1_fe *x, int odd);
53
55static int secp256k1_ge_is_infinity(const secp256k1_ge *a);
56
58static int secp256k1_ge_is_valid_var(const secp256k1_ge *a);
59
61static void secp256k1_ge_neg(secp256k1_ge *r, const secp256k1_ge *a);
62
64static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a);
65
67static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a);
68
70static void secp256k1_ge_set_all_gej_var(secp256k1_ge *r, const secp256k1_gej *a, size_t len);
71
89static void secp256k1_ge_table_set_globalz(size_t len, secp256k1_ge *a, const secp256k1_fe *zr);
90
92static void secp256k1_ge_set_infinity(secp256k1_ge *r);
93
95static void secp256k1_gej_set_infinity(secp256k1_gej *r);
96
98static void secp256k1_gej_set_ge(secp256k1_gej *r, const secp256k1_ge *a);
99
101static int secp256k1_gej_eq_x_var(const secp256k1_fe *x, const secp256k1_gej *a);
102
104static void secp256k1_gej_neg(secp256k1_gej *r, const secp256k1_gej *a);
105
107static int secp256k1_gej_is_infinity(const secp256k1_gej *a);
108
110static void secp256k1_gej_double(secp256k1_gej *r, const secp256k1_gej *a);
111
113static void secp256k1_gej_double_var(secp256k1_gej *r, const secp256k1_gej *a, secp256k1_fe *rzr);
114
116static void secp256k1_gej_add_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_gej *b, secp256k1_fe *rzr);
117
119static void secp256k1_gej_add_ge(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b);
120
124static void secp256k1_gej_add_ge_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, secp256k1_fe *rzr);
125
127static void secp256k1_gej_add_zinv_var(secp256k1_gej *r, const secp256k1_gej *a, const secp256k1_ge *b, const secp256k1_fe *bzinv);
128
130static void secp256k1_ge_mul_lambda(secp256k1_ge *r, const secp256k1_ge *a);
131
133static void secp256k1_gej_clear(secp256k1_gej *r);
134
136static void secp256k1_ge_clear(secp256k1_ge *r);
137
139static void secp256k1_ge_to_storage(secp256k1_ge_storage *r, const secp256k1_ge *a);
140
142static void secp256k1_ge_from_storage(secp256k1_ge *r, const secp256k1_ge_storage *a);
143
145static void secp256k1_gej_cmov(secp256k1_gej *r, const secp256k1_gej *a, int flag);
146
148static void secp256k1_ge_storage_cmov(secp256k1_ge_storage *r, const secp256k1_ge_storage *a, int flag);
149
151static void secp256k1_gej_rescale(secp256k1_gej *r, const secp256k1_fe *b);
152
162static int secp256k1_ge_is_in_correct_subgroup(const secp256k1_ge* ge);
163
164#endif /* SECP256K1_GROUP_H */
const mie::Vuint & r
Definition bn.cpp:28
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
secp256k1_fe_storage x
Definition group.h:39
secp256k1_fe_storage y
Definition group.h:40
int infinity
Definition group.h:19
secp256k1_fe x
Definition group.h:17
secp256k1_fe y
Definition group.h:18
secp256k1_fe y
Definition group.h:30
secp256k1_fe x
Definition group.h:29
int infinity
Definition group.h:32
secp256k1_fe z
Definition group.h:31
size_t len