summaryrefslogtreecommitdiffstats
path: root/Modules/_hacl/refresh.sh
diff options
context:
space:
mode:
authorJonathan Protzenko <protz@microsoft.com>2023-05-08 03:50:04 (GMT)
committerGitHub <noreply@github.com>2023-05-08 03:50:04 (GMT)
commit15665d896bae9c3d8b60bd7210ac1b7dc533b093 (patch)
tree828d0c447265d301089c91aec0803cf67a51e4f8 /Modules/_hacl/refresh.sh
parent01cc9c1ff79bf18fe34c05c6cd573e79ff9487c3 (diff)
downloadcpython-15665d896bae9c3d8b60bd7210ac1b7dc533b093.zip
cpython-15665d896bae9c3d8b60bd7210ac1b7dc533b093.tar.gz
cpython-15665d896bae9c3d8b60bd7210ac1b7dc533b093.tar.bz2
gh-99108: Replace SHA3 implementation HACL* version (#103597)
Replaces our built-in SHA3 implementation with a verified one from the HACL* project. This implementation is used when OpenSSL does not provide SHA3 or is not present. 3.11 shiped with a very slow tiny sha3 implementation to get off of the <=3.10 reference implementation that wound up having serious bugs. This brings us back to a reasonably performing built-in implementation consistent with what we've just replaced our other guaranteed available standard hash algorithms with: code from the HACL* project. --------- Co-authored-by: Gregory P. Smith <greg@krypto.org>
Diffstat (limited to 'Modules/_hacl/refresh.sh')
-rwxr-xr-xModules/_hacl/refresh.sh11
1 files changed, 7 insertions, 4 deletions
diff --git a/Modules/_hacl/refresh.sh b/Modules/_hacl/refresh.sh
index 76b92ec..220ebbe 100755
--- a/Modules/_hacl/refresh.sh
+++ b/Modules/_hacl/refresh.sh
@@ -22,7 +22,7 @@ fi
# Update this when updating to a new version after verifying that the changes
# the update brings in are good.
-expected_hacl_star_rev=13e0c6721ac9206c4249ecc1dc04ed617ad1e262
+expected_hacl_star_rev=363eae2c2eb60e46f182ddd4bd1cd3f1d00b35c9
hacl_dir="$(realpath "$1")"
cd "$(dirname "$0")"
@@ -45,11 +45,14 @@ dist_files=(
Hacl_Hash_SHA1.h
internal/Hacl_Hash_SHA1.h
Hacl_Hash_MD5.h
+ Hacl_Hash_SHA3.h
internal/Hacl_Hash_MD5.h
+ internal/Hacl_Hash_SHA3.h
internal/Hacl_SHA2_Generic.h
Hacl_Streaming_SHA2.c
Hacl_Hash_SHA1.c
Hacl_Hash_MD5.c
+ Hacl_Hash_SHA3.c
)
declare -a include_files
@@ -134,9 +137,9 @@ $sed -i -z 's!#include <string.h>\n!#include <string.h>\n#include "python_hacl_n
# Finally, we remove a bunch of ifdefs from target.h that are, again, useful in
# the general case, but not exercised by the subset of HACL* that we vendor.
-$sed -z -i 's!#ifndef KRML_\(HOST_PRINTF\|HOST_EXIT\|PRE_ALIGN\|POST_ALIGN\|ALIGNED_MALLOC\|ALIGNED_FREE\|HOST_TIME\)\n\(\n\|# [^\n]*\n\|[^#][^\n]*\n\)*#endif\n\n!!g' include/krml/internal/target.h
-$sed -z -i 's!\n\n\([^#][^\n]*\n\)*#define KRML_\(EABORT\|EXIT\|CHECK_SIZE\)[^\n]*\(\n [^\n]*\)*!!g' include/krml/internal/target.h
+$sed -z -i 's!#ifndef KRML_\(PRE_ALIGN\|POST_ALIGN\|ALIGNED_MALLOC\|ALIGNED_FREE\|HOST_TIME\)\n\(\n\|# [^\n]*\n\|[^#][^\n]*\n\)*#endif\n\n!!g' include/krml/internal/target.h
+$sed -z -i 's!\n\n\([^#][^\n]*\n\)*#define KRML_\(EABORT\|EXIT\)[^\n]*\(\n [^\n]*\)*!!g' include/krml/internal/target.h
$sed -z -i 's!\n\n\([^#][^\n]*\n\)*#if [^\n]*\n\( [^\n]*\n\)*#define KRML_\(EABORT\|EXIT\|CHECK_SIZE\)[^\n]*\(\n [^\n]*\)*!!g' include/krml/internal/target.h
-$sed -z -i 's!\n\n\([^#][^\n]*\n\)*#if [^\n]*\n\( [^\n]*\n\)*# define _\?KRML_\(DEPRECATED\|CHECK_SIZE_PRAGMA\|HOST_EPRINTF\|HOST_SNPRINTF\)[^\n]*\n\([^#][^\n]*\n\|#el[^\n]*\n\|# [^\n]*\n\)*#endif!!g' include/krml/internal/target.h
+$sed -z -i 's!\n\n\([^#][^\n]*\n\)*#if [^\n]*\n\( [^\n]*\n\)*# define _\?KRML_\(DEPRECATED\|HOST_SNPRINTF\)[^\n]*\n\([^#][^\n]*\n\|#el[^\n]*\n\|# [^\n]*\n\)*#endif!!g' include/krml/internal/target.h
echo "Updated; verify all is okay using git diff and git status."