-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHacl_Hash.h
250 lines (184 loc) · 6.65 KB
/
Hacl_Hash.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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
/* MIT License
*
* Copyright (c) 2016-2020 INRIA, CMU 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.
*/
#ifndef __Hacl_Hash_H
#define __Hacl_Hash_H
#if defined(__cplusplus)
extern "C" {
#endif
#include "evercrypt_targetconfig.h"
// #include "libintvector.h"
#include "kremlin/internal/types.h"
// #include "kremlin/lowstar_endianness.h"
#include <string.h>
#include "kremlin/internal/target.h"
#include "Hacl_Kremlib.h"
#include "Hacl_Blake2s_32.h"
#include "Lib_Memzero0.h"
#include "Hacl_Blake2b_32.h"
#include "Hacl_Impl_Blake2_Constants.h"
#include "Hacl_Spec.h"
uint64_t Hacl_Hash_Core_Blake2_update_blake2s_32(uint32_t *s, uint64_t totlen, uint8_t *block);
void Hacl_Hash_Core_Blake2_finish_blake2s_32(uint32_t *s, uint64_t ev, uint8_t *dst);
FStar_UInt128_uint128
Hacl_Hash_Core_Blake2_update_blake2b_32(
uint64_t *s,
FStar_UInt128_uint128 totlen,
uint8_t *block
);
void
Hacl_Hash_Core_Blake2_finish_blake2b_32(uint64_t *s, FStar_UInt128_uint128 ev, uint8_t *dst);
uint64_t
Hacl_Hash_Blake2_update_multi_blake2s_32(
uint32_t *s,
uint64_t ev,
uint8_t *blocks,
uint32_t n_blocks
);
FStar_UInt128_uint128
Hacl_Hash_Blake2_update_multi_blake2b_32(
uint64_t *s,
FStar_UInt128_uint128 ev,
uint8_t *blocks,
uint32_t n_blocks
);
typedef struct K___uint32_t_uint32_t_uint32_t__uint8_t___uint8_t__s
{
uint32_t fst;
uint32_t snd;
uint32_t thd;
uint8_t *f3;
uint8_t *f4;
}
K___uint32_t_uint32_t_uint32_t__uint8_t___uint8_t_;
typedef struct K___uint32_t_uint32_t_uint32_t_s
{
uint32_t fst;
uint32_t snd;
uint32_t thd;
}
K___uint32_t_uint32_t_uint32_t;
uint64_t
Hacl_Hash_Blake2_update_last_blake2s_32(
uint32_t *s,
uint64_t ev,
uint64_t prev_len,
uint8_t *input,
uint32_t input_len
);
FStar_UInt128_uint128
Hacl_Hash_Blake2_update_last_blake2b_32(
uint64_t *s,
FStar_UInt128_uint128 ev,
FStar_UInt128_uint128 prev_len,
uint8_t *input,
uint32_t input_len
);
void Hacl_Hash_Blake2_hash_blake2s_32(uint8_t *input, uint32_t input_len, uint8_t *dst);
void Hacl_Hash_Blake2_hash_blake2b_32(uint8_t *input, uint32_t input_len, uint8_t *dst);
void Hacl_Hash_MD5_legacy_update_multi(uint32_t *s, uint8_t *blocks, uint32_t n_blocks);
void
Hacl_Hash_MD5_legacy_update_last(
uint32_t *s,
uint64_t prev_len,
uint8_t *input,
uint32_t input_len
);
void Hacl_Hash_MD5_legacy_hash(uint8_t *input, uint32_t input_len, uint8_t *dst);
void Hacl_Hash_Core_MD5_legacy_init(uint32_t *s);
void Hacl_Hash_Core_MD5_legacy_update(uint32_t *abcd, uint8_t *x);
void Hacl_Hash_Core_MD5_legacy_pad(uint64_t len, uint8_t *dst);
void Hacl_Hash_Core_MD5_legacy_finish(uint32_t *s, uint8_t *dst);
void Hacl_Hash_SHA1_legacy_update_multi(uint32_t *s, uint8_t *blocks, uint32_t n_blocks);
void
Hacl_Hash_SHA1_legacy_update_last(
uint32_t *s,
uint64_t prev_len,
uint8_t *input,
uint32_t input_len
);
void Hacl_Hash_SHA1_legacy_hash(uint8_t *input, uint32_t input_len, uint8_t *dst);
void Hacl_Hash_Core_SHA1_legacy_init(uint32_t *s);
void Hacl_Hash_Core_SHA1_legacy_update(uint32_t *h, uint8_t *l);
void Hacl_Hash_Core_SHA1_legacy_pad(uint64_t len, uint8_t *dst);
void Hacl_Hash_Core_SHA1_legacy_finish(uint32_t *s, uint8_t *dst);
void Hacl_Hash_SHA2_update_multi_224(uint32_t *s, uint8_t *blocks, uint32_t n_blocks);
void Hacl_Hash_SHA2_update_multi_256(uint32_t *s, uint8_t *blocks, uint32_t n_blocks);
void Hacl_Hash_SHA2_update_multi_384(uint64_t *s, uint8_t *blocks, uint32_t n_blocks);
void Hacl_Hash_SHA2_update_multi_512(uint64_t *s, uint8_t *blocks, uint32_t n_blocks);
void
Hacl_Hash_SHA2_update_last_224(
uint32_t *s,
uint64_t prev_len,
uint8_t *input,
uint32_t input_len
);
void
Hacl_Hash_SHA2_update_last_256(
uint32_t *s,
uint64_t prev_len,
uint8_t *input,
uint32_t input_len
);
void
Hacl_Hash_SHA2_update_last_384(
uint64_t *s,
FStar_UInt128_uint128 prev_len,
uint8_t *input,
uint32_t input_len
);
void
Hacl_Hash_SHA2_update_last_512(
uint64_t *s,
FStar_UInt128_uint128 prev_len,
uint8_t *input,
uint32_t input_len
);
void Hacl_Hash_SHA2_hash_224(uint8_t *input, uint32_t input_len, uint8_t *dst);
void Hacl_Hash_SHA2_hash_256(uint8_t *input, uint32_t input_len, uint8_t *dst);
void Hacl_Hash_SHA2_hash_384(uint8_t *input, uint32_t input_len, uint8_t *dst);
void Hacl_Hash_SHA2_hash_512(uint8_t *input, uint32_t input_len, uint8_t *dst);
void Hacl_Hash_Core_SHA2_init_224(uint32_t *s);
void Hacl_Hash_Core_SHA2_init_256(uint32_t *s);
void Hacl_Hash_Core_SHA2_init_384(uint64_t *s);
void Hacl_Hash_Core_SHA2_init_512(uint64_t *s);
void Hacl_Hash_Core_SHA2_update_224(uint32_t *hash, uint8_t *block);
void Hacl_Hash_Core_SHA2_update_256(uint32_t *hash, uint8_t *block);
void Hacl_Hash_Core_SHA2_update_384(uint64_t *hash, uint8_t *block);
void Hacl_Hash_Core_SHA2_update_512(uint64_t *hash, uint8_t *block);
void Hacl_Hash_Core_SHA2_pad_224(uint64_t len, uint8_t *dst);
void Hacl_Hash_Core_SHA2_pad_256(uint64_t len, uint8_t *dst);
void Hacl_Hash_Core_SHA2_pad_384(FStar_UInt128_uint128 len, uint8_t *dst);
void Hacl_Hash_Core_SHA2_pad_512(FStar_UInt128_uint128 len, uint8_t *dst);
void Hacl_Hash_Core_SHA2_finish_224(uint32_t *s, uint8_t *dst);
void Hacl_Hash_Core_SHA2_finish_256(uint32_t *s, uint8_t *dst);
void Hacl_Hash_Core_SHA2_finish_384(uint64_t *s, uint8_t *dst);
void Hacl_Hash_Core_SHA2_finish_512(uint64_t *s, uint8_t *dst);
uint32_t Hacl_Hash_Definitions_word_len(Spec_Hash_Definitions_hash_alg a);
uint32_t Hacl_Hash_Definitions_block_len(Spec_Hash_Definitions_hash_alg a);
uint32_t Hacl_Hash_Definitions_hash_word_len(Spec_Hash_Definitions_hash_alg a);
uint32_t Hacl_Hash_Definitions_hash_len(Spec_Hash_Definitions_hash_alg a);
#if defined(__cplusplus)
}
#endif
#define __Hacl_Hash_H_DEFINED
#endif