Skip to content

Commit 99199fc

Browse files
committed
Update Python inlined files: 3.12.7 (4.6.3)
1 parent 6403dc4 commit 99199fc

File tree

15 files changed

+2321
-26
lines changed

15 files changed

+2321
-26
lines changed

graalpython/com.oracle.graal.python.cext/modules/_hacl/Hacl_Hash_SHA3.c

Lines changed: 734 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
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_Hash_SHA3_H
27+
#define __Hacl_Hash_SHA3_H
28+
29+
#if defined(__cplusplus)
30+
extern "C" {
31+
#endif
32+
33+
#include <string.h>
34+
#include "python_hacl_namespaces.h"
35+
#include "krml/types.h"
36+
#include "krml/lowstar_endianness.h"
37+
#include "krml/internal/target.h"
38+
39+
#include "Hacl_Streaming_Types.h"
40+
41+
typedef struct Hacl_Hash_SHA3_hash_buf_s
42+
{
43+
Spec_Hash_Definitions_hash_alg fst;
44+
uint64_t *snd;
45+
}
46+
Hacl_Hash_SHA3_hash_buf;
47+
48+
typedef struct Hacl_Hash_SHA3_state_t_s
49+
{
50+
Hacl_Hash_SHA3_hash_buf block_state;
51+
uint8_t *buf;
52+
uint64_t total_len;
53+
}
54+
Hacl_Hash_SHA3_state_t;
55+
56+
Spec_Hash_Definitions_hash_alg Hacl_Hash_SHA3_get_alg(Hacl_Hash_SHA3_state_t *s);
57+
58+
Hacl_Hash_SHA3_state_t *Hacl_Hash_SHA3_malloc(Spec_Hash_Definitions_hash_alg a);
59+
60+
void Hacl_Hash_SHA3_free(Hacl_Hash_SHA3_state_t *state);
61+
62+
Hacl_Hash_SHA3_state_t *Hacl_Hash_SHA3_copy(Hacl_Hash_SHA3_state_t *state);
63+
64+
void Hacl_Hash_SHA3_reset(Hacl_Hash_SHA3_state_t *state);
65+
66+
Hacl_Streaming_Types_error_code
67+
Hacl_Hash_SHA3_update(Hacl_Hash_SHA3_state_t *state, uint8_t *chunk, uint32_t chunk_len);
68+
69+
Hacl_Streaming_Types_error_code
70+
Hacl_Hash_SHA3_digest(Hacl_Hash_SHA3_state_t *state, uint8_t *output);
71+
72+
Hacl_Streaming_Types_error_code
73+
Hacl_Hash_SHA3_squeeze(Hacl_Hash_SHA3_state_t *s, uint8_t *dst, uint32_t l);
74+
75+
uint32_t Hacl_Hash_SHA3_block_len(Hacl_Hash_SHA3_state_t *s);
76+
77+
uint32_t Hacl_Hash_SHA3_hash_len(Hacl_Hash_SHA3_state_t *s);
78+
79+
bool Hacl_Hash_SHA3_is_shake(Hacl_Hash_SHA3_state_t *s);
80+
81+
void
82+
Hacl_Hash_SHA3_shake128_hacl(
83+
uint32_t inputByteLen,
84+
uint8_t *input,
85+
uint32_t outputByteLen,
86+
uint8_t *output
87+
);
88+
89+
void
90+
Hacl_Hash_SHA3_shake256_hacl(
91+
uint32_t inputByteLen,
92+
uint8_t *input,
93+
uint32_t outputByteLen,
94+
uint8_t *output
95+
);
96+
97+
void Hacl_Hash_SHA3_sha3_224(uint8_t *output, uint8_t *input, uint32_t input_len);
98+
99+
void Hacl_Hash_SHA3_sha3_256(uint8_t *output, uint8_t *input, uint32_t input_len);
100+
101+
void Hacl_Hash_SHA3_sha3_384(uint8_t *output, uint8_t *input, uint32_t input_len);
102+
103+
void Hacl_Hash_SHA3_sha3_512(uint8_t *output, uint8_t *input, uint32_t input_len);
104+
105+
void Hacl_Hash_SHA3_absorb_inner(uint32_t rateInBytes, uint8_t *block, uint64_t *s);
106+
107+
void
108+
Hacl_Hash_SHA3_squeeze0(
109+
uint64_t *s,
110+
uint32_t rateInBytes,
111+
uint32_t outputByteLen,
112+
uint8_t *output
113+
);
114+
115+
void
116+
Hacl_Hash_SHA3_keccak(
117+
uint32_t rate,
118+
uint32_t capacity,
119+
uint32_t inputByteLen,
120+
uint8_t *input,
121+
uint8_t delimitedSuffix,
122+
uint32_t outputByteLen,
123+
uint8_t *output
124+
);
125+
126+
#if defined(__cplusplus)
127+
}
128+
#endif
129+
130+
#define __Hacl_Hash_SHA3_H_DEFINED
131+
#endif
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
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

0 commit comments

Comments
 (0)