Debian Codegraph @

Modules/_hacl/internal/Hacl_Hash_Blake2b.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_Blake2b_H
27 #define internal_Hacl_Hash_Blake2b_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 "internal/Hacl_Streaming_Types.h"
39 #include "../Hacl_Hash_Blake2b.h"
40
41 typedef struct Hacl_Hash_Blake2b_params_and_key_s
42 {
43 Hacl_Hash_Blake2b_blake2_params *fst;
44 uint8_t *snd;
45 }
46 Hacl_Hash_Blake2b_params_and_key;
47
48 void Hacl_Hash_Blake2b_init(uint64_t *hash, uint32_t kk, uint32_t nn);
49
50 void
51 Hacl_Hash_Blake2b_update_multi(
52 uint32_t len,
53 uint64_t *wv,
54 uint64_t *hash,
55 FStar_UInt128_uint128 prev,
56 uint8_t *blocks,
57 uint32_t nb
58 );
59
60 void
61 Hacl_Hash_Blake2b_update_last(
62 uint32_t len,
63 uint64_t *wv,
64 uint64_t *hash,
65 bool last_node,
66 FStar_UInt128_uint128 prev,
67 uint32_t rem,
68 uint8_t *d
69 );
70
71 void Hacl_Hash_Blake2b_finish(uint32_t nn, uint8_t *output, uint64_t *hash);
72
73 typedef struct Hacl_Hash_Blake2b_block_state_t_s
74 {
75 uint8_t fst;
76 uint8_t snd;
77 bool thd;
78 Hacl_Streaming_Types_two_pointers f3;
79 }
80 Hacl_Hash_Blake2b_block_state_t;
81
82 typedef struct Hacl_Hash_Blake2b_state_t_s
83 {
84 Hacl_Hash_Blake2b_block_state_t block_state;
85 uint8_t *buf;
86 uint64_t total_len;
87 }
88 Hacl_Hash_Blake2b_state_t;
89
90 #if defined(__cplusplus)
91 }
92 #endif
93
94 #define internal_Hacl_Hash_Blake2b_H_DEFINED
95 #endif /* internal_Hacl_Hash_Blake2b_H */