Debian Codegraph @

Modules/_hacl/internal/Hacl_Hash_Blake2s.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_H
27 #define internal_Hacl_Hash_Blake2s_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.h"
39
40 void Hacl_Hash_Blake2s_init(uint32_t *hash, uint32_t kk, uint32_t nn);
41
42 void
43 Hacl_Hash_Blake2s_update_multi(
44 uint32_t len,
45 uint32_t *wv,
46 uint32_t *hash,
47 uint64_t prev,
48 uint8_t *blocks,
49 uint32_t nb
50 );
51
52 void
53 Hacl_Hash_Blake2s_update_last(
54 uint32_t len,
55 uint32_t *wv,
56 uint32_t *hash,
57 bool last_node,
58 uint64_t prev,
59 uint32_t rem,
60 uint8_t *d
61 );
62
63 void Hacl_Hash_Blake2s_finish(uint32_t nn, uint8_t *output, uint32_t *hash);
64
65 typedef struct K____uint32_t___uint32_t__s
66 {
67 uint32_t *fst;
68 uint32_t *snd;
69 }
70 K____uint32_t___uint32_t_;
71
72 typedef struct Hacl_Hash_Blake2s_block_state_t_s
73 {
74 uint8_t fst;
75 uint8_t snd;
76 bool thd;
77 K____uint32_t___uint32_t_ f3;
78 }
79 Hacl_Hash_Blake2s_block_state_t;
80
81 typedef struct Hacl_Hash_Blake2s_state_t_s
82 {
83 Hacl_Hash_Blake2s_block_state_t block_state;
84 uint8_t *buf;
85 uint64_t total_len;
86 }
87 Hacl_Hash_Blake2s_state_t;
88
89 #if defined(__cplusplus)
90 }
91 #endif
92
93 #define internal_Hacl_Hash_Blake2s_H_DEFINED
94 #endif /* internal_Hacl_Hash_Blake2s_H */