diff options
author | Jonathan Protzenko <protz@microsoft.com> | 2023-05-24 20:30:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-24 20:30:11 (GMT) |
commit | 160321e5304b962a162eb023472aa2bc8307ae15 (patch) | |
tree | c56d1ac86dd607f16dcc2acb411240964bad9a7e /Modules/_hacl/internal | |
parent | fe77a99fc8b549a8bf9ccbc5485fe5ea9bcf47b9 (diff) | |
download | cpython-160321e5304b962a162eb023472aa2bc8307ae15.zip cpython-160321e5304b962a162eb023472aa2bc8307ae15.tar.gz cpython-160321e5304b962a162eb023472aa2bc8307ae15.tar.bz2 |
gh-99108: Refresh HACL* (#104808)
Refresh HACL* from upstream to improve SHA2 performance and fix a 32-bit issue in SHA3.
Diffstat (limited to 'Modules/_hacl/internal')
-rw-r--r-- | Modules/_hacl/internal/Hacl_Hash_SHA2.h (renamed from Modules/_hacl/internal/Hacl_SHA2_Generic.h) | 58 |
1 files changed, 55 insertions, 3 deletions
diff --git a/Modules/_hacl/internal/Hacl_SHA2_Generic.h b/Modules/_hacl/internal/Hacl_Hash_SHA2.h index 6ac47f3..851f7dc 100644 --- a/Modules/_hacl/internal/Hacl_SHA2_Generic.h +++ b/Modules/_hacl/internal/Hacl_Hash_SHA2.h @@ -23,8 +23,8 @@ */ -#ifndef __internal_Hacl_SHA2_Generic_H -#define __internal_Hacl_SHA2_Generic_H +#ifndef __internal_Hacl_Hash_SHA2_H +#define __internal_Hacl_Hash_SHA2_H #if defined(__cplusplus) extern "C" { @@ -35,6 +35,9 @@ extern "C" { #include "krml/lowstar_endianness.h" #include "krml/internal/target.h" + +#include "../Hacl_Hash_SHA2.h" + static const uint32_t Hacl_Impl_SHA2_Generic_h224[8U] = @@ -124,9 +127,58 @@ Hacl_Impl_SHA2_Generic_k384_512[80U] = (uint64_t)0x5fcb6fab3ad6faecU, (uint64_t)0x6c44198c4a475817U }; +void Hacl_SHA2_Scalar32_sha256_init(uint32_t *hash); + +void Hacl_SHA2_Scalar32_sha256_update_nblocks(uint32_t len, uint8_t *b, uint32_t *st); + +void +Hacl_SHA2_Scalar32_sha256_update_last( + uint64_t totlen, + uint32_t len, + uint8_t *b, + uint32_t *hash +); + +void Hacl_SHA2_Scalar32_sha256_finish(uint32_t *st, uint8_t *h); + +void Hacl_SHA2_Scalar32_sha224_init(uint32_t *hash); + +void +Hacl_SHA2_Scalar32_sha224_update_last(uint64_t totlen, uint32_t len, uint8_t *b, uint32_t *st); + +void Hacl_SHA2_Scalar32_sha224_finish(uint32_t *st, uint8_t *h); + +void Hacl_SHA2_Scalar32_sha512_init(uint64_t *hash); + +void Hacl_SHA2_Scalar32_sha512_update_nblocks(uint32_t len, uint8_t *b, uint64_t *st); + +void +Hacl_SHA2_Scalar32_sha512_update_last( + FStar_UInt128_uint128 totlen, + uint32_t len, + uint8_t *b, + uint64_t *hash +); + +void Hacl_SHA2_Scalar32_sha512_finish(uint64_t *st, uint8_t *h); + +void Hacl_SHA2_Scalar32_sha384_init(uint64_t *hash); + +void Hacl_SHA2_Scalar32_sha384_update_nblocks(uint32_t len, uint8_t *b, uint64_t *st); + +void +Hacl_SHA2_Scalar32_sha384_update_last( + FStar_UInt128_uint128 totlen, + uint32_t len, + uint8_t *b, + uint64_t *st +); + +void Hacl_SHA2_Scalar32_sha384_finish(uint64_t *st, uint8_t *h); + #if defined(__cplusplus) } #endif -#define __internal_Hacl_SHA2_Generic_H_DEFINED +#define __internal_Hacl_Hash_SHA2_H_DEFINED #endif |