• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 __Hacl_Streaming_Types_H
27 #define __Hacl_Streaming_Types_H
28 
29 #if defined(__cplusplus)
30 extern "C" {
31 #endif
32 
33 #include <string.h>
34 #include "krml/types.h"
35 #include "krml/lowstar_endianness.h"
36 #include "krml/internal/target.h"
37 
38 #define Spec_Hash_Definitions_SHA2_224 0
39 #define Spec_Hash_Definitions_SHA2_256 1
40 #define Spec_Hash_Definitions_SHA2_384 2
41 #define Spec_Hash_Definitions_SHA2_512 3
42 #define Spec_Hash_Definitions_SHA1 4
43 #define Spec_Hash_Definitions_MD5 5
44 #define Spec_Hash_Definitions_Blake2S 6
45 #define Spec_Hash_Definitions_Blake2B 7
46 #define Spec_Hash_Definitions_SHA3_256 8
47 #define Spec_Hash_Definitions_SHA3_224 9
48 #define Spec_Hash_Definitions_SHA3_384 10
49 #define Spec_Hash_Definitions_SHA3_512 11
50 #define Spec_Hash_Definitions_Shake128 12
51 #define Spec_Hash_Definitions_Shake256 13
52 
53 typedef uint8_t Spec_Hash_Definitions_hash_alg;
54 
55 #define Hacl_Streaming_Types_Success 0
56 #define Hacl_Streaming_Types_InvalidAlgorithm 1
57 #define Hacl_Streaming_Types_InvalidLength 2
58 #define Hacl_Streaming_Types_MaximumLengthExceeded 3
59 
60 typedef uint8_t Hacl_Streaming_Types_error_code;
61 
62 typedef struct Hacl_Streaming_MD_state_32_s
63 {
64   uint32_t *block_state;
65   uint8_t *buf;
66   uint64_t total_len;
67 }
68 Hacl_Streaming_MD_state_32;
69 
70 typedef struct Hacl_Streaming_MD_state_64_s
71 {
72   uint64_t *block_state;
73   uint8_t *buf;
74   uint64_t total_len;
75 }
76 Hacl_Streaming_MD_state_64;
77 
78 #if defined(__cplusplus)
79 }
80 #endif
81 
82 #define __Hacl_Streaming_Types_H_DEFINED
83 #endif
84