Debian Codegraph @

cref/cref.h

raw symbols SCIP
1 #include <stdint.h>
2
3 // -- crypto_(u)int{32,64}.h --
4
5
6 typedef unsigned int crypto_uint32;
7 typedef int crypto_int32;
8 typedef int64_t crypto_int64;
9 typedef uint64_t crypto_uint64;
10
11 // -- fe25519.h --
12
13 typedef struct
14 {
15 crypto_int32 v[10];
16 }
17 fe25519;
18
19 extern const fe25519 fe25519_zero;
20 extern const fe25519 fe25519_one;
21 extern const fe25519 fe25519_two;
22
23 extern const fe25519 fe25519_sqrtm1;
24 extern const fe25519 fe25519_msqrtm1;
25 extern const fe25519 fe25519_m1;
26
27 //void fe25519_freeze(fe25519 *r);
28
29 void fe25519_unpack(fe25519 *r, const unsigned char x[32]);
30
31 void fe25519_pack(unsigned char r[32], const fe25519 *x);
32
33 int fe25519_iszero(const fe25519 *x);
34
35 int fe25519_isone(const fe25519 *x);
36
37 int fe25519_isnegative(const fe25519 *x);
38
39 int fe25519_iseq(const fe25519 *x, const fe25519 *y);
40
41 int fe25519_iseq_vartime(const fe25519 *x, const fe25519 *y);
42
43 void fe25519_cmov(fe25519 *r, const fe25519 *x, unsigned char b);
44
45 void fe25519_setone(fe25519 *r);
46
47 void fe25519_setzero(fe25519 *r);
48
49 void fe25519_neg(fe25519 *r, const fe25519 *x);
50
51 unsigned char fe25519_getparity(const fe25519 *x);
52
53 void fe25519_add(fe25519 *r, const fe25519 *x, const fe25519 *y);
54
55 void fe25519_double(fe25519 *r, const fe25519 *x);
56 void fe25519_triple(fe25519 *r, const fe25519 *x);
57
58 void fe25519_sub(fe25519 *r, const fe25519 *x, const fe25519 *y);
59
60 void fe25519_mul(fe25519 *r, const fe25519 *x, const fe25519 *y);
61
62 void fe25519_square(fe25519 *r, const fe25519 *x);
63 void fe25519_square_double(fe25519 *h,const fe25519 *f);
64
65 void fe25519_invert(fe25519 *r, const fe25519 *x);
66
67 void fe25519_pow2523(fe25519 *r, const fe25519 *x);
68
69 void fe25519_invsqrt(fe25519 *r, const fe25519 *x);
70
71 int fe25519_invsqrti(fe25519 *r, const fe25519 *x);
72
73 int fe25519_sqrti(fe25519 *r, const fe25519 *x);
74
75 void fe25519_sqrt(fe25519 *r, const fe25519 *x);
76
77 //void fe25519_print(const fe25519 *x);
78
79
80 // -- scalar.h --
81 #define GROUP_SCALAR_PACKEDBYTES 32
82
83 typedef struct
84 {
85 uint32_t v[32];
86 }
87 group_scalar;
88
89 extern const group_scalar group_scalar_zero;
90 extern const group_scalar group_scalar_one;
91
92 int group_scalar_unpack(group_scalar *r, const unsigned char x[GROUP_SCALAR_PACKEDBYTES]);
93 void group_scalar_pack(unsigned char s[GROUP_SCALAR_PACKEDBYTES], const group_scalar *r);
94
95 void group_scalar_setzero(group_scalar *r);
96 void group_scalar_setone(group_scalar *r);
97 //void group_scalar_setrandom(group_scalar *r); // Removed to avoid dependency on platform specific randombytes
98 void group_scalar_add(group_scalar *r, const group_scalar *x, const group_scalar *y);
99 void group_scalar_sub(group_scalar *r, const group_scalar *x, const group_scalar *y);
100 void group_scalar_negate(group_scalar *r, const group_scalar *x);
101 void group_scalar_mul(group_scalar *r, const group_scalar *x, const group_scalar *y);
102 void group_scalar_square(group_scalar *r, const group_scalar *x);
103 void group_scalar_invert(group_scalar *r, const group_scalar *x);
104
105 int group_scalar_isone(const group_scalar *x);
106 int group_scalar_iszero(const group_scalar *x);
107 int group_scalar_equals(const group_scalar *x, const group_scalar *y);
108
109
110 // Additional functions, not required by API
111 int scalar_tstbit(const group_scalar *x, const unsigned int pos);
112 int scalar_bitlen(const group_scalar *x);
113 void scalar_window3(signed char r[85], const group_scalar *x);
114 void scalar_window5(signed char r[51], const group_scalar *s);
115 void scalar_slide(signed char r[256], const group_scalar *s, int swindowsize);
116
117 void scalar_from64bytes(group_scalar *r, const unsigned char h[64]);
118
119
120 // -- group.h --
121
122 #define GROUP_GE_PACKEDBYTES 32
123
124 typedef struct
125 {
126 fe25519 x;
127 fe25519 y;
128 fe25519 z;
129 fe25519 t;
130 } group_ge;
131
132 extern const group_ge group_ge_base;
133 extern const group_ge group_ge_neutral;
134
135 // Constant-time versions
136 int group_ge_unpack(group_ge *r, const unsigned char x[GROUP_GE_PACKEDBYTES]);
137 void group_ge_pack(unsigned char r[GROUP_GE_PACKEDBYTES], const group_ge *x);
138
139 void group_ge_add(group_ge *r, const group_ge *x, const group_ge *y);
140 void group_ge_double(group_ge *r, const group_ge *x);
141 void group_ge_negate(group_ge *r, const group_ge *x);
142 void group_ge_scalarmult(group_ge *r, const group_ge *x, const group_scalar *s);
143 void group_ge_scalarmult_base(group_ge *r, const group_scalar *s);
144 void group_ge_multiscalarmult(group_ge *r, const group_ge *x, const group_scalar *s, unsigned long long xlen);
145 int group_ge_equals(const group_ge *x, const group_ge *y);
146 int group_ge_isneutral(const group_ge *x);
147
148 // Non-constant-time versions
149 void group_ge_add_publicinputs(group_ge *r, const group_ge *x, const group_ge *y);
150 void group_ge_double_publicinputs(group_ge *r, const group_ge *x);
151 void group_ge_negate_publicinputs(group_ge *r, const group_ge *x);
152 void group_ge_scalarmult_publicinputs(group_ge *r, const group_ge *x, const group_scalar *s);
153 void group_ge_scalarmult_base_publicinputs(group_ge *r, const group_scalar *s);
154 void group_ge_multiscalarmult_publicinputs(group_ge *r, const group_ge *x, const group_scalar *s, unsigned long long xlen);
155 int group_ge_equals_publicinputs(const group_ge *x, const group_ge *y);
156 int group_ge_isneutral_publicinputs(const group_ge *x);
157
158 // Not required by API
159 //void ge_print(const group_ge *x);
160
161 void group_ge_from_jacobi_quartic(group_ge *x,
162 const fe25519 *s, const fe25519 *t);
163 void group_ge_elligator(group_ge *x, const fe25519 *r0);
164