Debian Codegraph @

Modules/_hacl/internal/Hacl_Hash_Blake2s_Simd128.h

raw
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 #ifndef internal_Hacl_Hash_Blake2s_Simd128_H
27 #define internal_Hacl_Hash_Blake2s_Simd128_H
28
29 #if defined(__cplusplus)
30 extern "C" {
31 #endif
32
33 #include <string.h>
34 #include "krml/internal/types.h"
35 #include "krml/lowstar_endianness.h"
36 #include "krml/internal/target.h"
37
38 #include "../Hacl_Hash_Blake2s_Simd128.h"
39 #include "libintvector.h"
40
41 void
42 Hacl_Hash_Blake2s_Simd128_init(Lib_IntVector_Intrinsics_vec128 *hash, uint32_t kk, uint32_t nn);
43
44 void
45 Hacl_Hash_Blake2s_Simd128_update_multi(
46 uint32_t len,
47 Lib_IntVector_Intrinsics_vec128 *wv,
48 Lib_IntVector_Intrinsics_vec128 *hash,
49 uint64_t prev,
50 uint8_t *blocks,
51 uint32_t nb
52 );
53
54 void
55 Hacl_Hash_Blake2s_Simd128_update_last(
56 uint32_t len,
57 Lib_IntVector_Intrinsics_vec128 *wv,
58 Lib_IntVector_Intrinsics_vec128 *hash,
59 bool last_node,
60 uint64_t prev,
61 uint32_t rem,
62 uint8_t *d
63 );
64
65 void
66 Hacl_Hash_Blake2s_Simd128_finish(
67 uint32_t nn,
68 uint8_t *output,
69 Lib_IntVector_Intrinsics_vec128 *hash
70 );
71
72 void
73 Hacl_Hash_Blake2s_Simd128_store_state128s_to_state32(
74 uint32_t *st32,
75 Lib_IntVector_Intrinsics_vec128 *st
76 );
77
78 void
79 Hacl_Hash_Blake2s_Simd128_load_state128s_from_state32(
80 Lib_IntVector_Intrinsics_vec128 *st,
81 uint32_t *st32
82 );
83
84 Lib_IntVector_Intrinsics_vec128
85 *Hacl_Hash_Blake2s_Simd128_malloc_internal_state_with_key(void);
86
87 void
88 Hacl_Hash_Blake2s_Simd128_update_multi_no_inline(
89 Lib_IntVector_Intrinsics_vec128 *s,
90 uint64_t ev,
91 uint8_t *blocks,
92 uint32_t n
93 );
94
95 void
96 Hacl_Hash_Blake2s_Simd128_update_last_no_inline(
97 Lib_IntVector_Intrinsics_vec128 *s,
98 uint64_t prev,
99 uint8_t *input,
100 uint32_t input_len
101 );
102
103 void
104 Hacl_Hash_Blake2s_Simd128_copy_internal_state(
105 Lib_IntVector_Intrinsics_vec128 *src,
106 Lib_IntVector_Intrinsics_vec128 *dst
107 );
108
109 typedef struct Hacl_Hash_Blake2s_Simd128_two_2s_128_s
110 {
111 Lib_IntVector_Intrinsics_vec128 *fst;
112 Lib_IntVector_Intrinsics_vec128 *snd;
113 }
114 Hacl_Hash_Blake2s_Simd128_two_2s_128;
115
116 typedef struct Hacl_Hash_Blake2s_Simd128_block_state_t_s
117 {
118 uint8_t fst;
119 uint8_t snd;
120 bool thd;
121 Hacl_Hash_Blake2s_Simd128_two_2s_128 f3;
122 }
123 Hacl_Hash_Blake2s_Simd128_block_state_t;
124
125 typedef struct Hacl_Hash_Blake2s_Simd128_state_t_s
126 {
127 Hacl_Hash_Blake2s_Simd128_block_state_t block_state;
128 uint8_t *buf;
129 uint64_t total_len;
130 }
131 Hacl_Hash_Blake2s_Simd128_state_t;
132
133 #if defined(__cplusplus)
134 }
135 #endif
136
137 #define internal_Hacl_Hash_Blake2s_Simd128_H_DEFINED
138 #endif /* internal_Hacl_Hash_Blake2s_Simd128_H */