| 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_Streaming_HMAC_H |
| 27 |
#define internal_Hacl_Streaming_HMAC_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_Streaming_HMAC.h" |
| 39 |
#include "libintvector-shim.h" |
| 40 |
|
| 41 |
#define Hacl_Agile_Hash_MD5_a 0 |
| 42 |
#define Hacl_Agile_Hash_SHA1_a 1 |
| 43 |
#define Hacl_Agile_Hash_SHA2_224_a 2 |
| 44 |
#define Hacl_Agile_Hash_SHA2_256_a 3 |
| 45 |
#define Hacl_Agile_Hash_SHA2_384_a 4 |
| 46 |
#define Hacl_Agile_Hash_SHA2_512_a 5 |
| 47 |
#define Hacl_Agile_Hash_SHA3_224_a 6 |
| 48 |
#define Hacl_Agile_Hash_SHA3_256_a 7 |
| 49 |
#define Hacl_Agile_Hash_SHA3_384_a 8 |
| 50 |
#define Hacl_Agile_Hash_SHA3_512_a 9 |
| 51 |
#define Hacl_Agile_Hash_Blake2S_a 10 |
| 52 |
#define Hacl_Agile_Hash_Blake2S_128_a 11 |
| 53 |
#define Hacl_Agile_Hash_Blake2B_a 12 |
| 54 |
#define Hacl_Agile_Hash_Blake2B_256_a 13 |
| 55 |
|
| 56 |
typedef uint8_t Hacl_Agile_Hash_state_s_tags; |
| 57 |
|
| 58 |
typedef struct Hacl_Agile_Hash_state_s_s |
| 59 |
{ |
| 60 |
Hacl_Agile_Hash_state_s_tags tag; |
| 61 |
union { |
| 62 |
uint32_t *case_MD5_a; |
| 63 |
uint32_t *case_SHA1_a; |
| 64 |
uint32_t *case_SHA2_224_a; |
| 65 |
uint32_t *case_SHA2_256_a; |
| 66 |
uint64_t *case_SHA2_384_a; |
| 67 |
uint64_t *case_SHA2_512_a; |
| 68 |
uint64_t *case_SHA3_224_a; |
| 69 |
uint64_t *case_SHA3_256_a; |
| 70 |
uint64_t *case_SHA3_384_a; |
| 71 |
uint64_t *case_SHA3_512_a; |
| 72 |
uint32_t *case_Blake2S_a; |
| 73 |
Lib_IntVector_Intrinsics_vec128 *case_Blake2S_128_a; |
| 74 |
uint64_t *case_Blake2B_a; |
| 75 |
Lib_IntVector_Intrinsics_vec256 *case_Blake2B_256_a; |
| 76 |
} |
| 77 |
; |
| 78 |
} |
| 79 |
Hacl_Agile_Hash_state_s; |
| 80 |
|
| 81 |
typedef struct Hacl_Streaming_HMAC_agile_state_s |
| 82 |
{ |
| 83 |
Hacl_Streaming_HMAC_Definitions_two_state block_state; |
| 84 |
uint8_t *buf; |
| 85 |
uint64_t total_len; |
| 86 |
} |
| 87 |
Hacl_Streaming_HMAC_agile_state; |
| 88 |
|
| 89 |
#if defined(__cplusplus) |
| 90 |
} |
| 91 |
#endif |
| 92 |
|
| 93 |
#define internal_Hacl_Streaming_HMAC_H_DEFINED |
| 94 |
#endif /* internal_Hacl_Streaming_HMAC_H */ |