• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cryspen / hacl-packages / 5808703668

pending completion
5808703668

Pull #418

github

web-flow
Merge 4abdd0203 into 1575f26e8
Pull Request #418: Add support for Hacl_AES_128_GCM_NI and Hacl_AES_128_GCM_M32

7433 of 7433 new or added lines in 12 files covered. (100.0%)

31975 of 62256 relevant lines covered (51.36%)

1238863.46 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

36.14
/src/Hacl_AES_256_CTR32_BitSlice.c
1
/* MIT License
2
 *
3
 * Copyright (c) 2016-2022 INRIA, CMU and Microsoft Corporation
4
 * Copyright (c) 2022-2023 HACL* Contributors
5
 *
6
 * Permission is hereby granted, free of charge, to any person obtaining a copy
7
 * of this software and associated documentation files (the "Software"), to deal
8
 * in the Software without restriction, including without limitation the rights
9
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 * copies of the Software, and to permit persons to whom the Software is
11
 * furnished to do so, subject to the following conditions:
12
 *
13
 * The above copyright notice and this permission notice shall be included in all
14
 * copies or substantial portions of the Software.
15
 *
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
 * SOFTWARE.
23
 */
24

25

26
#include "Hacl_AES_256_CTR32_BitSlice.h"
27

28
#include "internal/Hacl_AES_128_CTR32_BitSlice.h"
29

30
void Hacl_AES_256_CTR32_BitSlice_aes256_init(uint64_t *ctx, uint8_t *key, uint8_t *nonce)
31
{
2,976✔
32
  uint64_t *kex = ctx + (uint32_t)8U;
2,976✔
33
  uint64_t *n = ctx;
2,976✔
34
  uint32_t klen = (uint32_t)8U;
2,976✔
35
  uint64_t *next0 = kex;
2,976✔
36
  uint64_t *next1 = kex + klen;
2,976✔
37
  Hacl_Impl_AES_CoreBitSlice_load_key1(next0, key);
2,976✔
38
  Hacl_Impl_AES_CoreBitSlice_load_key1(next1, key + (uint32_t)16U);
2,976✔
39
  uint64_t *prev0 = next0;
2,976✔
40
  uint64_t *prev1 = next1;
2,976✔
41
  uint64_t *next01 = kex + klen * (uint32_t)2U;
2,976✔
42
  uint64_t *next11 = kex + klen * (uint32_t)3U;
2,976✔
43
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next01, prev1, (uint8_t)0x01U);
2,976✔
44
  KRML_MAYBE_FOR8(i,
2,976✔
45
    (uint32_t)0U,
2,976✔
46
    (uint32_t)8U,
2,976✔
47
    (uint32_t)1U,
2,976✔
48
    uint64_t n1 = next01[i];
2,976✔
49
    uint64_t n2 = n1 & (uint64_t)0xf000f000f000f000U;
2,976✔
50
    uint64_t n3 = n2 ^ n2 >> (uint32_t)4U;
2,976✔
51
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
52
    next01[i] = n4;);
2,976✔
53
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next01, prev0);
2,976✔
54
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next11, next01, (uint8_t)0U);
2,976✔
55
  KRML_MAYBE_FOR8(i,
2,976✔
56
    (uint32_t)0U,
2,976✔
57
    (uint32_t)8U,
2,976✔
58
    (uint32_t)1U,
2,976✔
59
    uint64_t n1 = next11[i];
2,976✔
60
    uint64_t n2 = n1 & (uint64_t)0x0f000f000f000f00U;
2,976✔
61
    uint64_t n3 = n2 ^ n2 << (uint32_t)4U;
2,976✔
62
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
63
    next11[i] = n4;);
2,976✔
64
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next11, prev1);
2,976✔
65
  uint64_t *prev01 = next01;
2,976✔
66
  uint64_t *prev11 = next11;
2,976✔
67
  uint64_t *next02 = kex + klen * (uint32_t)4U;
2,976✔
68
  uint64_t *next12 = kex + klen * (uint32_t)5U;
2,976✔
69
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next02, prev11, (uint8_t)0x02U);
2,976✔
70
  KRML_MAYBE_FOR8(i,
2,976✔
71
    (uint32_t)0U,
2,976✔
72
    (uint32_t)8U,
2,976✔
73
    (uint32_t)1U,
2,976✔
74
    uint64_t n1 = next02[i];
2,976✔
75
    uint64_t n2 = n1 & (uint64_t)0xf000f000f000f000U;
2,976✔
76
    uint64_t n3 = n2 ^ n2 >> (uint32_t)4U;
2,976✔
77
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
78
    next02[i] = n4;);
2,976✔
79
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next02, prev01);
2,976✔
80
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next12, next02, (uint8_t)0U);
2,976✔
81
  KRML_MAYBE_FOR8(i,
2,976✔
82
    (uint32_t)0U,
2,976✔
83
    (uint32_t)8U,
2,976✔
84
    (uint32_t)1U,
2,976✔
85
    uint64_t n1 = next12[i];
2,976✔
86
    uint64_t n2 = n1 & (uint64_t)0x0f000f000f000f00U;
2,976✔
87
    uint64_t n3 = n2 ^ n2 << (uint32_t)4U;
2,976✔
88
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
89
    next12[i] = n4;);
2,976✔
90
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next12, prev11);
2,976✔
91
  uint64_t *prev02 = next02;
2,976✔
92
  uint64_t *prev12 = next12;
2,976✔
93
  uint64_t *next03 = kex + klen * (uint32_t)6U;
2,976✔
94
  uint64_t *next13 = kex + klen * (uint32_t)7U;
2,976✔
95
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next03, prev12, (uint8_t)0x04U);
2,976✔
96
  KRML_MAYBE_FOR8(i,
2,976✔
97
    (uint32_t)0U,
2,976✔
98
    (uint32_t)8U,
2,976✔
99
    (uint32_t)1U,
2,976✔
100
    uint64_t n1 = next03[i];
2,976✔
101
    uint64_t n2 = n1 & (uint64_t)0xf000f000f000f000U;
2,976✔
102
    uint64_t n3 = n2 ^ n2 >> (uint32_t)4U;
2,976✔
103
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
104
    next03[i] = n4;);
2,976✔
105
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next03, prev02);
2,976✔
106
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next13, next03, (uint8_t)0U);
2,976✔
107
  KRML_MAYBE_FOR8(i,
2,976✔
108
    (uint32_t)0U,
2,976✔
109
    (uint32_t)8U,
2,976✔
110
    (uint32_t)1U,
2,976✔
111
    uint64_t n1 = next13[i];
2,976✔
112
    uint64_t n2 = n1 & (uint64_t)0x0f000f000f000f00U;
2,976✔
113
    uint64_t n3 = n2 ^ n2 << (uint32_t)4U;
2,976✔
114
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
115
    next13[i] = n4;);
2,976✔
116
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next13, prev12);
2,976✔
117
  uint64_t *prev03 = next03;
2,976✔
118
  uint64_t *prev13 = next13;
2,976✔
119
  uint64_t *next04 = kex + klen * (uint32_t)8U;
2,976✔
120
  uint64_t *next14 = kex + klen * (uint32_t)9U;
2,976✔
121
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next04, prev13, (uint8_t)0x08U);
2,976✔
122
  KRML_MAYBE_FOR8(i,
2,976✔
123
    (uint32_t)0U,
2,976✔
124
    (uint32_t)8U,
2,976✔
125
    (uint32_t)1U,
2,976✔
126
    uint64_t n1 = next04[i];
2,976✔
127
    uint64_t n2 = n1 & (uint64_t)0xf000f000f000f000U;
2,976✔
128
    uint64_t n3 = n2 ^ n2 >> (uint32_t)4U;
2,976✔
129
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
130
    next04[i] = n4;);
2,976✔
131
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next04, prev03);
2,976✔
132
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next14, next04, (uint8_t)0U);
2,976✔
133
  KRML_MAYBE_FOR8(i,
2,976✔
134
    (uint32_t)0U,
2,976✔
135
    (uint32_t)8U,
2,976✔
136
    (uint32_t)1U,
2,976✔
137
    uint64_t n1 = next14[i];
2,976✔
138
    uint64_t n2 = n1 & (uint64_t)0x0f000f000f000f00U;
2,976✔
139
    uint64_t n3 = n2 ^ n2 << (uint32_t)4U;
2,976✔
140
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
141
    next14[i] = n4;);
2,976✔
142
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next14, prev13);
2,976✔
143
  uint64_t *prev04 = next04;
2,976✔
144
  uint64_t *prev14 = next14;
2,976✔
145
  uint64_t *next05 = kex + klen * (uint32_t)10U;
2,976✔
146
  uint64_t *next15 = kex + klen * (uint32_t)11U;
2,976✔
147
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next05, prev14, (uint8_t)0x10U);
2,976✔
148
  KRML_MAYBE_FOR8(i,
2,976✔
149
    (uint32_t)0U,
2,976✔
150
    (uint32_t)8U,
2,976✔
151
    (uint32_t)1U,
2,976✔
152
    uint64_t n1 = next05[i];
2,976✔
153
    uint64_t n2 = n1 & (uint64_t)0xf000f000f000f000U;
2,976✔
154
    uint64_t n3 = n2 ^ n2 >> (uint32_t)4U;
2,976✔
155
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
156
    next05[i] = n4;);
2,976✔
157
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next05, prev04);
2,976✔
158
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next15, next05, (uint8_t)0U);
2,976✔
159
  KRML_MAYBE_FOR8(i,
2,976✔
160
    (uint32_t)0U,
2,976✔
161
    (uint32_t)8U,
2,976✔
162
    (uint32_t)1U,
2,976✔
163
    uint64_t n1 = next15[i];
2,976✔
164
    uint64_t n2 = n1 & (uint64_t)0x0f000f000f000f00U;
2,976✔
165
    uint64_t n3 = n2 ^ n2 << (uint32_t)4U;
2,976✔
166
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
167
    next15[i] = n4;);
2,976✔
168
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next15, prev14);
2,976✔
169
  uint64_t *prev05 = next05;
2,976✔
170
  uint64_t *prev15 = next15;
2,976✔
171
  uint64_t *next06 = kex + klen * (uint32_t)12U;
2,976✔
172
  uint64_t *next16 = kex + klen * (uint32_t)13U;
2,976✔
173
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next06, prev15, (uint8_t)0x20U);
2,976✔
174
  KRML_MAYBE_FOR8(i,
2,976✔
175
    (uint32_t)0U,
2,976✔
176
    (uint32_t)8U,
2,976✔
177
    (uint32_t)1U,
2,976✔
178
    uint64_t n1 = next06[i];
2,976✔
179
    uint64_t n2 = n1 & (uint64_t)0xf000f000f000f000U;
2,976✔
180
    uint64_t n3 = n2 ^ n2 >> (uint32_t)4U;
2,976✔
181
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
182
    next06[i] = n4;);
2,976✔
183
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next06, prev05);
2,976✔
184
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next16, next06, (uint8_t)0U);
2,976✔
185
  KRML_MAYBE_FOR8(i,
2,976✔
186
    (uint32_t)0U,
2,976✔
187
    (uint32_t)8U,
2,976✔
188
    (uint32_t)1U,
2,976✔
189
    uint64_t n1 = next16[i];
2,976✔
190
    uint64_t n2 = n1 & (uint64_t)0x0f000f000f000f00U;
2,976✔
191
    uint64_t n3 = n2 ^ n2 << (uint32_t)4U;
2,976✔
192
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
193
    next16[i] = n4;);
2,976✔
194
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next16, prev15);
2,976✔
195
  uint64_t *prev06 = next06;
2,976✔
196
  uint64_t *prev16 = next16;
2,976✔
197
  uint64_t *next07 = kex + klen * (uint32_t)14U;
2,976✔
198
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next07, prev16, (uint8_t)0x40U);
2,976✔
199
  KRML_MAYBE_FOR8(i,
2,976✔
200
    (uint32_t)0U,
2,976✔
201
    (uint32_t)8U,
2,976✔
202
    (uint32_t)1U,
2,976✔
203
    uint64_t n1 = next07[i];
2,976✔
204
    uint64_t n2 = n1 & (uint64_t)0xf000f000f000f000U;
2,976✔
205
    uint64_t n3 = n2 ^ n2 >> (uint32_t)4U;
2,976✔
206
    uint64_t n4 = n3 ^ n3 >> (uint32_t)8U;
2,976✔
207
    next07[i] = n4;);
2,976✔
208
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next07, prev06);
2,976✔
209
  Hacl_Impl_AES_CoreBitSlice_load_nonce(n, nonce);
2,976✔
210
}
2,976✔
211

212
void Hacl_AES_256_CTR32_BitSlice_aes256_set_nonce(uint64_t *ctx, uint8_t *nonce)
213
{
5,952✔
214
  uint64_t *n = ctx;
5,952✔
215
  Hacl_Impl_AES_CoreBitSlice_load_nonce(n, nonce);
5,952✔
216
}
5,952✔
217

218
void Hacl_AES_256_CTR32_BitSlice_aes256_key_block(uint8_t *kb, uint64_t *ctx, uint32_t counter)
219
{
8,928✔
220
  uint64_t *kex = ctx + (uint32_t)8U;
8,928✔
221
  uint64_t *n = ctx;
8,928✔
222
  uint64_t st[8U] = { 0U };
8,928✔
223
  Hacl_Impl_AES_CoreBitSlice_load_state(st, n, counter);
8,928✔
224
  uint32_t klen = (uint32_t)8U;
8,928✔
225
  uint64_t *k0 = kex;
8,928✔
226
  uint64_t *kr = kex + klen;
8,928✔
227
  uint64_t *kn = kex + (uint32_t)14U * klen;
8,928✔
228
  Hacl_Impl_AES_CoreBitSlice_xor_state_key1(st, k0);
8,928✔
229
  KRML_MAYBE_FOR13(i,
8,928✔
230
    (uint32_t)0U,
8,928✔
231
    (uint32_t)13U,
8,928✔
232
    (uint32_t)1U,
8,928✔
233
    uint64_t *sub_key = kr + i * (uint32_t)8U;
8,928✔
234
    Hacl_Impl_AES_CoreBitSlice_aes_enc(st, sub_key););
8,928✔
235
  Hacl_Impl_AES_CoreBitSlice_aes_enc_last(st, kn);
8,928✔
236
  Hacl_Impl_AES_CoreBitSlice_store_block0(kb, st);
8,928✔
237
}
8,928✔
238

239
void
240
Hacl_AES_256_CTR32_BitSlice_aes256_ctr(
241
  uint32_t len,
242
  uint8_t *out,
243
  uint8_t *inp,
244
  uint64_t *ctx,
245
  uint32_t c
246
)
247
{
4,278✔
248
  Hacl_Impl_AES_Generic_aes256_ctr_bitslice(len, out, inp, ctx, c);
4,278✔
249
}
4,278✔
250

251
inline void
252
Hacl_AES_256_CTR32_BitSlice_aes256_ctr_encrypt(
253
  uint32_t len,
254
  uint8_t *out,
255
  uint8_t *inp,
256
  uint8_t *k,
257
  uint8_t *n,
258
  uint32_t c
259
)
260
{
×
261
  uint64_t ctx[128U] = { 0U };
×
262
  uint64_t *kex = ctx + (uint32_t)8U;
×
263
  uint64_t *n1 = ctx;
×
264
  uint32_t klen = (uint32_t)8U;
×
265
  uint64_t *next0 = kex;
×
266
  uint64_t *next1 = kex + klen;
×
267
  Hacl_Impl_AES_CoreBitSlice_load_key1(next0, k);
×
268
  Hacl_Impl_AES_CoreBitSlice_load_key1(next1, k + (uint32_t)16U);
×
269
  uint64_t *prev0 = next0;
×
270
  uint64_t *prev1 = next1;
×
271
  uint64_t *next01 = kex + klen * (uint32_t)2U;
×
272
  uint64_t *next11 = kex + klen * (uint32_t)3U;
×
273
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next01, prev1, (uint8_t)0x01U);
×
274
  KRML_MAYBE_FOR8(i,
×
275
    (uint32_t)0U,
×
276
    (uint32_t)8U,
×
277
    (uint32_t)1U,
×
278
    uint64_t n2 = next01[i];
×
279
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
280
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
281
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
282
    next01[i] = n5;);
×
283
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next01, prev0);
×
284
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next11, next01, (uint8_t)0U);
×
285
  KRML_MAYBE_FOR8(i,
×
286
    (uint32_t)0U,
×
287
    (uint32_t)8U,
×
288
    (uint32_t)1U,
×
289
    uint64_t n2 = next11[i];
×
290
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
291
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
292
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
293
    next11[i] = n5;);
×
294
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next11, prev1);
×
295
  uint64_t *prev01 = next01;
×
296
  uint64_t *prev11 = next11;
×
297
  uint64_t *next02 = kex + klen * (uint32_t)4U;
×
298
  uint64_t *next12 = kex + klen * (uint32_t)5U;
×
299
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next02, prev11, (uint8_t)0x02U);
×
300
  KRML_MAYBE_FOR8(i,
×
301
    (uint32_t)0U,
×
302
    (uint32_t)8U,
×
303
    (uint32_t)1U,
×
304
    uint64_t n2 = next02[i];
×
305
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
306
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
307
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
308
    next02[i] = n5;);
×
309
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next02, prev01);
×
310
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next12, next02, (uint8_t)0U);
×
311
  KRML_MAYBE_FOR8(i,
×
312
    (uint32_t)0U,
×
313
    (uint32_t)8U,
×
314
    (uint32_t)1U,
×
315
    uint64_t n2 = next12[i];
×
316
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
317
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
318
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
319
    next12[i] = n5;);
×
320
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next12, prev11);
×
321
  uint64_t *prev02 = next02;
×
322
  uint64_t *prev12 = next12;
×
323
  uint64_t *next03 = kex + klen * (uint32_t)6U;
×
324
  uint64_t *next13 = kex + klen * (uint32_t)7U;
×
325
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next03, prev12, (uint8_t)0x04U);
×
326
  KRML_MAYBE_FOR8(i,
×
327
    (uint32_t)0U,
×
328
    (uint32_t)8U,
×
329
    (uint32_t)1U,
×
330
    uint64_t n2 = next03[i];
×
331
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
332
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
333
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
334
    next03[i] = n5;);
×
335
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next03, prev02);
×
336
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next13, next03, (uint8_t)0U);
×
337
  KRML_MAYBE_FOR8(i,
×
338
    (uint32_t)0U,
×
339
    (uint32_t)8U,
×
340
    (uint32_t)1U,
×
341
    uint64_t n2 = next13[i];
×
342
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
343
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
344
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
345
    next13[i] = n5;);
×
346
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next13, prev12);
×
347
  uint64_t *prev03 = next03;
×
348
  uint64_t *prev13 = next13;
×
349
  uint64_t *next04 = kex + klen * (uint32_t)8U;
×
350
  uint64_t *next14 = kex + klen * (uint32_t)9U;
×
351
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next04, prev13, (uint8_t)0x08U);
×
352
  KRML_MAYBE_FOR8(i,
×
353
    (uint32_t)0U,
×
354
    (uint32_t)8U,
×
355
    (uint32_t)1U,
×
356
    uint64_t n2 = next04[i];
×
357
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
358
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
359
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
360
    next04[i] = n5;);
×
361
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next04, prev03);
×
362
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next14, next04, (uint8_t)0U);
×
363
  KRML_MAYBE_FOR8(i,
×
364
    (uint32_t)0U,
×
365
    (uint32_t)8U,
×
366
    (uint32_t)1U,
×
367
    uint64_t n2 = next14[i];
×
368
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
369
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
370
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
371
    next14[i] = n5;);
×
372
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next14, prev13);
×
373
  uint64_t *prev04 = next04;
×
374
  uint64_t *prev14 = next14;
×
375
  uint64_t *next05 = kex + klen * (uint32_t)10U;
×
376
  uint64_t *next15 = kex + klen * (uint32_t)11U;
×
377
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next05, prev14, (uint8_t)0x10U);
×
378
  KRML_MAYBE_FOR8(i,
×
379
    (uint32_t)0U,
×
380
    (uint32_t)8U,
×
381
    (uint32_t)1U,
×
382
    uint64_t n2 = next05[i];
×
383
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
384
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
385
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
386
    next05[i] = n5;);
×
387
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next05, prev04);
×
388
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next15, next05, (uint8_t)0U);
×
389
  KRML_MAYBE_FOR8(i,
×
390
    (uint32_t)0U,
×
391
    (uint32_t)8U,
×
392
    (uint32_t)1U,
×
393
    uint64_t n2 = next15[i];
×
394
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
395
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
396
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
397
    next15[i] = n5;);
×
398
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next15, prev14);
×
399
  uint64_t *prev05 = next05;
×
400
  uint64_t *prev15 = next15;
×
401
  uint64_t *next06 = kex + klen * (uint32_t)12U;
×
402
  uint64_t *next16 = kex + klen * (uint32_t)13U;
×
403
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next06, prev15, (uint8_t)0x20U);
×
404
  KRML_MAYBE_FOR8(i,
×
405
    (uint32_t)0U,
×
406
    (uint32_t)8U,
×
407
    (uint32_t)1U,
×
408
    uint64_t n2 = next06[i];
×
409
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
410
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
411
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
412
    next06[i] = n5;);
×
413
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next06, prev05);
×
414
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next16, next06, (uint8_t)0U);
×
415
  KRML_MAYBE_FOR8(i,
×
416
    (uint32_t)0U,
×
417
    (uint32_t)8U,
×
418
    (uint32_t)1U,
×
419
    uint64_t n2 = next16[i];
×
420
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
421
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
422
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
423
    next16[i] = n5;);
×
424
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next16, prev15);
×
425
  uint64_t *prev06 = next06;
×
426
  uint64_t *prev16 = next16;
×
427
  uint64_t *next07 = kex + klen * (uint32_t)14U;
×
428
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next07, prev16, (uint8_t)0x40U);
×
429
  KRML_MAYBE_FOR8(i,
×
430
    (uint32_t)0U,
×
431
    (uint32_t)8U,
×
432
    (uint32_t)1U,
×
433
    uint64_t n2 = next07[i];
×
434
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
435
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
436
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
437
    next07[i] = n5;);
×
438
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next07, prev06);
×
439
  Hacl_Impl_AES_CoreBitSlice_load_nonce(n1, n);
×
440
  Hacl_Impl_AES_Generic_aes256_ctr_bitslice(len, out, inp, ctx, c);
×
441
}
×
442

443
inline void
444
Hacl_AES_256_CTR32_BitSlice_aes256_ctr_decrypt(
445
  uint32_t len,
446
  uint8_t *out,
447
  uint8_t *inp,
448
  uint8_t *k,
449
  uint8_t *n,
450
  uint32_t c
451
)
452
{
×
453
  uint64_t ctx[128U] = { 0U };
×
454
  uint64_t *kex = ctx + (uint32_t)8U;
×
455
  uint64_t *n1 = ctx;
×
456
  uint32_t klen = (uint32_t)8U;
×
457
  uint64_t *next0 = kex;
×
458
  uint64_t *next1 = kex + klen;
×
459
  Hacl_Impl_AES_CoreBitSlice_load_key1(next0, k);
×
460
  Hacl_Impl_AES_CoreBitSlice_load_key1(next1, k + (uint32_t)16U);
×
461
  uint64_t *prev0 = next0;
×
462
  uint64_t *prev1 = next1;
×
463
  uint64_t *next01 = kex + klen * (uint32_t)2U;
×
464
  uint64_t *next11 = kex + klen * (uint32_t)3U;
×
465
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next01, prev1, (uint8_t)0x01U);
×
466
  KRML_MAYBE_FOR8(i,
×
467
    (uint32_t)0U,
×
468
    (uint32_t)8U,
×
469
    (uint32_t)1U,
×
470
    uint64_t n2 = next01[i];
×
471
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
472
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
473
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
474
    next01[i] = n5;);
×
475
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next01, prev0);
×
476
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next11, next01, (uint8_t)0U);
×
477
  KRML_MAYBE_FOR8(i,
×
478
    (uint32_t)0U,
×
479
    (uint32_t)8U,
×
480
    (uint32_t)1U,
×
481
    uint64_t n2 = next11[i];
×
482
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
483
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
484
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
485
    next11[i] = n5;);
×
486
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next11, prev1);
×
487
  uint64_t *prev01 = next01;
×
488
  uint64_t *prev11 = next11;
×
489
  uint64_t *next02 = kex + klen * (uint32_t)4U;
×
490
  uint64_t *next12 = kex + klen * (uint32_t)5U;
×
491
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next02, prev11, (uint8_t)0x02U);
×
492
  KRML_MAYBE_FOR8(i,
×
493
    (uint32_t)0U,
×
494
    (uint32_t)8U,
×
495
    (uint32_t)1U,
×
496
    uint64_t n2 = next02[i];
×
497
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
498
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
499
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
500
    next02[i] = n5;);
×
501
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next02, prev01);
×
502
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next12, next02, (uint8_t)0U);
×
503
  KRML_MAYBE_FOR8(i,
×
504
    (uint32_t)0U,
×
505
    (uint32_t)8U,
×
506
    (uint32_t)1U,
×
507
    uint64_t n2 = next12[i];
×
508
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
509
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
510
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
511
    next12[i] = n5;);
×
512
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next12, prev11);
×
513
  uint64_t *prev02 = next02;
×
514
  uint64_t *prev12 = next12;
×
515
  uint64_t *next03 = kex + klen * (uint32_t)6U;
×
516
  uint64_t *next13 = kex + klen * (uint32_t)7U;
×
517
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next03, prev12, (uint8_t)0x04U);
×
518
  KRML_MAYBE_FOR8(i,
×
519
    (uint32_t)0U,
×
520
    (uint32_t)8U,
×
521
    (uint32_t)1U,
×
522
    uint64_t n2 = next03[i];
×
523
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
524
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
525
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
526
    next03[i] = n5;);
×
527
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next03, prev02);
×
528
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next13, next03, (uint8_t)0U);
×
529
  KRML_MAYBE_FOR8(i,
×
530
    (uint32_t)0U,
×
531
    (uint32_t)8U,
×
532
    (uint32_t)1U,
×
533
    uint64_t n2 = next13[i];
×
534
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
535
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
536
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
537
    next13[i] = n5;);
×
538
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next13, prev12);
×
539
  uint64_t *prev03 = next03;
×
540
  uint64_t *prev13 = next13;
×
541
  uint64_t *next04 = kex + klen * (uint32_t)8U;
×
542
  uint64_t *next14 = kex + klen * (uint32_t)9U;
×
543
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next04, prev13, (uint8_t)0x08U);
×
544
  KRML_MAYBE_FOR8(i,
×
545
    (uint32_t)0U,
×
546
    (uint32_t)8U,
×
547
    (uint32_t)1U,
×
548
    uint64_t n2 = next04[i];
×
549
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
550
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
551
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
552
    next04[i] = n5;);
×
553
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next04, prev03);
×
554
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next14, next04, (uint8_t)0U);
×
555
  KRML_MAYBE_FOR8(i,
×
556
    (uint32_t)0U,
×
557
    (uint32_t)8U,
×
558
    (uint32_t)1U,
×
559
    uint64_t n2 = next14[i];
×
560
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
561
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
562
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
563
    next14[i] = n5;);
×
564
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next14, prev13);
×
565
  uint64_t *prev04 = next04;
×
566
  uint64_t *prev14 = next14;
×
567
  uint64_t *next05 = kex + klen * (uint32_t)10U;
×
568
  uint64_t *next15 = kex + klen * (uint32_t)11U;
×
569
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next05, prev14, (uint8_t)0x10U);
×
570
  KRML_MAYBE_FOR8(i,
×
571
    (uint32_t)0U,
×
572
    (uint32_t)8U,
×
573
    (uint32_t)1U,
×
574
    uint64_t n2 = next05[i];
×
575
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
576
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
577
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
578
    next05[i] = n5;);
×
579
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next05, prev04);
×
580
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next15, next05, (uint8_t)0U);
×
581
  KRML_MAYBE_FOR8(i,
×
582
    (uint32_t)0U,
×
583
    (uint32_t)8U,
×
584
    (uint32_t)1U,
×
585
    uint64_t n2 = next15[i];
×
586
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
587
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
588
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
589
    next15[i] = n5;);
×
590
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next15, prev14);
×
591
  uint64_t *prev05 = next05;
×
592
  uint64_t *prev15 = next15;
×
593
  uint64_t *next06 = kex + klen * (uint32_t)12U;
×
594
  uint64_t *next16 = kex + klen * (uint32_t)13U;
×
595
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next06, prev15, (uint8_t)0x20U);
×
596
  KRML_MAYBE_FOR8(i,
×
597
    (uint32_t)0U,
×
598
    (uint32_t)8U,
×
599
    (uint32_t)1U,
×
600
    uint64_t n2 = next06[i];
×
601
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
602
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
603
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
604
    next06[i] = n5;);
×
605
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next06, prev05);
×
606
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next16, next06, (uint8_t)0U);
×
607
  KRML_MAYBE_FOR8(i,
×
608
    (uint32_t)0U,
×
609
    (uint32_t)8U,
×
610
    (uint32_t)1U,
×
611
    uint64_t n2 = next16[i];
×
612
    uint64_t n3 = n2 & (uint64_t)0x0f000f000f000f00U;
×
613
    uint64_t n4 = n3 ^ n3 << (uint32_t)4U;
×
614
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
615
    next16[i] = n5;);
×
616
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next16, prev15);
×
617
  uint64_t *prev06 = next06;
×
618
  uint64_t *prev16 = next16;
×
619
  uint64_t *next07 = kex + klen * (uint32_t)14U;
×
620
  Hacl_Impl_AES_CoreBitSlice_aes_keygen_assist(next07, prev16, (uint8_t)0x40U);
×
621
  KRML_MAYBE_FOR8(i,
×
622
    (uint32_t)0U,
×
623
    (uint32_t)8U,
×
624
    (uint32_t)1U,
×
625
    uint64_t n2 = next07[i];
×
626
    uint64_t n3 = n2 & (uint64_t)0xf000f000f000f000U;
×
627
    uint64_t n4 = n3 ^ n3 >> (uint32_t)4U;
×
628
    uint64_t n5 = n4 ^ n4 >> (uint32_t)8U;
×
629
    next07[i] = n5;);
×
630
  Hacl_Impl_AES_CoreBitSlice_key_expansion_step(next07, prev06);
×
631
  Hacl_Impl_AES_CoreBitSlice_load_nonce(n1, n);
×
632
  Hacl_Impl_AES_Generic_aes256_ctr_bitslice(len, out, inp, ctx, c);
×
633
}
×
634

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc