-
Notifications
You must be signed in to change notification settings - Fork 4
/
Hacl_Ed25519.h
232 lines (130 loc) · 6.14 KB
/
Hacl_Ed25519.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
/* MIT License
*
* Copyright (c) 2016-2017 INRIA and Microsoft Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "kremlib.h"
#ifndef __Hacl_Ed25519_H
#define __Hacl_Ed25519_H
typedef uint64_t Hacl_Bignum_Constants_limb;
typedef FStar_UInt128_t Hacl_Bignum_Constants_wide;
typedef uint64_t Hacl_Bignum_Parameters_limb;
typedef FStar_UInt128_t Hacl_Bignum_Parameters_wide;
typedef uint32_t Hacl_Bignum_Parameters_ctr;
typedef uint64_t *Hacl_Bignum_Parameters_felem;
typedef FStar_UInt128_t *Hacl_Bignum_Parameters_felem_wide;
typedef void *Hacl_Bignum_Parameters_seqelem;
typedef void *Hacl_Bignum_Parameters_seqelem_wide;
typedef FStar_UInt128_t Hacl_Bignum_Wide_t;
typedef uint64_t Hacl_Bignum_Limb_t;
// TODO: multiple include (already defined in Hacl_Curve25519.h)
//extern void Hacl_Bignum_lemma_diff(Prims_int x0, Prims_int x1, Prims_pos x2);
typedef struct
{
void *fst;
void *snd;
}
K___FStar_Seq_Base_seq_uint64_t_FStar_Seq_Base_seq_uint64_t;
typedef uint64_t *Hacl_EC_Point_point;
typedef uint8_t *Hacl_EC_Format_uint8_p;
typedef uint64_t Hacl_Lib_Create64_h64;
typedef uint64_t Hacl_Bignum25519_limb;
typedef uint64_t *Hacl_Bignum25519_felem;
typedef void *Hacl_Bignum25519_seqelem;
typedef uint64_t *Hacl_Impl_Ed25519_ExtPoint_point;
typedef uint8_t *Hacl_Impl_Store51_uint8_p;
typedef uint64_t *Hacl_Impl_Store51_felem;
typedef uint8_t *Hacl_Impl_Ed25519_PointCompress_hint8_p;
typedef uint64_t *Hacl_Impl_Ed25519_PointCompress_hint64_p;
typedef uint64_t *Hacl_Impl_Ed25519_SwapConditional_felem;
typedef uint8_t *Hacl_Impl_Ed25519_Ladder_Step_uint8_p;
typedef uint64_t *Hacl_Impl_Ed25519_Ladder_elemB;
typedef uint8_t *Hacl_Hash_Lib_LoadStore_uint8_p;
typedef uint8_t Hacl_Hash_Lib_Create_uint8_t;
typedef uint32_t Hacl_Hash_Lib_Create_uint32_t;
typedef uint64_t Hacl_Hash_Lib_Create_uint64_t;
typedef uint8_t Hacl_Hash_Lib_Create_uint8_ht;
typedef uint32_t Hacl_Hash_Lib_Create_uint32_ht;
typedef uint64_t Hacl_Hash_Lib_Create_uint64_ht;
typedef uint8_t *Hacl_Hash_Lib_Create_uint8_p;
typedef uint32_t *Hacl_Hash_Lib_Create_uint32_p;
typedef uint64_t *Hacl_Hash_Lib_Create_uint64_p;
typedef uint8_t Hacl_Impl_SHA2_512_Lemmas_uint8_t;
typedef uint32_t Hacl_Impl_SHA2_512_Lemmas_uint32_t;
typedef uint64_t Hacl_Impl_SHA2_512_Lemmas_uint64_t;
typedef uint8_t Hacl_Impl_SHA2_512_Lemmas_uint8_ht;
typedef uint32_t Hacl_Impl_SHA2_512_Lemmas_uint32_ht;
typedef uint64_t Hacl_Impl_SHA2_512_Lemmas_uint64_ht;
typedef FStar_UInt128_t Hacl_Impl_SHA2_512_Lemmas_uint128_ht;
typedef uint64_t *Hacl_Impl_SHA2_512_Lemmas_uint64_p;
typedef uint8_t *Hacl_Impl_SHA2_512_Lemmas_uint8_p;
typedef uint8_t Hacl_Impl_SHA2_512_uint8_t;
typedef uint32_t Hacl_Impl_SHA2_512_uint32_t;
typedef uint64_t Hacl_Impl_SHA2_512_uint64_t;
typedef uint8_t Hacl_Impl_SHA2_512_uint8_ht;
typedef uint32_t Hacl_Impl_SHA2_512_uint32_ht;
typedef uint64_t Hacl_Impl_SHA2_512_uint64_ht;
typedef FStar_UInt128_t Hacl_Impl_SHA2_512_uint128_ht;
typedef uint64_t *Hacl_Impl_SHA2_512_uint64_p;
typedef uint8_t *Hacl_Impl_SHA2_512_uint8_p;
typedef uint8_t Hacl_SHA2_512_uint8_t;
typedef uint32_t Hacl_SHA2_512_uint32_t;
typedef uint64_t Hacl_SHA2_512_uint64_t;
typedef uint8_t Hacl_SHA2_512_uint8_ht;
typedef uint32_t Hacl_SHA2_512_uint32_ht;
typedef uint64_t Hacl_SHA2_512_uint64_ht;
typedef FStar_UInt128_t Hacl_SHA2_512_uint128_ht;
typedef uint64_t *Hacl_SHA2_512_uint64_p;
typedef uint8_t *Hacl_SHA2_512_uint8_p;
typedef uint8_t *Hacl_Impl_Ed25519_SecretExpand_hint8_p;
typedef uint8_t *Hacl_Impl_Ed25519_SecretToPublic_hint8_p;
typedef Prims_nat Hacl_Impl_Ed25519_Verify_Lemmas_u51;
typedef uint8_t *Hacl_Impl_Ed25519_PointEqual_uint8_p;
typedef uint64_t *Hacl_Impl_Ed25519_PointEqual_felem;
typedef uint32_t Hacl_Impl_Load56_u32;
typedef uint8_t Hacl_Impl_Load56_h8;
typedef uint64_t Hacl_Impl_Load56_h64;
typedef uint8_t *Hacl_Impl_Load56_hint8_p;
typedef uint64_t *Hacl_Impl_Ed25519_RecoverX_elemB;
typedef uint32_t Hacl_Impl_Load51_u32;
typedef uint8_t Hacl_Impl_Load51_h8;
typedef uint64_t Hacl_Impl_Load51_h64;
typedef uint8_t *Hacl_Impl_Load51_hint8_p;
typedef uint8_t *Hacl_Impl_Store56_hint8_p;
typedef uint64_t *Hacl_Impl_Store56_qelem;
typedef uint8_t *Hacl_Impl_SHA512_Ed25519_1_hint8_p;
typedef uint8_t *Hacl_Impl_SHA512_Ed25519_hint8_p;
typedef uint8_t *Hacl_Impl_Sha512_hint8_p;
typedef FStar_UInt128_t Hacl_Lib_Create128_h128;
typedef uint64_t *Hacl_Impl_BignumQ_Mul_qelemB;
typedef uint64_t Hacl_Impl_BignumQ_Mul_h64;
typedef uint8_t *Hacl_Impl_Ed25519_Verify_Steps_uint8_p;
typedef uint64_t *Hacl_Impl_Ed25519_Verify_Steps_felem;
typedef uint8_t *Hacl_Impl_Ed25519_Verify_uint8_p;
typedef uint64_t *Hacl_Impl_Ed25519_Verify_felem;
typedef uint8_t *Hacl_Impl_Ed25519_Sign_Steps_hint8_p;
typedef uint8_t *Hacl_Impl_Ed25519_Sign_hint8_p;
typedef uint8_t *Hacl_Ed25519_uint8_p;
typedef uint8_t *Hacl_Ed25519_hint8_p;
void Hacl_Ed25519_sign(uint8_t *signature, uint8_t *secret, uint8_t *msg, uint32_t len1);
// TODO: original argument called "public" which is a keyword for g++
bool Hacl_Ed25519_verify(uint8_t *publickey, uint8_t *msg, uint32_t len1, uint8_t *signature);
void Hacl_Ed25519_secret_to_public(uint8_t *out, uint8_t *secret);
#endif