gh-131298: eliminate HACL* static libraries for cryptographic modules (GH-132438)

* simplify HACL* build for MD5, SHA1, SHA2 and SHA3 modules

* remove statically linked libraries for HACL* implementation

* is it better now?

* is it better now?

* fixup

* Present HACL* as a static or shared library.

On WASI, extension modules based on HACL* require the HACL*
library to be linked statically. On other platforms, it can
be built dynamically.

* amend whitespace

* remove temporary .so file as it requires more symlinks

* avoid smelly symbols

* fixup checksums

* regen sbom

* fixup shell warnings and comments

* it *should* work
This commit is contained in:
Bénédikt Tran 2025-04-20 19:40:17 +02:00 committed by GitHub
parent 492e3e6976
commit 5f2ba152a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 717 additions and 511 deletions

View file

@ -227,17 +227,12 @@ ENSUREPIP= @ENSUREPIP@
# Internal static libraries # Internal static libraries
LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a
LIBEXPAT_A= Modules/expat/libexpat.a LIBEXPAT_A= Modules/expat/libexpat.a
LIBHACL_MD5_A= Modules/_hacl/libHacl_Hash_MD5.a
LIBHACL_SHA1_A= Modules/_hacl/libHacl_Hash_SHA1.a # HACL* build configuration
LIBHACL_SHA2_A= Modules/_hacl/libHacl_Hash_SHA2.a
LIBHACL_SHA3_A= Modules/_hacl/libHacl_Hash_SHA3.a
LIBHACL_BLAKE2_A= Modules/_hacl/libHacl_Hash_Blake2.a
LIBHACL_HMAC_A= Modules/_hacl/libHacl_HMAC.a
LIBHACL_CFLAGS=@LIBHACL_CFLAGS@ LIBHACL_CFLAGS=@LIBHACL_CFLAGS@
LIBHACL_SIMD128_FLAGS=@LIBHACL_SIMD128_FLAGS@ LIBHACL_LDFLAGS=@LIBHACL_LDFLAGS@
LIBHACL_SIMD256_FLAGS=@LIBHACL_SIMD256_FLAGS@ LIBHACL_BLAKE2_SIMD128_CFLAGS=@LIBHACL_SIMD128_FLAGS@ -DHACL_CAN_COMPILE_VEC128
LIBHACL_SIMD128_OBJS=@LIBHACL_SIMD128_OBJS@ LIBHACL_BLAKE2_SIMD256_CFLAGS=@LIBHACL_SIMD256_FLAGS@ -DHACL_CAN_COMPILE_VEC256
LIBHACL_SIMD256_OBJS=@LIBHACL_SIMD256_OBJS@
# Module state, compiler flags and linker flags # Module state, compiler flags and linker flags
# Empty CFLAGS and LDFLAGS are omitted. # Empty CFLAGS and LDFLAGS are omitted.
@ -660,25 +655,40 @@ LIBEXPAT_HEADERS= \
########################################################################## ##########################################################################
# hashlib's HACL* library # hashlib's HACL* library
#
# On WASI, static build is required.
# On other platforms, a shared library is used.
LIBHACL_MD5_OBJS= \ LIBHACL_MD5_OBJS= \
Modules/_hacl/Hacl_Hash_MD5.o Modules/_hacl/Hacl_Hash_MD5.o
LIBHACL_MD5_LIB_STATIC=Modules/_hacl/libHacl_Hash_MD5.a
LIBHACL_MD5_LIB_SHARED=$(LIBHACL_MD5_OBJS)
LIBHACL_SHA1_OBJS= \ LIBHACL_SHA1_OBJS= \
Modules/_hacl/Hacl_Hash_SHA1.o Modules/_hacl/Hacl_Hash_SHA1.o
LIBHACL_SHA1_LIB_STATIC=Modules/_hacl/libHacl_Hash_SHA1.a
LIBHACL_SHA1_LIB_SHARED=$(LIBHACL_SHA1_OBJS)
LIBHACL_SHA2_OBJS= \ LIBHACL_SHA2_OBJS= \
Modules/_hacl/Hacl_Hash_SHA2.o Modules/_hacl/Hacl_Hash_SHA2.o
LIBHACL_SHA2_LIB_STATIC=Modules/_hacl/libHacl_Hash_SHA2.a
LIBHACL_SHA2_LIB_SHARED=$(LIBHACL_SHA2_OBJS)
LIBHACL_SHA3_OBJS= \ LIBHACL_SHA3_OBJS= \
Modules/_hacl/Hacl_Hash_SHA3.o Modules/_hacl/Hacl_Hash_SHA3.o
LIBHACL_SHA3_LIB_STATIC=Modules/_hacl/libHacl_Hash_SHA3.a
LIBHACL_SHA3_LIB_SHARED=$(LIBHACL_SHA3_OBJS)
LIBHACL_BLAKE2_SIMD128_OBJS=@LIBHACL_BLAKE2_SIMD128_OBJS@
LIBHACL_BLAKE2_SIMD256_OBJS=@LIBHACL_BLAKE2_SIMD256_OBJS@
LIBHACL_BLAKE2_OBJS= \ LIBHACL_BLAKE2_OBJS= \
Modules/_hacl/Hacl_Hash_Blake2s.o \ Modules/_hacl/Hacl_Hash_Blake2s.o \
Modules/_hacl/Hacl_Hash_Blake2b.o \ Modules/_hacl/Hacl_Hash_Blake2b.o \
Modules/_hacl/Lib_Memzero0.o \ Modules/_hacl/Lib_Memzero0.o \
$(LIBHACL_SIMD128_OBJS) \ $(LIBHACL_BLAKE2_SIMD128_OBJS) \
$(LIBHACL_SIMD256_OBJS) $(LIBHACL_BLAKE2_SIMD256_OBJS)
LIBHACL_BLAKE2_LIB_STATIC=Modules/_hacl/libHacl_Hash_BLAKE2.a
LIBHACL_BLAKE2_LIB_SHARED=$(LIBHACL_BLAKE2_OBJS)
LIBHACL_HMAC_OBJS= \ LIBHACL_HMAC_OBJS= \
Modules/_hacl/Hacl_HMAC.o \ Modules/_hacl/Hacl_HMAC.o \
@ -688,6 +698,8 @@ LIBHACL_HMAC_OBJS= \
$(LIBHACL_SHA2_OBJS) \ $(LIBHACL_SHA2_OBJS) \
$(LIBHACL_SHA3_OBJS) \ $(LIBHACL_SHA3_OBJS) \
$(LIBHACL_BLAKE2_OBJS) $(LIBHACL_BLAKE2_OBJS)
LIBHACL_HMAC_LIB_STATIC=Modules/_hacl/libHacl_HMAC.a
LIBHACL_HMAC_LIB_SHARED=$(LIBHACL_HMAC_OBJS)
LIBHACL_HEADERS= \ LIBHACL_HEADERS= \
Modules/_hacl/include/krml/FStar_UInt128_Verified.h \ Modules/_hacl/include/krml/FStar_UInt128_Verified.h \
@ -732,7 +744,6 @@ LIBHACL_BLAKE2_HEADERS= \
Modules/_hacl/internal/Hacl_Impl_Blake2_Constants.h \ Modules/_hacl/internal/Hacl_Impl_Blake2_Constants.h \
Modules/_hacl/internal/Hacl_Hash_Blake2s_Simd128.h \ Modules/_hacl/internal/Hacl_Hash_Blake2s_Simd128.h \
Modules/_hacl/internal/Hacl_Hash_Blake2b_Simd256.h \ Modules/_hacl/internal/Hacl_Hash_Blake2b_Simd256.h \
Modules/_hacl/internal/Hacl_Streaming_Types.h \
$(LIBHACL_HEADERS) $(LIBHACL_HEADERS)
LIBHACL_HMAC_HEADERS= \ LIBHACL_HMAC_HEADERS= \
@ -1461,74 +1472,72 @@ $(LIBEXPAT_A): $(LIBEXPAT_OBJS)
$(AR) $(ARFLAGS) $@ $(LIBEXPAT_OBJS) $(AR) $(ARFLAGS) $@ $(LIBEXPAT_OBJS)
########################################################################## ##########################################################################
# Build HACL* static libraries for hashlib and HACL* HMAC. # HACL* library build
# #
# The contents of libHacl_Blake2.a vary depending on whether we # The HACL* modules are dynamically compiled and linked with the
# have the ability to compile vectorized versions # corresponding CPython built-in modules on demand, depending on
# whether the module is built or not.
#
# In particular, the HACL* objects are also dependencies of the
# corresponding C extension modules but makesetup must NOT create
# a rule for them.
#
# For WASI, static linking is needed and HACL* is statically linked instead.
Modules/_hacl/Lib_Memzero0.o: $(srcdir)/Modules/_hacl/Lib_Memzero0.c $(LIBHACL_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Lib_Memzero0.c
Modules/_hacl/Hacl_Hash_MD5.o: $(srcdir)/Modules/_hacl/Hacl_Hash_MD5.c $(LIBHACL_MD5_HEADERS) Modules/_hacl/Hacl_Hash_MD5.o: $(srcdir)/Modules/_hacl/Hacl_Hash_MD5.c $(LIBHACL_MD5_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_MD5.c $(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_MD5.c
$(LIBHACL_MD5_LIB_STATIC): $(LIBHACL_MD5_OBJS)
$(LIBHACL_MD5_A): $(LIBHACL_MD5_OBJS)
-rm -f $@ -rm -f $@
$(AR) $(ARFLAGS) $@ $(LIBHACL_MD5_OBJS) $(AR) $(ARFLAGS) $@ $(LIBHACL_MD5_OBJS)
Modules/_hacl/Hacl_Hash_SHA1.o: $(srcdir)/Modules/_hacl/Hacl_Hash_SHA1.c $(LIBHACL_SHA1_HEADERS) Modules/_hacl/Hacl_Hash_SHA1.o: $(srcdir)/Modules/_hacl/Hacl_Hash_SHA1.c $(LIBHACL_SHA1_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_SHA1.c $(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_SHA1.c
$(LIBHACL_SHA1_LIB_STATIC): $(LIBHACL_SHA1_OBJS)
$(LIBHACL_SHA1_A): $(LIBHACL_SHA1_OBJS)
-rm -f $@ -rm -f $@
$(AR) $(ARFLAGS) $@ $(LIBHACL_SHA1_OBJS) $(AR) $(ARFLAGS) $@ $(LIBHACL_SHA1_OBJS)
Modules/_hacl/Hacl_Hash_SHA2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_SHA2.c $(LIBHACL_SHA2_HEADERS) Modules/_hacl/Hacl_Hash_SHA2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_SHA2.c $(LIBHACL_SHA2_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_SHA2.c $(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_SHA2.c
$(LIBHACL_SHA2_LIB_STATIC): $(LIBHACL_SHA2_OBJS)
$(LIBHACL_SHA2_A): $(LIBHACL_SHA2_OBJS)
-rm -f $@ -rm -f $@
$(AR) $(ARFLAGS) $@ $(LIBHACL_SHA2_OBJS) $(AR) $(ARFLAGS) $@ $(LIBHACL_SHA2_OBJS)
Modules/_hacl/Hacl_Hash_SHA3.o: $(srcdir)/Modules/_hacl/Hacl_Hash_SHA3.c $(LIBHACL_SHA3_HEADERS) Modules/_hacl/Hacl_Hash_SHA3.o: $(srcdir)/Modules/_hacl/Hacl_Hash_SHA3.c $(LIBHACL_SHA3_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_SHA3.c $(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_SHA3.c
$(LIBHACL_SHA3_LIB_STATIC): $(LIBHACL_SHA3_OBJS)
$(LIBHACL_SHA3_A): $(LIBHACL_SHA3_OBJS)
-rm -f $@ -rm -f $@
$(AR) $(ARFLAGS) $@ $(LIBHACL_SHA3_OBJS) $(AR) $(ARFLAGS) $@ $(LIBHACL_SHA3_OBJS)
Modules/_hacl/Hacl_Hash_Blake2s.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s.c $(LIBHACL_BLAKE2_HEADERS) Modules/_hacl/Hacl_Hash_Blake2s.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s.c $(LIBHACL_BLAKE2_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s.c $(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s.c
Modules/_hacl/Hacl_Hash_Blake2b.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b.c $(LIBHACL_BLAKE2_HEADERS) Modules/_hacl/Hacl_Hash_Blake2b.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b.c $(LIBHACL_BLAKE2_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b.c $(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b.c
Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c $(LIBHACL_BLAKE2_HEADERS) Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c $(LIBHACL_BLAKE2_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_SIMD128_FLAGS) -DHACL_CAN_COMPILE_VEC128 -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c $(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_BLAKE2_SIMD128_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c
Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.c $(LIBHACL_BLAKE2_HEADERS) Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.c $(LIBHACL_BLAKE2_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_SIMD128_FLAGS) -DHACL_CAN_COMPILE_VEC128 -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.c $(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_BLAKE2_SIMD128_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.c
Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c $(LIBHACL_BLAKE2_HEADERS) Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c $(LIBHACL_BLAKE2_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_SIMD256_FLAGS) -DHACL_CAN_COMPILE_VEC256 -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c $(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_BLAKE2_SIMD256_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c
Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.c $(LIBHACL_BLAKE2_HEADERS) Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.c $(LIBHACL_BLAKE2_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_SIMD256_FLAGS) -DHACL_CAN_COMPILE_VEC256 -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.c $(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_BLAKE2_SIMD256_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.c
$(LIBHACL_BLAKE2_LIB_STATIC): $(LIBHACL_BLAKE2_OBJS)
Modules/_hacl/Lib_Memzero0.o: $(srcdir)/Modules/_hacl/Lib_Memzero0.c $(LIBHACL_BLAKE2_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Lib_Memzero0.c
$(LIBHACL_BLAKE2_A): $(LIBHACL_BLAKE2_OBJS)
-rm -f $@ -rm -f $@
$(AR) $(ARFLAGS) $@ $(LIBHACL_BLAKE2_OBJS) $(AR) $(ARFLAGS) $@ $(LIBHACL_BLAKE2_OBJS)
# Other HACL* cryptographic primitives
Modules/_hacl/Hacl_HMAC.o: $(srcdir)/Modules/_hacl/Hacl_HMAC.c $(LIBHACL_HMAC_HEADERS) Modules/_hacl/Hacl_HMAC.o: $(srcdir)/Modules/_hacl/Hacl_HMAC.c $(LIBHACL_HMAC_HEADERS)
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_HMAC.c $(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_HMAC.c
Modules/_hacl/Hacl_Streaming_HMAC.o: $(srcdir)/Modules/_hacl/Hacl_Streaming_HMAC.c $(LIBHACL_HMAC_HEADERS) Modules/_hacl/Hacl_Streaming_HMAC.o: $(srcdir)/Modules/_hacl/Hacl_Streaming_HMAC.c $(LIBHACL_HMAC_HEADERS)
$(CC) -Wno-unused-variable -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Streaming_HMAC.c $(CC) -Wno-unused-variable -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Streaming_HMAC.c
$(LIBHACL_HMAC_LIB_STATIC): $(LIBHACL_HMAC_OBJS)
$(LIBHACL_HMAC_A): $(LIBHACL_HMAC_OBJS)
-rm -f $@ -rm -f $@
$(AR) $(ARFLAGS) $@ $(LIBHACL_HMAC_OBJS) $(AR) $(ARFLAGS) $@ $(LIBHACL_HMAC_OBJS)
##########################################################################
# create relative links from build/lib.platform/egg.so to Modules/egg.so # create relative links from build/lib.platform/egg.so to Modules/egg.so
# pybuilddir.txt is created too late. We cannot use it in Makefile # pybuilddir.txt is created too late. We cannot use it in Makefile
# targets. ln --relative is not portable. # targets. ln --relative is not portable.
@ -3302,12 +3311,21 @@ MODULE__DECIMAL_DEPS=$(srcdir)/Modules/_decimal/docstrings.h @LIBMPDEC_INTERNAL@
MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/pyexpat.c @LIBEXPAT_INTERNAL@ MODULE__ELEMENTTREE_DEPS=$(srcdir)/Modules/pyexpat.c @LIBEXPAT_INTERNAL@
MODULE__HASHLIB_DEPS=$(srcdir)/Modules/hashlib.h MODULE__HASHLIB_DEPS=$(srcdir)/Modules/hashlib.h
MODULE__IO_DEPS=$(srcdir)/Modules/_io/_iomodule.h MODULE__IO_DEPS=$(srcdir)/Modules/_io/_iomodule.h
MODULE__MD5_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_MD5_HEADERS) $(LIBHACL_MD5_A)
MODULE__SHA1_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_SHA1_HEADERS) $(LIBHACL_SHA1_A) # HACL*-based cryptographic primitives
MODULE__SHA2_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_SHA2_HEADERS) $(LIBHACL_SHA2_A) MODULE__MD5_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_MD5_HEADERS) $(LIBHACL_MD5_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__SHA3_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_SHA3_HEADERS) $(LIBHACL_SHA3_A) MODULE__MD5_LDEPS=$(LIBHACL_MD5_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__BLAKE2_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_BLAKE2_HEADERS) $(LIBHACL_BLAKE2_A) MODULE__SHA1_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_SHA1_HEADERS) $(LIBHACL_SHA1_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__HMAC_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_HMAC_HEADERS) $(LIBHACL_HMAC_A) MODULE__SHA1_LDEPS=$(LIBHACL_SHA1_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__SHA2_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_SHA2_HEADERS) $(LIBHACL_SHA2_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__SHA2_LDEPS=$(LIBHACL_SHA2_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__SHA3_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_SHA3_HEADERS) $(LIBHACL_SHA3_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__SHA3_LDEPS=$(LIBHACL_SHA3_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__BLAKE2_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_BLAKE2_HEADERS) $(LIBHACL_BLAKE2_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__BLAKE2_LDEPS=$(LIBHACL_BLAKE2_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__HMAC_DEPS=$(srcdir)/Modules/hashlib.h $(LIBHACL_HMAC_HEADERS) $(LIBHACL_HMAC_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__HMAC_LDEPS=$(LIBHACL_HMAC_LIB_@LIBHACL_LDEPS_LIBTYPE@)
MODULE__SOCKET_DEPS=$(srcdir)/Modules/socketmodule.h $(srcdir)/Modules/addrinfo.h $(srcdir)/Modules/getaddrinfo.c $(srcdir)/Modules/getnameinfo.c MODULE__SOCKET_DEPS=$(srcdir)/Modules/socketmodule.h $(srcdir)/Modules/addrinfo.h $(srcdir)/Modules/getaddrinfo.c $(srcdir)/Modules/getnameinfo.c
MODULE__SSL_DEPS=$(srcdir)/Modules/_ssl.h $(srcdir)/Modules/_ssl/cert.c $(srcdir)/Modules/_ssl/debughelpers.c $(srcdir)/Modules/_ssl/misc.c $(srcdir)/Modules/_ssl_data_111.h $(srcdir)/Modules/_ssl_data_300.h $(srcdir)/Modules/socketmodule.h MODULE__SSL_DEPS=$(srcdir)/Modules/_ssl.h $(srcdir)/Modules/_ssl/cert.c $(srcdir)/Modules/_ssl/debughelpers.c $(srcdir)/Modules/_ssl/misc.c $(srcdir)/Modules/_ssl_data_111.h $(srcdir)/Modules/_ssl_data_300.h $(srcdir)/Modules/socketmodule.h
MODULE__TESTCAPI_DEPS=$(srcdir)/Modules/_testcapi/parts.h $(srcdir)/Modules/_testcapi/util.h MODULE__TESTCAPI_DEPS=$(srcdir)/Modules/_testcapi/parts.h $(srcdir)/Modules/_testcapi/util.h

8
Misc/sbom.spdx.json generated
View file

@ -888,11 +888,11 @@
"checksums": [ "checksums": [
{ {
"algorithm": "SHA1", "algorithm": "SHA1",
"checksumValue": "3d65f95f6f4bbfe980a89b82c55d02d7694a5a79" "checksumValue": "66108dcbb7fc9e8aa7adcc440fede22c62164d92"
}, },
{ {
"algorithm": "SHA256", "algorithm": "SHA256",
"checksumValue": "0f8d744620cf5f6b8450da187484b418d24dec7d8cf72b757b7080e84cb3ae5e" "checksumValue": "284079d2af21a570c58c82e54536b8b9bae0f0a321f229b242c92dc350d10bdf"
} }
], ],
"fileName": "Modules/_hacl/lib_memzero0.h" "fileName": "Modules/_hacl/lib_memzero0.h"
@ -930,11 +930,11 @@
"checksums": [ "checksums": [
{ {
"algorithm": "SHA1", "algorithm": "SHA1",
"checksumValue": "dbed915328619b1159012649a427c6928033dd90" "checksumValue": "4a0bdb9496d49bbfa3ad50bb7854d8f099e84891"
}, },
{ {
"algorithm": "SHA256", "algorithm": "SHA256",
"checksumValue": "0297ea0a5d1117e001d5dbb90f99d47ee9e0f9d3dd45da02ba5dc477e551cb5a" "checksumValue": "b1a45149239ee7af7de769a3e9339950d47c199bb9eaa10edce8a00fde603b12"
} }
], ],
"fileName": "Modules/_hacl/python_hacl_namespaces.h" "fileName": "Modules/_hacl/python_hacl_namespaces.h"

View file

@ -16,6 +16,9 @@
# generated by PY_STDLIB_MOD macro. # generated by PY_STDLIB_MOD macro.
# * All source files automatically depend on $(PYTHON_HEADERS) and # * All source files automatically depend on $(PYTHON_HEADERS) and
# $(MODULE_{NAME}_DEPS). # $(MODULE_{NAME}_DEPS).
# * ${NAME}$(EXT_SUFFIX) rules automatically depend on $(MODULE_{NAME}_LDEPS),
# thus $(MODULE_{NAME}_LDEPS) must only contain Makefile rule names. To pass
# specific values to the linker, use $(MODULE_{NAME}_LDFLAGS) instead.
# #
# See Modules/Setup and Modules/makesetup # See Modules/Setup and Modules/makesetup
# #
@ -76,13 +79,23 @@
# needs -lreadline or -ledit, sometimes termcap, termlib, or tinfo # needs -lreadline or -ledit, sometimes termcap, termlib, or tinfo
@MODULE_READLINE_TRUE@readline readline.c @MODULE_READLINE_TRUE@readline readline.c
# hashing builtins, can be disabled with --without-builtin-hashlib-hashes ############################################################################
@MODULE__MD5_TRUE@_md5 md5module.c -I$(srcdir)/Modules/_hacl/include Modules/_hacl/libHacl_Hash_MD5.a -D_BSD_SOURCE -D_DEFAULT_SOURCE # HACL*-based Cryptographic Primitives
@MODULE__SHA1_TRUE@_sha1 sha1module.c -I$(srcdir)/Modules/_hacl/include Modules/_hacl/libHacl_Hash_SHA1.a -D_BSD_SOURCE -D_DEFAULT_SOURCE #
@MODULE__SHA2_TRUE@_sha2 sha2module.c -I$(srcdir)/Modules/_hacl/include Modules/_hacl/libHacl_Hash_SHA2.a -D_BSD_SOURCE -D_DEFAULT_SOURCE # Since the compilation of the built-in cryptographic modules depends
@MODULE__SHA3_TRUE@_sha3 sha3module.c -I$(srcdir)/Modules/_hacl/include Modules/_hacl/libHacl_Hash_SHA3.a -D_BSD_SOURCE -D_DEFAULT_SOURCE # on whether we are building on WASI or not, rules will be explicitly
@MODULE__BLAKE2_TRUE@_blake2 blake2module.c -I$(srcdir)/Modules/_hacl/include Modules/_hacl/libHacl_Hash_Blake2.a -D_BSD_SOURCE -D_DEFAULT_SOURCE # written. In the future, it should be preferrable to be able to setup
# the relevant bits here instead of in Makefile.pre.in or configure.ac.
# Hash functions can be disabled with --without-builtin-hashlib-hashes.
@MODULE__MD5_TRUE@_md5 md5module.c
@MODULE__SHA1_TRUE@_sha1 sha1module.c
@MODULE__SHA2_TRUE@_sha2 sha2module.c
@MODULE__SHA3_TRUE@_sha3 sha3module.c
@MODULE__BLAKE2_TRUE@_blake2 blake2module.c
# Since HMAC is always supported, the HACL* implementation modules must
# be built unconditionally.
@MODULE__HMAC_TRUE@_hmac hmacmodule.c @MODULE__HMAC_TRUE@_hmac hmacmodule.c
############################################################################ ############################################################################

View file

@ -1,4 +1,5 @@
#include <inttypes.h> #include <inttypes.h>
#include "python_hacl_namespaces.h"
void Lib_Memzero0_memzero0(void *dst, uint64_t len); void Lib_Memzero0_memzero0(void *dst, uint64_t len);

View file

@ -6,234 +6,251 @@
* conflicts with builds linking or dynamically loading other code potentially * conflicts with builds linking or dynamically loading other code potentially
* using HACL* libraries. * using HACL* libraries.
* *
* Something like this to generate new entries for the list: nm *.o | grep Hacl | cut -c 20- | sort | uniq | grep -v python_hashlib | egrep ^_ | gsed 's/_\(.*\)/#define \1 python_hashlib_\1/' * Something like this to generate new entries for the list:
*
* nm *.o | grep Hacl | cut -c 20- | sort | uniq | grep -v _Py_LibHacl_ | egrep ^_ | sed 's/_\(.*\)/#define \1 _Py_LibHacl_\1/g'
*/ */
#define Hacl_Hash_SHA2_state_sha2_224_s python_hashlib_Hacl_Hash_SHA2_state_sha2_224_s #define Lib_Memzero0_memzero0 _Py_LibHacl_Lib_Memzero0_memzero0
#define Hacl_Hash_SHA2_state_sha2_224 python_hashlib_Hacl_Hash_SHA2_state_sha2_224
#define Hacl_Hash_SHA2_state_sha2_256 python_hashlib_Hacl_Hash_SHA2_state_sha2_256
#define Hacl_Hash_SHA2_state_sha2_384_s python_hashlib_Hacl_Hash_SHA2_state_sha2_384_s
#define Hacl_Hash_SHA2_state_sha2_384 python_hashlib_Hacl_Hash_SHA2_state_sha2_384
#define Hacl_Hash_SHA2_state_sha2_512 python_hashlib_Hacl_Hash_SHA2_state_sha2_512
#define Hacl_Hash_SHA2_malloc_256 python_hashlib_Hacl_Hash_SHA2_malloc_256
#define Hacl_Hash_SHA2_malloc_224 python_hashlib_Hacl_Hash_SHA2_malloc_224
#define Hacl_Hash_SHA2_malloc_512 python_hashlib_Hacl_Hash_SHA2_malloc_512
#define Hacl_Hash_SHA2_malloc_384 python_hashlib_Hacl_Hash_SHA2_malloc_384
#define Hacl_Hash_SHA2_copy_256 python_hashlib_Hacl_Hash_SHA2_copy_256
#define Hacl_Hash_SHA2_copy_224 python_hashlib_Hacl_Hash_SHA2_copy_224
#define Hacl_Hash_SHA2_copy_512 python_hashlib_Hacl_Hash_SHA2_copy_512
#define Hacl_Hash_SHA2_copy_384 python_hashlib_Hacl_Hash_SHA2_copy_384
#define Hacl_Hash_SHA2_init_256 python_hashlib_Hacl_Hash_SHA2_init_256
#define Hacl_Hash_SHA2_init_224 python_hashlib_Hacl_Hash_SHA2_init_224
#define Hacl_Hash_SHA2_init_512 python_hashlib_Hacl_Hash_SHA2_init_512
#define Hacl_Hash_SHA2_init_384 python_hashlib_Hacl_Hash_SHA2_init_384
#define Hacl_SHA2_Scalar32_sha512_init python_hashlib_Hacl_SHA2_Scalar32_sha512_init
#define Hacl_Hash_SHA2_update_256 python_hashlib_Hacl_Hash_SHA2_update_256
#define Hacl_Hash_SHA2_update_224 python_hashlib_Hacl_Hash_SHA2_update_224
#define Hacl_Hash_SHA2_update_512 python_hashlib_Hacl_Hash_SHA2_update_512
#define Hacl_Hash_SHA2_update_384 python_hashlib_Hacl_Hash_SHA2_update_384
#define Hacl_Hash_SHA2_digest_256 python_hashlib_Hacl_Hash_SHA2_digest_256
#define Hacl_Hash_SHA2_digest_224 python_hashlib_Hacl_Hash_SHA2_digest_224
#define Hacl_Hash_SHA2_digest_512 python_hashlib_Hacl_Hash_SHA2_digest_512
#define Hacl_Hash_SHA2_digest_384 python_hashlib_Hacl_Hash_SHA2_digest_384
#define Hacl_Hash_SHA2_free_256 python_hashlib_Hacl_Hash_SHA2_free_256
#define Hacl_Hash_SHA2_free_224 python_hashlib_Hacl_Hash_SHA2_free_224
#define Hacl_Hash_SHA2_free_512 python_hashlib_Hacl_Hash_SHA2_free_512
#define Hacl_Hash_SHA2_free_384 python_hashlib_Hacl_Hash_SHA2_free_384
#define Hacl_Hash_SHA2_sha256 python_hashlib_Hacl_Hash_SHA2_sha256
#define Hacl_Hash_SHA2_sha224 python_hashlib_Hacl_Hash_SHA2_sha224
#define Hacl_Hash_SHA2_sha512 python_hashlib_Hacl_Hash_SHA2_sha512
#define Hacl_Hash_SHA2_sha384 python_hashlib_Hacl_Hash_SHA2_sha384
#define Hacl_Hash_MD5_malloc python_hashlib_Hacl_Hash_MD5_malloc #define Hacl_Hash_SHA2_state_sha2_224_s _Py_LibHacl_Hacl_Hash_SHA2_state_sha2_224_s
#define Hacl_Hash_MD5_init python_hashlib_Hacl_Hash_MD5_init #define Hacl_Hash_SHA2_state_sha2_224 _Py_LibHacl_Hacl_Hash_SHA2_state_sha2_224
#define Hacl_Hash_MD5_update python_hashlib_Hacl_Hash_MD5_update #define Hacl_Hash_SHA2_state_sha2_256 _Py_LibHacl_Hacl_Hash_SHA2_state_sha2_256
#define Hacl_Hash_MD5_digest python_hashlib_Hacl_Hash_MD5_digest #define Hacl_Hash_SHA2_state_sha2_384_s _Py_LibHacl_Hacl_Hash_SHA2_state_sha2_384_s
#define Hacl_Hash_MD5_free python_hashlib_Hacl_Hash_MD5_free #define Hacl_Hash_SHA2_state_sha2_384 _Py_LibHacl_Hacl_Hash_SHA2_state_sha2_384
#define Hacl_Hash_MD5_copy python_hashlib_Hacl_Hash_MD5_copy #define Hacl_Hash_SHA2_state_sha2_512 _Py_LibHacl_Hacl_Hash_SHA2_state_sha2_512
#define Hacl_Hash_MD5_hash python_hashlib_Hacl_Hash_MD5_hash #define Hacl_Hash_SHA2_malloc_256 _Py_LibHacl_Hacl_Hash_SHA2_malloc_256
#define Hacl_Hash_SHA2_malloc_224 _Py_LibHacl_Hacl_Hash_SHA2_malloc_224
#define Hacl_Hash_SHA2_malloc_512 _Py_LibHacl_Hacl_Hash_SHA2_malloc_512
#define Hacl_Hash_SHA2_malloc_384 _Py_LibHacl_Hacl_Hash_SHA2_malloc_384
#define Hacl_Hash_SHA2_copy_256 _Py_LibHacl_Hacl_Hash_SHA2_copy_256
#define Hacl_Hash_SHA2_copy_224 _Py_LibHacl_Hacl_Hash_SHA2_copy_224
#define Hacl_Hash_SHA2_copy_512 _Py_LibHacl_Hacl_Hash_SHA2_copy_512
#define Hacl_Hash_SHA2_copy_384 _Py_LibHacl_Hacl_Hash_SHA2_copy_384
#define Hacl_Hash_SHA2_init_256 _Py_LibHacl_Hacl_Hash_SHA2_init_256
#define Hacl_Hash_SHA2_init_224 _Py_LibHacl_Hacl_Hash_SHA2_init_224
#define Hacl_Hash_SHA2_init_512 _Py_LibHacl_Hacl_Hash_SHA2_init_512
#define Hacl_Hash_SHA2_init_384 _Py_LibHacl_Hacl_Hash_SHA2_init_384
#define Hacl_SHA2_Scalar32_sha512_init _Py_LibHacl_Hacl_SHA2_Scalar32_sha512_init
#define Hacl_Hash_SHA2_update_256 _Py_LibHacl_Hacl_Hash_SHA2_update_256
#define Hacl_Hash_SHA2_update_224 _Py_LibHacl_Hacl_Hash_SHA2_update_224
#define Hacl_Hash_SHA2_update_512 _Py_LibHacl_Hacl_Hash_SHA2_update_512
#define Hacl_Hash_SHA2_update_384 _Py_LibHacl_Hacl_Hash_SHA2_update_384
#define Hacl_Hash_SHA2_digest_256 _Py_LibHacl_Hacl_Hash_SHA2_digest_256
#define Hacl_Hash_SHA2_digest_224 _Py_LibHacl_Hacl_Hash_SHA2_digest_224
#define Hacl_Hash_SHA2_digest_512 _Py_LibHacl_Hacl_Hash_SHA2_digest_512
#define Hacl_Hash_SHA2_digest_384 _Py_LibHacl_Hacl_Hash_SHA2_digest_384
#define Hacl_Hash_SHA2_free_256 _Py_LibHacl_Hacl_Hash_SHA2_free_256
#define Hacl_Hash_SHA2_free_224 _Py_LibHacl_Hacl_Hash_SHA2_free_224
#define Hacl_Hash_SHA2_free_512 _Py_LibHacl_Hacl_Hash_SHA2_free_512
#define Hacl_Hash_SHA2_free_384 _Py_LibHacl_Hacl_Hash_SHA2_free_384
#define Hacl_Hash_SHA2_sha256 _Py_LibHacl_Hacl_Hash_SHA2_sha256
#define Hacl_Hash_SHA2_sha224 _Py_LibHacl_Hacl_Hash_SHA2_sha224
#define Hacl_Hash_SHA2_sha512 _Py_LibHacl_Hacl_Hash_SHA2_sha512
#define Hacl_Hash_SHA2_sha384 _Py_LibHacl_Hacl_Hash_SHA2_sha384
#define Hacl_Hash_SHA1_malloc python_hashlib_Hacl_Hash_SHA1_malloc #define Hacl_Hash_MD5_malloc _Py_LibHacl_Hacl_Hash_MD5_malloc
#define Hacl_Hash_SHA1_init python_hashlib_Hacl_Hash_SHA1_init #define Hacl_Hash_MD5_init _Py_LibHacl_Hacl_Hash_MD5_init
#define Hacl_Hash_SHA1_update python_hashlib_Hacl_Hash_SHA1_update #define Hacl_Hash_MD5_update _Py_LibHacl_Hacl_Hash_MD5_update
#define Hacl_Hash_SHA1_digest python_hashlib_Hacl_Hash_SHA1_digest #define Hacl_Hash_MD5_digest _Py_LibHacl_Hacl_Hash_MD5_digest
#define Hacl_Hash_SHA1_free python_hashlib_Hacl_Hash_SHA1_free #define Hacl_Hash_MD5_free _Py_LibHacl_Hacl_Hash_MD5_free
#define Hacl_Hash_SHA1_copy python_hashlib_Hacl_Hash_SHA1_copy #define Hacl_Hash_MD5_copy _Py_LibHacl_Hacl_Hash_MD5_copy
#define Hacl_Hash_SHA1_hash python_hashlib_Hacl_Hash_SHA1_hash #define Hacl_Hash_MD5_hash _Py_LibHacl_Hacl_Hash_MD5_hash
#define Hacl_Hash_SHA3_update_last_sha3 python_hashlib_Hacl_Hash_SHA3_update_last_sha3 #define Hacl_Hash_SHA1_malloc _Py_LibHacl_Hacl_Hash_SHA1_malloc
#define Hacl_Hash_SHA3_update_multi_sha3 python_hashlib_Hacl_Hash_SHA3_update_multi_sha3 #define Hacl_Hash_SHA1_init _Py_LibHacl_Hacl_Hash_SHA1_init
#define Hacl_Impl_SHA3_absorb_inner python_hashlib_Hacl_Impl_SHA3_absorb_inner #define Hacl_Hash_SHA1_update _Py_LibHacl_Hacl_Hash_SHA1_update
#define Hacl_Impl_SHA3_keccak python_hashlib_Hacl_Impl_SHA3_keccak #define Hacl_Hash_SHA1_digest _Py_LibHacl_Hacl_Hash_SHA1_digest
#define Hacl_Impl_SHA3_loadState python_hashlib_Hacl_Impl_SHA3_loadState #define Hacl_Hash_SHA1_free _Py_LibHacl_Hacl_Hash_SHA1_free
#define Hacl_Impl_SHA3_squeeze python_hashlib_Hacl_Impl_SHA3_squeeze #define Hacl_Hash_SHA1_copy _Py_LibHacl_Hacl_Hash_SHA1_copy
#define Hacl_Impl_SHA3_state_permute python_hashlib_Hacl_Impl_SHA3_state_permute #define Hacl_Hash_SHA1_hash _Py_LibHacl_Hacl_Hash_SHA1_hash
#define Hacl_SHA3_sha3_224 python_hashlib_Hacl_SHA3_sha3_224
#define Hacl_SHA3_sha3_256 python_hashlib_Hacl_SHA3_sha3_256
#define Hacl_SHA3_sha3_384 python_hashlib_Hacl_SHA3_sha3_384
#define Hacl_SHA3_sha3_512 python_hashlib_Hacl_SHA3_sha3_512
#define Hacl_SHA3_shake128_hacl python_hashlib_Hacl_SHA3_shake128_hacl
#define Hacl_SHA3_shake256_hacl python_hashlib_Hacl_SHA3_shake256_hacl
#define Hacl_Hash_SHA3_block_len python_hashlib_Hacl_Hash_SHA3_block_len
#define Hacl_Hash_SHA3_copy python_hashlib_Hacl_Hash_SHA3_copy
#define Hacl_Hash_SHA3_digest python_hashlib_Hacl_Hash_SHA3_digest
#define Hacl_Hash_SHA3_free python_hashlib_Hacl_Hash_SHA3_free
#define Hacl_Hash_SHA3_get_alg python_hashlib_Hacl_Hash_SHA3_get_alg
#define Hacl_Hash_SHA3_hash_len python_hashlib_Hacl_Hash_SHA3_hash_len
#define Hacl_Hash_SHA3_is_shake python_hashlib_Hacl_Hash_SHA3_is_shake
#define Hacl_Hash_SHA3_malloc python_hashlib_Hacl_Hash_SHA3_malloc
#define Hacl_Hash_SHA3_reset python_hashlib_Hacl_Hash_SHA3_reset
#define Hacl_Hash_SHA3_update python_hashlib_Hacl_Hash_SHA3_update
#define Hacl_Hash_SHA3_squeeze python_hashlib_Hacl_Hash_SHA3_squeeze
#define Hacl_Hash_Blake2b_Simd256_copy python_hashlib_Hacl_Hash_Blake2b_Simd256_copy #define Hacl_Hash_SHA3_update_last_sha3 _Py_LibHacl_Hacl_Hash_SHA3_update_last_sha3
#define Hacl_Hash_Blake2b_Simd256_digest python_hashlib_Hacl_Hash_Blake2b_Simd256_digest #define Hacl_Hash_SHA3_update_multi_sha3 _Py_LibHacl_Hacl_Hash_SHA3_update_multi_sha3
#define Hacl_Hash_Blake2b_Simd256_finish python_hashlib_Hacl_Hash_Blake2b_Simd256_finish #define Hacl_Impl_SHA3_absorb_inner _Py_LibHacl_Hacl_Impl_SHA3_absorb_inner
#define Hacl_Hash_Blake2b_Simd256_free python_hashlib_Hacl_Hash_Blake2b_Simd256_free #define Hacl_Impl_SHA3_keccak _Py_LibHacl_Hacl_Impl_SHA3_keccak
#define Hacl_Hash_Blake2b_Simd256_hash_with_key python_hashlib_Hacl_Hash_Blake2b_Simd256_hash_with_key #define Hacl_Impl_SHA3_loadState _Py_LibHacl_Hacl_Impl_SHA3_loadState
#define Hacl_Hash_Blake2b_Simd256_hash_with_key_and_params python_hashlib_Hacl_Hash_Blake2b_Simd256_hash_with_key_and_params #define Hacl_Impl_SHA3_squeeze _Py_LibHacl_Hacl_Impl_SHA3_squeeze
#define Hacl_Hash_Blake2b_Simd256_info python_hashlib_Hacl_Hash_Blake2b_Simd256_info #define Hacl_Impl_SHA3_state_permute _Py_LibHacl_Hacl_Impl_SHA3_state_permute
#define Hacl_Hash_Blake2b_Simd256_init python_hashlib_Hacl_Hash_Blake2b_Simd256_init #define Hacl_SHA3_sha3_224 _Py_LibHacl_Hacl_SHA3_sha3_224
#define Hacl_Hash_Blake2b_Simd256_load_state256b_from_state32 python_hashlib_Hacl_Hash_Blake2b_Simd256_load_state256b_from_state32 #define Hacl_SHA3_sha3_256 _Py_LibHacl_Hacl_SHA3_sha3_256
#define Hacl_Hash_Blake2b_Simd256_malloc python_hashlib_Hacl_Hash_Blake2b_Simd256_malloc #define Hacl_SHA3_sha3_384 _Py_LibHacl_Hacl_SHA3_sha3_384
#define Hacl_Hash_Blake2b_Simd256_malloc_with_key python_hashlib_Hacl_Hash_Blake2b_Simd256_malloc_with_key #define Hacl_SHA3_sha3_512 _Py_LibHacl_Hacl_SHA3_sha3_512
#define Hacl_Hash_Blake2b_Simd256_malloc_with_key0 python_hashlib_Hacl_Hash_Blake2b_Simd256_malloc_with_key0 #define Hacl_SHA3_shake128_hacl _Py_LibHacl_Hacl_SHA3_shake128_hacl
#define Hacl_Hash_Blake2b_Simd256_malloc_with_params_and_key python_hashlib_Hacl_Hash_Blake2b_Simd256_malloc_with_params_and_key #define Hacl_SHA3_shake256_hacl _Py_LibHacl_Hacl_SHA3_shake256_hacl
#define Hacl_Hash_Blake2b_Simd256_reset python_hashlib_Hacl_Hash_Blake2b_Simd256_reset #define Hacl_Hash_SHA3_block_len _Py_LibHacl_Hacl_Hash_SHA3_block_len
#define Hacl_Hash_Blake2b_Simd256_reset_with_key python_hashlib_Hacl_Hash_Blake2b_Simd256_reset_with_key #define Hacl_Hash_SHA3_copy _Py_LibHacl_Hacl_Hash_SHA3_copy
#define Hacl_Hash_Blake2b_Simd256_reset_with_key_and_params python_hashlib_Hacl_Hash_Blake2b_Simd256_reset_with_key_and_params #define Hacl_Hash_SHA3_digest _Py_LibHacl_Hacl_Hash_SHA3_digest
#define Hacl_Hash_Blake2b_Simd256_store_state256b_to_state32 python_hashlib_Hacl_Hash_Blake2b_Simd256_store_state256b_to_state32 #define Hacl_Hash_SHA3_free _Py_LibHacl_Hacl_Hash_SHA3_free
#define Hacl_Hash_Blake2b_Simd256_update python_hashlib_Hacl_Hash_Blake2b_Simd256_update #define Hacl_Hash_SHA3_get_alg _Py_LibHacl_Hacl_Hash_SHA3_get_alg
#define Hacl_Hash_Blake2b_Simd256_update_last python_hashlib_Hacl_Hash_Blake2b_Simd256_update_last #define Hacl_Hash_SHA3_hash_len _Py_LibHacl_Hacl_Hash_SHA3_hash_len
#define Hacl_Hash_Blake2b_Simd256_update_multi python_hashlib_Hacl_Hash_Blake2b_Simd256_update_multi #define Hacl_Hash_SHA3_is_shake _Py_LibHacl_Hacl_Hash_SHA3_is_shake
#define Hacl_Hash_Blake2b_copy python_hashlib_Hacl_Hash_Blake2b_copy #define Hacl_Hash_SHA3_init_ _Py_LibHacl_Hacl_Hash_SHA3_init_
#define Hacl_Hash_Blake2b_digest python_hashlib_Hacl_Hash_Blake2b_digest #define Hacl_Hash_SHA3_malloc _Py_LibHacl_Hacl_Hash_SHA3_malloc
#define Hacl_Hash_Blake2b_finish python_hashlib_Hacl_Hash_Blake2b_finish #define Hacl_Hash_SHA3_reset _Py_LibHacl_Hacl_Hash_SHA3_reset
#define Hacl_Hash_Blake2b_free python_hashlib_Hacl_Hash_Blake2b_free #define Hacl_Hash_SHA3_update _Py_LibHacl_Hacl_Hash_SHA3_update
#define Hacl_Hash_Blake2b_hash_with_key python_hashlib_Hacl_Hash_Blake2b_hash_with_key #define Hacl_Hash_SHA3_squeeze _Py_LibHacl_Hacl_Hash_SHA3_squeeze
#define Hacl_Hash_Blake2b_hash_with_key_and_params python_hashlib_Hacl_Hash_Blake2b_hash_with_key_and_params
#define Hacl_Hash_Blake2b_info python_hashlib_Hacl_Hash_Blake2b_info #define Hacl_Hash_Blake2b_Simd256_copy _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_copy
#define Hacl_Hash_Blake2b_init python_hashlib_Hacl_Hash_Blake2b_init #define Hacl_Hash_Blake2b_Simd256_copy_internal_state _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_copy_internal_state
#define Hacl_Hash_Blake2b_malloc python_hashlib_Hacl_Hash_Blake2b_malloc #define Hacl_Hash_Blake2b_Simd256_digest _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_digest
#define Hacl_Hash_Blake2b_malloc_with_key python_hashlib_Hacl_Hash_Blake2b_malloc_with_key #define Hacl_Hash_Blake2b_Simd256_finish _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_finish
#define Hacl_Hash_Blake2b_malloc_with_params_and_key python_hashlib_Hacl_Hash_Blake2b_malloc_with_params_and_key #define Hacl_Hash_Blake2b_Simd256_free _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_free
#define Hacl_Hash_Blake2b_reset python_hashlib_Hacl_Hash_Blake2b_reset #define Hacl_Hash_Blake2b_Simd256_hash_with_key _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_hash_with_key
#define Hacl_Hash_Blake2b_reset_with_key python_hashlib_Hacl_Hash_Blake2b_reset_with_key #define Hacl_Hash_Blake2b_Simd256_hash_with_key_and_params _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_hash_with_key_and_params
#define Hacl_Hash_Blake2b_reset_with_key_and_params python_hashlib_Hacl_Hash_Blake2b_reset_with_key_and_params #define Hacl_Hash_Blake2b_Simd256_info _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_info
#define Hacl_Hash_Blake2b_update python_hashlib_Hacl_Hash_Blake2b_update #define Hacl_Hash_Blake2b_Simd256_init _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_init
#define Hacl_Hash_Blake2b_update_last python_hashlib_Hacl_Hash_Blake2b_update_last #define Hacl_Hash_Blake2b_Simd256_load_state256b_from_state32 _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_load_state256b_from_state32
#define Hacl_Hash_Blake2b_update_multi python_hashlib_Hacl_Hash_Blake2b_update_multi #define Hacl_Hash_Blake2b_Simd256_malloc _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_malloc
#define Hacl_Hash_Blake2s_Simd128_copy python_hashlib_Hacl_Hash_Blake2s_Simd128_copy #define Hacl_Hash_Blake2b_Simd256_malloc_internal_state_with_key _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_malloc_internal_state_with_key
#define Hacl_Hash_Blake2s_Simd128_digest python_hashlib_Hacl_Hash_Blake2s_Simd128_digest #define Hacl_Hash_Blake2b_Simd256_malloc_with_key _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_malloc_with_key
#define Hacl_Hash_Blake2s_Simd128_finish python_hashlib_Hacl_Hash_Blake2s_Simd128_finish #define Hacl_Hash_Blake2b_Simd256_malloc_with_key0 _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_malloc_with_key0
#define Hacl_Hash_Blake2s_Simd128_free python_hashlib_Hacl_Hash_Blake2s_Simd128_free #define Hacl_Hash_Blake2b_Simd256_malloc_with_params_and_key _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_malloc_with_params_and_key
#define Hacl_Hash_Blake2s_Simd128_hash_with_key python_hashlib_Hacl_Hash_Blake2s_Simd128_hash_with_key #define Hacl_Hash_Blake2b_Simd256_reset _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_reset
#define Hacl_Hash_Blake2s_Simd128_hash_with_key_and_params python_hashlib_Hacl_Hash_Blake2s_Simd128_hash_with_key_and_params #define Hacl_Hash_Blake2b_Simd256_reset_with_key _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_reset_with_key
#define Hacl_Hash_Blake2s_Simd128_info python_hashlib_Hacl_Hash_Blake2s_Simd128_info #define Hacl_Hash_Blake2b_Simd256_reset_with_key_and_params _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_reset_with_key_and_params
#define Hacl_Hash_Blake2s_Simd128_init python_hashlib_Hacl_Hash_Blake2s_Simd128_init #define Hacl_Hash_Blake2b_Simd256_store_state256b_to_state32 _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_store_state256b_to_state32
#define Hacl_Hash_Blake2s_Simd128_load_state128s_from_state32 python_hashlib_Hacl_Hash_Blake2s_Simd128_load_state128s_from_state32 #define Hacl_Hash_Blake2b_Simd256_update _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_update
#define Hacl_Hash_Blake2s_Simd128_malloc python_hashlib_Hacl_Hash_Blake2s_Simd128_malloc #define Hacl_Hash_Blake2b_Simd256_update_last _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_update_last
#define Hacl_Hash_Blake2s_Simd128_malloc_with_key python_hashlib_Hacl_Hash_Blake2s_Simd128_malloc_with_key #define Hacl_Hash_Blake2b_Simd256_update_last_no_inline _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_update_last_no_inline
#define Hacl_Hash_Blake2s_Simd128_malloc_with_key0 python_hashlib_Hacl_Hash_Blake2s_Simd128_malloc_with_key0 #define Hacl_Hash_Blake2b_Simd256_update_multi _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_update_multi
#define Hacl_Hash_Blake2s_Simd128_malloc_with_params_and_key python_hashlib_Hacl_Hash_Blake2s_Simd128_malloc_with_params_and_key #define Hacl_Hash_Blake2b_Simd256_update_multi_no_inline _Py_LibHacl_Hacl_Hash_Blake2b_Simd256_update_multi_no_inline
#define Hacl_Hash_Blake2s_Simd128_reset python_hashlib_Hacl_Hash_Blake2s_Simd128_reset #define Hacl_Hash_Blake2b_copy _Py_LibHacl_Hacl_Hash_Blake2b_copy
#define Hacl_Hash_Blake2s_Simd128_reset_with_key python_hashlib_Hacl_Hash_Blake2s_Simd128_reset_with_key #define Hacl_Hash_Blake2b_digest _Py_LibHacl_Hacl_Hash_Blake2b_digest
#define Hacl_Hash_Blake2s_Simd128_reset_with_key_and_params python_hashlib_Hacl_Hash_Blake2s_Simd128_reset_with_key_and_params #define Hacl_Hash_Blake2b_finish _Py_LibHacl_Hacl_Hash_Blake2b_finish
#define Hacl_Hash_Blake2s_Simd128_store_state128s_to_state32 python_hashlib_Hacl_Hash_Blake2s_Simd128_store_state128s_to_state32 #define Hacl_Hash_Blake2b_free _Py_LibHacl_Hacl_Hash_Blake2b_free
#define Hacl_Hash_Blake2s_Simd128_update python_hashlib_Hacl_Hash_Blake2s_Simd128_update #define Hacl_Hash_Blake2b_hash_with_key _Py_LibHacl_Hacl_Hash_Blake2b_hash_with_key
#define Hacl_Hash_Blake2s_Simd128_update_last python_hashlib_Hacl_Hash_Blake2s_Simd128_update_last #define Hacl_Hash_Blake2b_hash_with_key_and_params _Py_LibHacl_Hacl_Hash_Blake2b_hash_with_key_and_params
#define Hacl_Hash_Blake2s_Simd128_update_multi python_hashlib_Hacl_Hash_Blake2s_Simd128_update_multi #define Hacl_Hash_Blake2b_info _Py_LibHacl_Hacl_Hash_Blake2b_info
#define Hacl_Hash_Blake2s_copy python_hashlib_Hacl_Hash_Blake2s_copy #define Hacl_Hash_Blake2b_init _Py_LibHacl_Hacl_Hash_Blake2b_init
#define Hacl_Hash_Blake2s_digest python_hashlib_Hacl_Hash_Blake2s_digest #define Hacl_Hash_Blake2b_malloc _Py_LibHacl_Hacl_Hash_Blake2b_malloc
#define Hacl_Hash_Blake2s_finish python_hashlib_Hacl_Hash_Blake2s_finish #define Hacl_Hash_Blake2b_malloc_with_key _Py_LibHacl_Hacl_Hash_Blake2b_malloc_with_key
#define Hacl_Hash_Blake2s_free python_hashlib_Hacl_Hash_Blake2s_free #define Hacl_Hash_Blake2b_malloc_with_params_and_key _Py_LibHacl_Hacl_Hash_Blake2b_malloc_with_params_and_key
#define Hacl_Hash_Blake2s_hash_with_key python_hashlib_Hacl_Hash_Blake2s_hash_with_key #define Hacl_Hash_Blake2b_reset _Py_LibHacl_Hacl_Hash_Blake2b_reset
#define Hacl_Hash_Blake2s_hash_with_key_and_params python_hashlib_Hacl_Hash_Blake2s_hash_with_key_and_params #define Hacl_Hash_Blake2b_reset_with_key _Py_LibHacl_Hacl_Hash_Blake2b_reset_with_key
#define Hacl_Hash_Blake2s_info python_hashlib_Hacl_Hash_Blake2s_info #define Hacl_Hash_Blake2b_reset_with_key_and_params _Py_LibHacl_Hacl_Hash_Blake2b_reset_with_key_and_params
#define Hacl_Hash_Blake2s_init python_hashlib_Hacl_Hash_Blake2s_init #define Hacl_Hash_Blake2b_update _Py_LibHacl_Hacl_Hash_Blake2b_update
#define Hacl_Hash_Blake2s_malloc python_hashlib_Hacl_Hash_Blake2s_malloc #define Hacl_Hash_Blake2b_update_last _Py_LibHacl_Hacl_Hash_Blake2b_update_last
#define Hacl_Hash_Blake2s_malloc_with_key python_hashlib_Hacl_Hash_Blake2s_malloc_with_key #define Hacl_Hash_Blake2b_update_multi _Py_LibHacl_Hacl_Hash_Blake2b_update_multi
#define Hacl_Hash_Blake2s_malloc_with_params_and_key python_hashlib_Hacl_Hash_Blake2s_malloc_with_params_and_key #define Hacl_Hash_Blake2s_Simd128_copy _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_copy
#define Hacl_Hash_Blake2s_reset python_hashlib_Hacl_Hash_Blake2s_reset #define Hacl_Hash_Blake2s_Simd128_copy_internal_state _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_copy_internal_state
#define Hacl_Hash_Blake2s_reset_with_key python_hashlib_Hacl_Hash_Blake2s_reset_with_key #define Hacl_Hash_Blake2s_Simd128_digest _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_digest
#define Hacl_Hash_Blake2s_reset_with_key_and_params python_hashlib_Hacl_Hash_Blake2s_reset_with_key_and_params #define Hacl_Hash_Blake2s_Simd128_finish _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_finish
#define Hacl_Hash_Blake2s_update python_hashlib_Hacl_Hash_Blake2s_update #define Hacl_Hash_Blake2s_Simd128_free _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_free
#define Hacl_Hash_Blake2s_update_last python_hashlib_Hacl_Hash_Blake2s_update_last #define Hacl_Hash_Blake2s_Simd128_hash_with_key _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_hash_with_key
#define Hacl_Hash_Blake2s_update_multi python_hashlib_Hacl_Hash_Blake2s_update_multi #define Hacl_Hash_Blake2s_Simd128_hash_with_key_and_params _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_hash_with_key_and_params
#define Hacl_Hash_MD5_finish python_hashlib_Hacl_Hash_MD5_finish #define Hacl_Hash_Blake2s_Simd128_info _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_info
#define Hacl_Hash_MD5_hash_oneshot python_hashlib_Hacl_Hash_MD5_hash_oneshot #define Hacl_Hash_Blake2s_Simd128_init _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_init
#define Hacl_Hash_MD5_reset python_hashlib_Hacl_Hash_MD5_reset #define Hacl_Hash_Blake2s_Simd128_load_state128s_from_state32 _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_load_state128s_from_state32
#define Hacl_Hash_MD5_update_last python_hashlib_Hacl_Hash_MD5_update_last #define Hacl_Hash_Blake2s_Simd128_malloc _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_malloc
#define Hacl_Hash_MD5_update_multi python_hashlib_Hacl_Hash_MD5_update_multi #define Hacl_Hash_Blake2s_Simd128_malloc_internal_state_with_key _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_malloc_internal_state_with_key
#define Hacl_Hash_SHA1_finish python_hashlib_Hacl_Hash_SHA1_finish #define Hacl_Hash_Blake2s_Simd128_malloc_with_key _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_malloc_with_key
#define Hacl_Hash_SHA1_hash_oneshot python_hashlib_Hacl_Hash_SHA1_hash_oneshot #define Hacl_Hash_Blake2s_Simd128_malloc_with_key0 _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_malloc_with_key0
#define Hacl_Hash_SHA1_reset python_hashlib_Hacl_Hash_SHA1_reset #define Hacl_Hash_Blake2s_Simd128_malloc_with_params_and_key _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_malloc_with_params_and_key
#define Hacl_Hash_SHA1_update_last python_hashlib_Hacl_Hash_SHA1_update_last #define Hacl_Hash_Blake2s_Simd128_reset _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_reset
#define Hacl_Hash_SHA1_update_multi python_hashlib_Hacl_Hash_SHA1_update_multi #define Hacl_Hash_Blake2s_Simd128_reset_with_key _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_reset_with_key
#define Hacl_Hash_SHA2_hash_224 python_hashlib_Hacl_Hash_SHA2_hash_224 #define Hacl_Hash_Blake2s_Simd128_reset_with_key_and_params _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_reset_with_key_and_params
#define Hacl_Hash_SHA2_hash_256 python_hashlib_Hacl_Hash_SHA2_hash_256 #define Hacl_Hash_Blake2s_Simd128_store_state128s_to_state32 _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_store_state128s_to_state32
#define Hacl_Hash_SHA2_hash_384 python_hashlib_Hacl_Hash_SHA2_hash_384 #define Hacl_Hash_Blake2s_Simd128_update _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_update
#define Hacl_Hash_SHA2_hash_512 python_hashlib_Hacl_Hash_SHA2_hash_512 #define Hacl_Hash_Blake2s_Simd128_update_last _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_update_last
#define Hacl_Hash_SHA2_reset_224 python_hashlib_Hacl_Hash_SHA2_reset_224 #define Hacl_Hash_Blake2s_Simd128_update_last_no_inline _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_update_last_no_inline
#define Hacl_Hash_SHA2_reset_256 python_hashlib_Hacl_Hash_SHA2_reset_256 #define Hacl_Hash_Blake2s_Simd128_update_multi _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_update_multi
#define Hacl_Hash_SHA2_reset_384 python_hashlib_Hacl_Hash_SHA2_reset_384 #define Hacl_Hash_Blake2s_Simd128_update_multi_no_inline _Py_LibHacl_Hacl_Hash_Blake2s_Simd128_update_multi_no_inline
#define Hacl_Hash_SHA2_reset_512 python_hashlib_Hacl_Hash_SHA2_reset_512 #define Hacl_Hash_Blake2s_copy _Py_LibHacl_Hacl_Hash_Blake2s_copy
#define Hacl_Hash_SHA2_sha224_finish python_hashlib_Hacl_Hash_SHA2_sha224_finish #define Hacl_Hash_Blake2s_digest _Py_LibHacl_Hacl_Hash_Blake2s_digest
#define Hacl_Hash_SHA2_sha224_init python_hashlib_Hacl_Hash_SHA2_sha224_init #define Hacl_Hash_Blake2s_finish _Py_LibHacl_Hacl_Hash_Blake2s_finish
#define Hacl_Hash_SHA2_sha224_update_last python_hashlib_Hacl_Hash_SHA2_sha224_update_last #define Hacl_Hash_Blake2s_free _Py_LibHacl_Hacl_Hash_Blake2s_free
#define Hacl_Hash_SHA2_sha256_finish python_hashlib_Hacl_Hash_SHA2_sha256_finish #define Hacl_Hash_Blake2s_hash_with_key _Py_LibHacl_Hacl_Hash_Blake2s_hash_with_key
#define Hacl_Hash_SHA2_sha256_init python_hashlib_Hacl_Hash_SHA2_sha256_init #define Hacl_Hash_Blake2s_hash_with_key_and_params _Py_LibHacl_Hacl_Hash_Blake2s_hash_with_key_and_params
#define Hacl_Hash_SHA2_sha256_update_last python_hashlib_Hacl_Hash_SHA2_sha256_update_last #define Hacl_Hash_Blake2s_info _Py_LibHacl_Hacl_Hash_Blake2s_info
#define Hacl_Hash_SHA2_sha256_update_nblocks python_hashlib_Hacl_Hash_SHA2_sha256_update_nblocks #define Hacl_Hash_Blake2s_init _Py_LibHacl_Hacl_Hash_Blake2s_init
#define Hacl_Hash_SHA2_sha384_finish python_hashlib_Hacl_Hash_SHA2_sha384_finish #define Hacl_Hash_Blake2s_malloc _Py_LibHacl_Hacl_Hash_Blake2s_malloc
#define Hacl_Hash_SHA2_sha384_init python_hashlib_Hacl_Hash_SHA2_sha384_init #define Hacl_Hash_Blake2s_malloc_with_key _Py_LibHacl_Hacl_Hash_Blake2s_malloc_with_key
#define Hacl_Hash_SHA2_sha384_update_last python_hashlib_Hacl_Hash_SHA2_sha384_update_last #define Hacl_Hash_Blake2s_malloc_with_params_and_key _Py_LibHacl_Hacl_Hash_Blake2s_malloc_with_params_and_key
#define Hacl_Hash_SHA2_sha384_update_nblocks python_hashlib_Hacl_Hash_SHA2_sha384_update_nblocks #define Hacl_Hash_Blake2s_reset _Py_LibHacl_Hacl_Hash_Blake2s_reset
#define Hacl_Hash_SHA2_sha512_finish python_hashlib_Hacl_Hash_SHA2_sha512_finish #define Hacl_Hash_Blake2s_reset_with_key _Py_LibHacl_Hacl_Hash_Blake2s_reset_with_key
#define Hacl_Hash_SHA2_sha512_init python_hashlib_Hacl_Hash_SHA2_sha512_init #define Hacl_Hash_Blake2s_reset_with_key_and_params _Py_LibHacl_Hacl_Hash_Blake2s_reset_with_key_and_params
#define Hacl_Hash_SHA2_sha512_update_last python_hashlib_Hacl_Hash_SHA2_sha512_update_last #define Hacl_Hash_Blake2s_update _Py_LibHacl_Hacl_Hash_Blake2s_update
#define Hacl_Hash_SHA2_sha512_update_nblocks python_hashlib_Hacl_Hash_SHA2_sha512_update_nblocks #define Hacl_Hash_Blake2s_update_last _Py_LibHacl_Hacl_Hash_Blake2s_update_last
#define Hacl_Hash_SHA3_absorb_inner_32 python_hashlib_Hacl_Hash_SHA3_absorb_inner_32 #define Hacl_Hash_Blake2s_update_multi _Py_LibHacl_Hacl_Hash_Blake2s_update_multi
#define Hacl_Hash_SHA3_keccak_piln python_hashlib_Hacl_Hash_SHA3_keccak_piln #define Hacl_Hash_MD5_finish _Py_LibHacl_Hacl_Hash_MD5_finish
#define Hacl_Hash_SHA3_keccak_rndc python_hashlib_Hacl_Hash_SHA3_keccak_rndc #define Hacl_Hash_MD5_hash_oneshot _Py_LibHacl_Hacl_Hash_MD5_hash_oneshot
#define Hacl_Hash_SHA3_keccak_rotc python_hashlib_Hacl_Hash_SHA3_keccak_rotc #define Hacl_Hash_MD5_reset _Py_LibHacl_Hacl_Hash_MD5_reset
#define Hacl_Hash_SHA3_sha3_224 python_hashlib_Hacl_Hash_SHA3_sha3_224 #define Hacl_Hash_MD5_update_last _Py_LibHacl_Hacl_Hash_MD5_update_last
#define Hacl_Hash_SHA3_sha3_256 python_hashlib_Hacl_Hash_SHA3_sha3_256 #define Hacl_Hash_MD5_update_multi _Py_LibHacl_Hacl_Hash_MD5_update_multi
#define Hacl_Hash_SHA3_sha3_384 python_hashlib_Hacl_Hash_SHA3_sha3_384 #define Hacl_Hash_SHA1_finish _Py_LibHacl_Hacl_Hash_SHA1_finish
#define Hacl_Hash_SHA3_sha3_512 python_hashlib_Hacl_Hash_SHA3_sha3_512 #define Hacl_Hash_SHA1_hash_oneshot _Py_LibHacl_Hacl_Hash_SHA1_hash_oneshot
#define Hacl_Hash_SHA3_shake128 python_hashlib_Hacl_Hash_SHA3_shake128 #define Hacl_Hash_SHA1_reset _Py_LibHacl_Hacl_Hash_SHA1_reset
#define Hacl_Hash_SHA3_shake128_absorb_final python_hashlib_Hacl_Hash_SHA3_shake128_absorb_final #define Hacl_Hash_SHA1_update_last _Py_LibHacl_Hacl_Hash_SHA1_update_last
#define Hacl_Hash_SHA3_shake128_absorb_nblocks python_hashlib_Hacl_Hash_SHA3_shake128_absorb_nblocks #define Hacl_Hash_SHA1_update_multi _Py_LibHacl_Hacl_Hash_SHA1_update_multi
#define Hacl_Hash_SHA3_shake128_squeeze_nblocks python_hashlib_Hacl_Hash_SHA3_shake128_squeeze_nblocks #define Hacl_Hash_SHA2_hash_224 _Py_LibHacl_Hacl_Hash_SHA2_hash_224
#define Hacl_Hash_SHA3_shake256 python_hashlib_Hacl_Hash_SHA3_shake256 #define Hacl_Hash_SHA2_hash_256 _Py_LibHacl_Hacl_Hash_SHA2_hash_256
#define Hacl_Hash_SHA3_state_free python_hashlib_Hacl_Hash_SHA3_state_free #define Hacl_Hash_SHA2_hash_384 _Py_LibHacl_Hacl_Hash_SHA2_hash_384
#define Hacl_Hash_SHA3_state_malloc python_hashlib_Hacl_Hash_SHA3_state_malloc #define Hacl_Hash_SHA2_hash_512 _Py_LibHacl_Hacl_Hash_SHA2_hash_512
#define Hacl_Hash_SHA2_reset_224 _Py_LibHacl_Hacl_Hash_SHA2_reset_224
#define Hacl_Hash_SHA2_reset_256 _Py_LibHacl_Hacl_Hash_SHA2_reset_256
#define Hacl_Hash_SHA2_reset_384 _Py_LibHacl_Hacl_Hash_SHA2_reset_384
#define Hacl_Hash_SHA2_reset_512 _Py_LibHacl_Hacl_Hash_SHA2_reset_512
#define Hacl_Hash_SHA2_sha224_finish _Py_LibHacl_Hacl_Hash_SHA2_sha224_finish
#define Hacl_Hash_SHA2_sha224_init _Py_LibHacl_Hacl_Hash_SHA2_sha224_init
#define Hacl_Hash_SHA2_sha224_update_last _Py_LibHacl_Hacl_Hash_SHA2_sha224_update_last
#define Hacl_Hash_SHA2_sha224_update_nblocks _Py_LibHacl_Hacl_Hash_SHA2_sha224_update_nblocks
#define Hacl_Hash_SHA2_sha256_finish _Py_LibHacl_Hacl_Hash_SHA2_sha256_finish
#define Hacl_Hash_SHA2_sha256_init _Py_LibHacl_Hacl_Hash_SHA2_sha256_init
#define Hacl_Hash_SHA2_sha256_update_last _Py_LibHacl_Hacl_Hash_SHA2_sha256_update_last
#define Hacl_Hash_SHA2_sha256_update_nblocks _Py_LibHacl_Hacl_Hash_SHA2_sha256_update_nblocks
#define Hacl_Hash_SHA2_sha384_finish _Py_LibHacl_Hacl_Hash_SHA2_sha384_finish
#define Hacl_Hash_SHA2_sha384_init _Py_LibHacl_Hacl_Hash_SHA2_sha384_init
#define Hacl_Hash_SHA2_sha384_update_last _Py_LibHacl_Hacl_Hash_SHA2_sha384_update_last
#define Hacl_Hash_SHA2_sha384_update_nblocks _Py_LibHacl_Hacl_Hash_SHA2_sha384_update_nblocks
#define Hacl_Hash_SHA2_sha512_finish _Py_LibHacl_Hacl_Hash_SHA2_sha512_finish
#define Hacl_Hash_SHA2_sha512_init _Py_LibHacl_Hacl_Hash_SHA2_sha512_init
#define Hacl_Hash_SHA2_sha512_update_last _Py_LibHacl_Hacl_Hash_SHA2_sha512_update_last
#define Hacl_Hash_SHA2_sha512_update_nblocks _Py_LibHacl_Hacl_Hash_SHA2_sha512_update_nblocks
#define Hacl_Hash_SHA3_absorb_inner_32 _Py_LibHacl_Hacl_Hash_SHA3_absorb_inner_32
#define Hacl_Hash_SHA3_keccak_piln _Py_LibHacl_Hacl_Hash_SHA3_keccak_piln
#define Hacl_Hash_SHA3_keccak_rndc _Py_LibHacl_Hacl_Hash_SHA3_keccak_rndc
#define Hacl_Hash_SHA3_keccak_rotc _Py_LibHacl_Hacl_Hash_SHA3_keccak_rotc
#define Hacl_Hash_SHA3_sha3_224 _Py_LibHacl_Hacl_Hash_SHA3_sha3_224
#define Hacl_Hash_SHA3_sha3_256 _Py_LibHacl_Hacl_Hash_SHA3_sha3_256
#define Hacl_Hash_SHA3_sha3_384 _Py_LibHacl_Hacl_Hash_SHA3_sha3_384
#define Hacl_Hash_SHA3_sha3_512 _Py_LibHacl_Hacl_Hash_SHA3_sha3_512
#define Hacl_Hash_SHA3_shake128 _Py_LibHacl_Hacl_Hash_SHA3_shake128
#define Hacl_Hash_SHA3_shake128_absorb_final _Py_LibHacl_Hacl_Hash_SHA3_shake128_absorb_final
#define Hacl_Hash_SHA3_shake128_absorb_nblocks _Py_LibHacl_Hacl_Hash_SHA3_shake128_absorb_nblocks
#define Hacl_Hash_SHA3_shake128_squeeze_nblocks _Py_LibHacl_Hacl_Hash_SHA3_shake128_squeeze_nblocks
#define Hacl_Hash_SHA3_shake256 _Py_LibHacl_Hacl_Hash_SHA3_shake256
#define Hacl_Hash_SHA3_state_free _Py_LibHacl_Hacl_Hash_SHA3_state_free
#define Hacl_Hash_SHA3_state_malloc _Py_LibHacl_Hacl_Hash_SHA3_state_malloc
// Streaming HMAC // Streaming HMAC
#define Hacl_Streaming_HMAC_malloc_ python_hashlib_Hacl_Streaming_HMAC_malloc_ #define Hacl_Streaming_HMAC_index_of_state _Py_LibHacl_Hacl_Streaming_HMAC_index_of_state
#define Hacl_Streaming_HMAC_get_impl python_hashlib_Hacl_Streaming_HMAC_get_impl #define Hacl_Streaming_HMAC_malloc_ _Py_LibHacl_Hacl_Streaming_HMAC_malloc_
#define Hacl_Streaming_HMAC_reset python_hashlib_Hacl_Streaming_HMAC_reset #define Hacl_Streaming_HMAC_get_impl _Py_LibHacl_Hacl_Streaming_HMAC_get_impl
#define Hacl_Streaming_HMAC_update python_hashlib_Hacl_Streaming_HMAC_update #define Hacl_Streaming_HMAC_reset _Py_LibHacl_Hacl_Streaming_HMAC_reset
#define Hacl_Streaming_HMAC_digest python_hashlib_Hacl_Streaming_HMAC_digest #define Hacl_Streaming_HMAC_update _Py_LibHacl_Hacl_Streaming_HMAC_update
#define Hacl_Streaming_HMAC_copy python_hashlib_Hacl_Streaming_HMAC_copy #define Hacl_Streaming_HMAC_digest _Py_LibHacl_Hacl_Streaming_HMAC_digest
#define Hacl_Streaming_HMAC_free python_hashlib_Hacl_Streaming_HMAC_free #define Hacl_Streaming_HMAC_copy _Py_LibHacl_Hacl_Streaming_HMAC_copy
#define Hacl_Streaming_HMAC_free _Py_LibHacl_Hacl_Streaming_HMAC_free
#define Hacl_Streaming_HMAC_s1 _Py_LibHacl_Hacl_Streaming_HMAC_s1
#define Hacl_Streaming_HMAC_s2 _Py_LibHacl_Hacl_Streaming_HMAC_s2
// HMAC-MD5 // HMAC-MD5
#define Hacl_HMAC_compute_md5 python_hashlib_Hacl_HMAC_compute_md5 #define Hacl_HMAC_compute_md5 _Py_LibHacl_Hacl_HMAC_compute_md5
// HMAC-SHA-1 // HMAC-SHA-1
#define Hacl_HMAC_compute_sha1 python_hashlib_Hacl_HMAC_compute_sha1 #define Hacl_HMAC_compute_sha1 _Py_LibHacl_Hacl_HMAC_compute_sha1
// HMAC-SHA-2 // HMAC-SHA-2
#define Hacl_HMAC_compute_sha2_224 python_hashlib_Hacl_HMAC_compute_sha2_224 #define Hacl_HMAC_compute_sha2_224 _Py_LibHacl_Hacl_HMAC_compute_sha2_224
#define Hacl_HMAC_compute_sha2_256 python_hashlib_Hacl_HMAC_compute_sha2_256 #define Hacl_HMAC_compute_sha2_256 _Py_LibHacl_Hacl_HMAC_compute_sha2_256
#define Hacl_HMAC_compute_sha2_384 python_hashlib_Hacl_HMAC_compute_sha2_384 #define Hacl_HMAC_compute_sha2_384 _Py_LibHacl_Hacl_HMAC_compute_sha2_384
#define Hacl_HMAC_compute_sha2_512 python_hashlib_Hacl_HMAC_compute_sha2_512 #define Hacl_HMAC_compute_sha2_512 _Py_LibHacl_Hacl_HMAC_compute_sha2_512
// HMAC-SHA-3 // HMAC-SHA-3
#define Hacl_HMAC_compute_sha3_224 python_hashlib_Hacl_HMAC_compute_sha3_224 #define Hacl_HMAC_compute_sha3_224 _Py_LibHacl_Hacl_HMAC_compute_sha3_224
#define Hacl_HMAC_compute_sha3_256 python_hashlib_Hacl_HMAC_compute_sha3_256 #define Hacl_HMAC_compute_sha3_256 _Py_LibHacl_Hacl_HMAC_compute_sha3_256
#define Hacl_HMAC_compute_sha3_384 python_hashlib_Hacl_HMAC_compute_sha3_384 #define Hacl_HMAC_compute_sha3_384 _Py_LibHacl_Hacl_HMAC_compute_sha3_384
#define Hacl_HMAC_compute_sha3_512 python_hashlib_Hacl_HMAC_compute_sha3_512 #define Hacl_HMAC_compute_sha3_512 _Py_LibHacl_Hacl_HMAC_compute_sha3_512
// HMAC-BLAKE // HMAC-BLAKE
#define Hacl_HMAC_compute_blake2s_32 python_hashlib_Hacl_HMAC_compute_blake2s_32 #define Hacl_HMAC_compute_blake2s_32 _Py_LibHacl_Hacl_HMAC_compute_blake2s_32
#define Hacl_HMAC_compute_blake2b_32 python_hashlib_Hacl_HMAC_compute_blake2b_32 #define Hacl_HMAC_compute_blake2b_32 _Py_LibHacl_Hacl_HMAC_compute_blake2b_32
#endif // _PYTHON_HACL_NAMESPACES_H #endif // _PYTHON_HACL_NAMESPACES_H

View file

@ -145,6 +145,9 @@ $sed -i -z 's!#include <string.h>!#include <string.h>\n#include "python_hacl_nam
Hacl_HMAC.h \ Hacl_HMAC.h \
Hacl_Streaming_HMAC.h Hacl_Streaming_HMAC.h
$sed -i -z 's!#include <inttypes.h>!#include <inttypes.h>\n#include "python_hacl_namespaces.h"!' \
lib_memzero0.h
# Step 3: trim whitespace (for the linter) # Step 3: trim whitespace (for the linter)
find . -name '*.c' -or -name '*.h' | xargs $sed -i 's![[:space:]]\+$!!' find . -name '*.c' -or -name '*.h' | xargs $sed -i 's![[:space:]]\+$!!'

View file

@ -252,11 +252,13 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
case $doconfig in case $doconfig in
no) no)
cc="$cc $cpps \$(PY_STDMODULE_CFLAGS) \$(CCSHARED)" cc="$cc $cpps \$(PY_STDMODULE_CFLAGS) \$(CCSHARED)"
rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(MODULE_DEPS_SHARED) \$(PYTHON_HEADERS); $cc -c $src -o $obj" rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(MODULE_DEPS_SHARED) \$(PYTHON_HEADERS)"
rule="$rule; $cc -c $src -o $obj"
;; ;;
*) *)
cc="$cc $cpps \$(PY_BUILTIN_MODULE_CFLAGS)" cc="$cc $cpps \$(PY_BUILTIN_MODULE_CFLAGS)"
rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(MODULE_DEPS_STATIC) \$(PYTHON_HEADERS); $cc -c $src -o $obj" rule="$obj: $src \$(MODULE_${mods_upper}_DEPS) \$(MODULE_DEPS_STATIC) \$(PYTHON_HEADERS)"
rule="$rule; $cc -c $src -o $obj"
;; ;;
esac esac
echo "$rule" >>$rulesf echo "$rule" >>$rulesf
@ -273,7 +275,7 @@ sed -e 's/[ ]*#.*//' -e '/^[ ]*$/d' |
BUILT_SHARED="$BUILT_SHARED $mod" BUILT_SHARED="$BUILT_SHARED $mod"
;; ;;
esac esac
rule="$file: $objs" rule="$file: $objs \$(MODULE_${mods_upper}_LDEPS)"
rule="$rule; \$(BLDSHARED) $objs $libs \$(LIBPYTHON) -o $file" rule="$rule; \$(BLDSHARED) $objs $libs \$(LIBPYTHON) -o $file"
echo "$rule" >>$rulesf echo "$rule" >>$rulesf
done done

520
configure generated vendored
View file

@ -708,11 +708,6 @@ MODULE__CTYPES_FALSE
MODULE__CTYPES_TRUE MODULE__CTYPES_TRUE
MODULE__HMAC_FALSE MODULE__HMAC_FALSE
MODULE__HMAC_TRUE MODULE__HMAC_TRUE
LIBHACL_SIMD256_OBJS
LIBHACL_SIMD256_FLAGS
LIBHACL_SIMD128_OBJS
LIBHACL_SIMD128_FLAGS
LIBHACL_CFLAGS
MODULE__BLAKE2_FALSE MODULE__BLAKE2_FALSE
MODULE__BLAKE2_TRUE MODULE__BLAKE2_TRUE
MODULE__SHA3_FALSE MODULE__SHA3_FALSE
@ -723,6 +718,13 @@ MODULE__SHA1_FALSE
MODULE__SHA1_TRUE MODULE__SHA1_TRUE
MODULE__MD5_FALSE MODULE__MD5_FALSE
MODULE__MD5_TRUE MODULE__MD5_TRUE
LIBHACL_LDEPS_LIBTYPE
LIBHACL_BLAKE2_SIMD256_OBJS
LIBHACL_SIMD256_FLAGS
LIBHACL_BLAKE2_SIMD128_OBJS
LIBHACL_SIMD128_FLAGS
LIBHACL_LDFLAGS
LIBHACL_CFLAGS
MODULE_UNICODEDATA_FALSE MODULE_UNICODEDATA_FALSE
MODULE_UNICODEDATA_TRUE MODULE_UNICODEDATA_TRUE
MODULE__MULTIBYTECODEC_FALSE MODULE__MULTIBYTECODEC_FALSE
@ -31912,221 +31914,54 @@ then :
fi fi
###############################################################################
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _md5" >&5 # HACL* compilation and linking configuration (contact: @picnixz)
printf %s "checking for stdlib extension module _md5... " >&6; } #
if test "$py_cv_module__md5" != "n/a" # Used by the HACL*-based implementations of cryptographic primitives.
then : #
# CPython provides a vendored copy of a subset of the HACL* project used
if test "$with_builtin_md5" = yes # to build extension modules of cryptographic primitives. On WASI, HACL*
then : # sources must be statically linked with the extension modules; on other
if true # platforms, the extension modules may assume that HACL* has been compiled
then : # as a shared library.
py_cv_module__md5=yes #
else case e in #( # Example for MD5:
e) py_cv_module__md5=missing ;; #
esac # * Compile Modules/_hacl/Hacl_Hash_MD5.c into Modules/_hacl/Hacl_Hash_MD5.o.
fi # * Decide whether the object files are to be passed to the linker (emulate
else case e in #( # a shared library without having to install it) or if we need to create
e) py_cv_module__md5=disabled ;; # a static library for WASI. The following summarizes the values taken by
esac # the MODULE_<NAME>_LDFLAGS variable depending on the linkage type:
fi # - shared: MODULE__MD5_LDFLAGS is set to LIBHACL_MD5_OBJS
# - static: MODULE__MD5_LDFLAGS is set to Modules/_hacl/libHacl_Hash_MD5.a
fi # * Compile Modules/md5module.c into Modules/md5module.o.
as_fn_append MODULE_BLOCK "MODULE__MD5_STATE=$py_cv_module__md5$as_nl" # * Link Modules/md5module.o using $(MODULE__MD5_LDFLAGS)
if test "x$py_cv_module__md5" = xyes # and get Modules/_md5$(EXT_SUFFIX).
then : #
# LIBHACL_FLAG_I: '-I' flags passed to $(CC) for HACL* and HACL*-based modules
# LIBHACL_FLAG_D: '-D' flags passed to $(CC) for HACL* and HACL*-based modules
# LIBHACL_CFLAGS: compiler flags passed for HACL* and HACL*-based modules
# LIBHACL_LDFLAGS: linker flags passed for HACL* and HACL*-based modules
fi LIBHACL_FLAG_I='-I$(srcdir)/Modules/_hacl -I$(srcdir)/Modules/_hacl/include'
if test "$py_cv_module__md5" = yes; then LIBHACL_FLAG_D='-D_BSD_SOURCE -D_DEFAULT_SOURCE'
MODULE__MD5_TRUE=
MODULE__MD5_FALSE='#'
else
MODULE__MD5_TRUE='#'
MODULE__MD5_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__md5" >&5
printf "%s\n" "$py_cv_module__md5" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha1" >&5
printf %s "checking for stdlib extension module _sha1... " >&6; }
if test "$py_cv_module__sha1" != "n/a"
then :
if test "$with_builtin_sha1" = yes
then :
if true
then :
py_cv_module__sha1=yes
else case e in #(
e) py_cv_module__sha1=missing ;;
esac
fi
else case e in #(
e) py_cv_module__sha1=disabled ;;
esac
fi
fi
as_fn_append MODULE_BLOCK "MODULE__SHA1_STATE=$py_cv_module__sha1$as_nl"
if test "x$py_cv_module__sha1" = xyes
then :
fi
if test "$py_cv_module__sha1" = yes; then
MODULE__SHA1_TRUE=
MODULE__SHA1_FALSE='#'
else
MODULE__SHA1_TRUE='#'
MODULE__SHA1_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha1" >&5
printf "%s\n" "$py_cv_module__sha1" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha2" >&5
printf %s "checking for stdlib extension module _sha2... " >&6; }
if test "$py_cv_module__sha2" != "n/a"
then :
if test "$with_builtin_sha2" = yes
then :
if true
then :
py_cv_module__sha2=yes
else case e in #(
e) py_cv_module__sha2=missing ;;
esac
fi
else case e in #(
e) py_cv_module__sha2=disabled ;;
esac
fi
fi
as_fn_append MODULE_BLOCK "MODULE__SHA2_STATE=$py_cv_module__sha2$as_nl"
if test "x$py_cv_module__sha2" = xyes
then :
fi
if test "$py_cv_module__sha2" = yes; then
MODULE__SHA2_TRUE=
MODULE__SHA2_FALSE='#'
else
MODULE__SHA2_TRUE='#'
MODULE__SHA2_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha2" >&5
printf "%s\n" "$py_cv_module__sha2" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha3" >&5
printf %s "checking for stdlib extension module _sha3... " >&6; }
if test "$py_cv_module__sha3" != "n/a"
then :
if test "$with_builtin_sha3" = yes
then :
if true
then :
py_cv_module__sha3=yes
else case e in #(
e) py_cv_module__sha3=missing ;;
esac
fi
else case e in #(
e) py_cv_module__sha3=disabled ;;
esac
fi
fi
as_fn_append MODULE_BLOCK "MODULE__SHA3_STATE=$py_cv_module__sha3$as_nl"
if test "x$py_cv_module__sha3" = xyes
then :
fi
if test "$py_cv_module__sha3" = yes; then
MODULE__SHA3_TRUE=
MODULE__SHA3_FALSE='#'
else
MODULE__SHA3_TRUE='#'
MODULE__SHA3_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha3" >&5
printf "%s\n" "$py_cv_module__sha3" >&6; }
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _blake2" >&5
printf %s "checking for stdlib extension module _blake2... " >&6; }
if test "$py_cv_module__blake2" != "n/a"
then :
if test "$with_builtin_blake2" = yes
then :
if true
then :
py_cv_module__blake2=yes
else case e in #(
e) py_cv_module__blake2=missing ;;
esac
fi
else case e in #(
e) py_cv_module__blake2=disabled ;;
esac
fi
fi
as_fn_append MODULE_BLOCK "MODULE__BLAKE2_STATE=$py_cv_module__blake2$as_nl"
if test "x$py_cv_module__blake2" = xyes
then :
fi
if test "$py_cv_module__blake2" = yes; then
MODULE__BLAKE2_TRUE=
MODULE__BLAKE2_FALSE='#'
else
MODULE__BLAKE2_TRUE='#'
MODULE__BLAKE2_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__blake2" >&5
printf "%s\n" "$py_cv_module__blake2" >&6; }
LIBHACL_CFLAGS='-I$(srcdir)/Modules/_hacl -I$(srcdir)/Modules/_hacl/include -D_BSD_SOURCE -D_DEFAULT_SOURCE $(PY_STDMODULE_CFLAGS) $(CCSHARED)'
case "$ac_sys_system" in case "$ac_sys_system" in
Linux*) Linux*)
if test "$ac_cv_func_explicit_bzero" = "no"; then if test "$ac_cv_func_explicit_bzero" = "no"; then
LIBHACL_CFLAGS="$LIBHACL_CFLAGS -DLINUX_NO_EXPLICIT_BZERO" LIBHACL_FLAG_D="${LIBHACL_FLAG_D} -DLINUX_NO_EXPLICIT_BZERO"
fi fi
;; ;;
esac esac
LIBHACL_CFLAGS="${LIBHACL_FLAG_I} ${LIBHACL_FLAG_D} \$(PY_STDMODULE_CFLAGS) \$(CCSHARED)"
LIBHACL_LDFLAGS= # for now, no specific linker flags are needed
# The SIMD files use aligned_alloc, which is not available on older versions of # The SIMD files use aligned_alloc, which is not available on older versions of
# Android. # Android.
# The *mmintrin.h headers are x86-family-specific, so can't be used on WASI. # The *mmintrin.h headers are x86-family-specific, so can't be used on WASI.
if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || \
{ test -n "$ANDROID_API_LEVEL" && test "$ANDROID_API_LEVEL" -ge 28; }
then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -msse -msse2 -msse3 -msse4.1 -msse4.2" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -msse -msse2 -msse3 -msse4.1 -msse4.2" >&5
printf %s "checking whether C compiler accepts -msse -msse2 -msse3 -msse4.1 -msse4.2... " >&6; } printf %s "checking whether C compiler accepts -msse -msse2 -msse3 -msse4.1 -msse4.2... " >&6; }
if test ${ax_cv_check_cflags__Werror__msse__msse2__msse3__msse4_1__msse4_2+y} if test ${ax_cv_check_cflags__Werror__msse__msse2__msse3__msse4_1__msse4_2+y}
@ -32175,11 +32010,11 @@ printf "%s\n" "#define HACL_CAN_COMPILE_SIMD128 1" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for HACL* SIMD128 implementation" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for HACL* SIMD128 implementation" >&5
printf %s "checking for HACL* SIMD128 implementation... " >&6; } printf %s "checking for HACL* SIMD128 implementation... " >&6; }
if test "$UNIVERSAL_ARCHS" == "universal2"; then if test "$UNIVERSAL_ARCHS" == "universal2"; then
LIBHACL_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o" LIBHACL_BLAKE2_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: universal2" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: universal2" >&5
printf "%s\n" "universal2" >&6; } printf "%s\n" "universal2" >&6; }
else else
LIBHACL_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o" LIBHACL_BLAKE2_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: standard" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: standard" >&5
printf "%s\n" "standard" >&6; } printf "%s\n" "standard" >&6; }
fi fi
@ -32201,7 +32036,9 @@ fi
# Although AVX support is not guaranteed on Android # Although AVX support is not guaranteed on Android
# (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a # (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a
# runtime CPUID check. # runtime CPUID check.
if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || \
{ test -n "$ANDROID_API_LEVEL" && test "$ANDROID_API_LEVEL" -ge 28; }
then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -mavx2" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -mavx2" >&5
printf %s "checking whether C compiler accepts -mavx2... " >&6; } printf %s "checking whether C compiler accepts -mavx2... " >&6; }
if test ${ax_cv_check_cflags__Werror__mavx2+y} if test ${ax_cv_check_cflags__Werror__mavx2+y}
@ -32250,11 +32087,11 @@ printf "%s\n" "#define HACL_CAN_COMPILE_SIMD256 1" >>confdefs.h
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for HACL* SIMD256 implementation" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for HACL* SIMD256 implementation" >&5
printf %s "checking for HACL* SIMD256 implementation... " >&6; } printf %s "checking for HACL* SIMD256 implementation... " >&6; }
if test "$UNIVERSAL_ARCHS" == "universal2"; then if test "$UNIVERSAL_ARCHS" == "universal2"; then
LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o" LIBHACL_BLAKE2_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: universal2" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: universal2" >&5
printf "%s\n" "universal2" >&6; } printf "%s\n" "universal2" >&6; }
else else
LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o" LIBHACL_BLAKE2_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o"
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: standard" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: standard" >&5
printf "%s\n" "standard" >&6; } printf "%s\n" "standard" >&6; }
fi fi
@ -32267,7 +32104,257 @@ fi
fi fi
### end(HACL* configuration)
###############################################################################
# HACL*-based cryptographic primitives
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for HACL* library linking type" >&5
printf %s "checking for HACL* library linking type... " >&6; }
if test "$ac_sys_system" = "WASI"; then
LIBHACL_LDEPS_LIBTYPE=STATIC
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: static" >&5
printf "%s\n" "static" >&6; }
else
LIBHACL_LDEPS_LIBTYPE=SHARED
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: shared" >&5
printf "%s\n" "shared" >&6; }
fi
# Used to complete the "MODULE_<NAME>_LDEPS" Makefile variable.
# The LDEPS variable is a Makefile rule prerequisite.
LIBHACL_MD5_LDFLAGS=LIBHACL_MD5_LIB_${LIBHACL_LDEPS_LIBTYPE}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _md5" >&5
printf %s "checking for stdlib extension module _md5... " >&6; }
if test "$py_cv_module__md5" != "n/a"
then :
if test "$with_builtin_md5" = yes
then :
if true
then :
py_cv_module__md5=yes
else case e in #(
e) py_cv_module__md5=missing ;;
esac
fi
else case e in #(
e) py_cv_module__md5=disabled ;;
esac
fi
fi
as_fn_append MODULE_BLOCK "MODULE__MD5_STATE=$py_cv_module__md5$as_nl"
if test "x$py_cv_module__md5" = xyes
then :
as_fn_append MODULE_BLOCK "MODULE__MD5_CFLAGS=$LIBHACL_CFLAGS$as_nl"
as_fn_append MODULE_BLOCK "MODULE__MD5_LDFLAGS=\$($LIBHACL_MD5_LDFLAGS)$as_nl"
fi
if test "$py_cv_module__md5" = yes; then
MODULE__MD5_TRUE=
MODULE__MD5_FALSE='#'
else
MODULE__MD5_TRUE='#'
MODULE__MD5_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__md5" >&5
printf "%s\n" "$py_cv_module__md5" >&6; }
LIBHACL_SHA1_LDFLAGS=LIBHACL_SHA1_LIB_${LIBHACL_LDEPS_LIBTYPE}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha1" >&5
printf %s "checking for stdlib extension module _sha1... " >&6; }
if test "$py_cv_module__sha1" != "n/a"
then :
if test "$with_builtin_sha1" = yes
then :
if true
then :
py_cv_module__sha1=yes
else case e in #(
e) py_cv_module__sha1=missing ;;
esac
fi
else case e in #(
e) py_cv_module__sha1=disabled ;;
esac
fi
fi
as_fn_append MODULE_BLOCK "MODULE__SHA1_STATE=$py_cv_module__sha1$as_nl"
if test "x$py_cv_module__sha1" = xyes
then :
as_fn_append MODULE_BLOCK "MODULE__SHA1_CFLAGS=$LIBHACL_CFLAGS$as_nl"
as_fn_append MODULE_BLOCK "MODULE__SHA1_LDFLAGS=\$($LIBHACL_SHA1_LDFLAGS)$as_nl"
fi
if test "$py_cv_module__sha1" = yes; then
MODULE__SHA1_TRUE=
MODULE__SHA1_FALSE='#'
else
MODULE__SHA1_TRUE='#'
MODULE__SHA1_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha1" >&5
printf "%s\n" "$py_cv_module__sha1" >&6; }
LIBHACL_SHA2_LDFLAGS=LIBHACL_SHA2_LIB_${LIBHACL_LDEPS_LIBTYPE}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha2" >&5
printf %s "checking for stdlib extension module _sha2... " >&6; }
if test "$py_cv_module__sha2" != "n/a"
then :
if test "$with_builtin_sha2" = yes
then :
if true
then :
py_cv_module__sha2=yes
else case e in #(
e) py_cv_module__sha2=missing ;;
esac
fi
else case e in #(
e) py_cv_module__sha2=disabled ;;
esac
fi
fi
as_fn_append MODULE_BLOCK "MODULE__SHA2_STATE=$py_cv_module__sha2$as_nl"
if test "x$py_cv_module__sha2" = xyes
then :
as_fn_append MODULE_BLOCK "MODULE__SHA2_CFLAGS=$LIBHACL_CFLAGS$as_nl"
as_fn_append MODULE_BLOCK "MODULE__SHA2_LDFLAGS=\$($LIBHACL_SHA2_LDFLAGS)$as_nl"
fi
if test "$py_cv_module__sha2" = yes; then
MODULE__SHA2_TRUE=
MODULE__SHA2_FALSE='#'
else
MODULE__SHA2_TRUE='#'
MODULE__SHA2_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha2" >&5
printf "%s\n" "$py_cv_module__sha2" >&6; }
LIBHACL_SHA3_LDFLAGS=LIBHACL_SHA3_LIB_${LIBHACL_LDEPS_LIBTYPE}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _sha3" >&5
printf %s "checking for stdlib extension module _sha3... " >&6; }
if test "$py_cv_module__sha3" != "n/a"
then :
if test "$with_builtin_sha3" = yes
then :
if true
then :
py_cv_module__sha3=yes
else case e in #(
e) py_cv_module__sha3=missing ;;
esac
fi
else case e in #(
e) py_cv_module__sha3=disabled ;;
esac
fi
fi
as_fn_append MODULE_BLOCK "MODULE__SHA3_STATE=$py_cv_module__sha3$as_nl"
if test "x$py_cv_module__sha3" = xyes
then :
as_fn_append MODULE_BLOCK "MODULE__SHA3_CFLAGS=$LIBHACL_CFLAGS$as_nl"
as_fn_append MODULE_BLOCK "MODULE__SHA3_LDFLAGS=\$($LIBHACL_SHA3_LDFLAGS)$as_nl"
fi
if test "$py_cv_module__sha3" = yes; then
MODULE__SHA3_TRUE=
MODULE__SHA3_FALSE='#'
else
MODULE__SHA3_TRUE='#'
MODULE__SHA3_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__sha3" >&5
printf "%s\n" "$py_cv_module__sha3" >&6; }
LIBHACL_BLAKE2_LDFLAGS=LIBHACL_BLAKE2_LIB_${LIBHACL_LDEPS_LIBTYPE}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _blake2" >&5
printf %s "checking for stdlib extension module _blake2... " >&6; }
if test "$py_cv_module__blake2" != "n/a"
then :
if test "$with_builtin_blake2" = yes
then :
if true
then :
py_cv_module__blake2=yes
else case e in #(
e) py_cv_module__blake2=missing ;;
esac
fi
else case e in #(
e) py_cv_module__blake2=disabled ;;
esac
fi
fi
as_fn_append MODULE_BLOCK "MODULE__BLAKE2_STATE=$py_cv_module__blake2$as_nl"
if test "x$py_cv_module__blake2" = xyes
then :
as_fn_append MODULE_BLOCK "MODULE__BLAKE2_CFLAGS=$LIBHACL_CFLAGS$as_nl"
as_fn_append MODULE_BLOCK "MODULE__BLAKE2_LDFLAGS=\$($LIBHACL_BLAKE2_LDFLAGS)$as_nl"
fi
if test "$py_cv_module__blake2" = yes; then
MODULE__BLAKE2_TRUE=
MODULE__BLAKE2_FALSE='#'
else
MODULE__BLAKE2_TRUE='#'
MODULE__BLAKE2_FALSE=
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $py_cv_module__blake2" >&5
printf "%s\n" "$py_cv_module__blake2" >&6; }
LIBHACL_HMAC_LDFLAGS=LIBHACL_HMAC_LIB_${LIBHACL_LDEPS_LIBTYPE}
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _hmac" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _hmac" >&5
printf %s "checking for stdlib extension module _hmac... " >&6; } printf %s "checking for stdlib extension module _hmac... " >&6; }
@ -32294,7 +32381,7 @@ fi
then : then :
as_fn_append MODULE_BLOCK "MODULE__HMAC_CFLAGS=$LIBHACL_CFLAGS$as_nl" as_fn_append MODULE_BLOCK "MODULE__HMAC_CFLAGS=$LIBHACL_CFLAGS$as_nl"
as_fn_append MODULE_BLOCK "MODULE__HMAC_LDFLAGS=$LIBHACL_CFLAGS Modules/_hacl/libHacl_HMAC.a$as_nl" as_fn_append MODULE_BLOCK "MODULE__HMAC_LDFLAGS=\$($LIBHACL_HMAC_LDFLAGS)$as_nl"
fi fi
if test "$py_cv_module__hmac" = yes; then if test "$py_cv_module__hmac" = yes; then
@ -32310,6 +32397,9 @@ printf "%s\n" "$py_cv_module__hmac" >&6; }
### end(cryptographic primitives)
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _ctypes" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdlib extension module _ctypes" >&5
printf %s "checking for stdlib extension module _ctypes... " >&6; } printf %s "checking for stdlib extension module _ctypes... " >&6; }
if test "$py_cv_module__ctypes" != "n/a" if test "$py_cv_module__ctypes" != "n/a"

View file

@ -7846,28 +7846,54 @@ PY_STDLIB_MOD_SIMPLE([_codecs_tw])
PY_STDLIB_MOD_SIMPLE([_multibytecodec]) PY_STDLIB_MOD_SIMPLE([_multibytecodec])
PY_STDLIB_MOD_SIMPLE([unicodedata]) PY_STDLIB_MOD_SIMPLE([unicodedata])
dnl By default we always compile these even when OpenSSL is available ###############################################################################
dnl (issue #14693). The modules are small. # HACL* compilation and linking configuration (contact: @picnixz)
PY_STDLIB_MOD([_md5], [test "$with_builtin_md5" = yes]) #
PY_STDLIB_MOD([_sha1], [test "$with_builtin_sha1" = yes]) # Used by the HACL*-based implementations of cryptographic primitives.
PY_STDLIB_MOD([_sha2], [test "$with_builtin_sha2" = yes]) #
PY_STDLIB_MOD([_sha3], [test "$with_builtin_sha3" = yes]) # CPython provides a vendored copy of a subset of the HACL* project used
PY_STDLIB_MOD([_blake2], [test "$with_builtin_blake2" = yes]) # to build extension modules of cryptographic primitives. On WASI, HACL*
# sources must be statically linked with the extension modules; on other
LIBHACL_CFLAGS='-I$(srcdir)/Modules/_hacl -I$(srcdir)/Modules/_hacl/include -D_BSD_SOURCE -D_DEFAULT_SOURCE $(PY_STDMODULE_CFLAGS) $(CCSHARED)' # platforms, the extension modules may assume that HACL* has been compiled
# as a shared library.
#
# Example for MD5:
#
# * Compile Modules/_hacl/Hacl_Hash_MD5.c into Modules/_hacl/Hacl_Hash_MD5.o.
# * Decide whether the object files are to be passed to the linker (emulate
# a shared library without having to install it) or if we need to create
# a static library for WASI. The following summarizes the values taken by
# the MODULE_<NAME>_LDFLAGS variable depending on the linkage type:
# - shared: MODULE__MD5_LDFLAGS is set to LIBHACL_MD5_OBJS
# - static: MODULE__MD5_LDFLAGS is set to Modules/_hacl/libHacl_Hash_MD5.a
# * Compile Modules/md5module.c into Modules/md5module.o.
# * Link Modules/md5module.o using $(MODULE__MD5_LDFLAGS)
# and get Modules/_md5$(EXT_SUFFIX).
#
# LIBHACL_FLAG_I: '-I' flags passed to $(CC) for HACL* and HACL*-based modules
# LIBHACL_FLAG_D: '-D' flags passed to $(CC) for HACL* and HACL*-based modules
# LIBHACL_CFLAGS: compiler flags passed for HACL* and HACL*-based modules
# LIBHACL_LDFLAGS: linker flags passed for HACL* and HACL*-based modules
LIBHACL_FLAG_I='-I$(srcdir)/Modules/_hacl -I$(srcdir)/Modules/_hacl/include'
LIBHACL_FLAG_D='-D_BSD_SOURCE -D_DEFAULT_SOURCE'
case "$ac_sys_system" in case "$ac_sys_system" in
Linux*) Linux*)
if test "$ac_cv_func_explicit_bzero" = "no"; then if test "$ac_cv_func_explicit_bzero" = "no"; then
LIBHACL_CFLAGS="$LIBHACL_CFLAGS -DLINUX_NO_EXPLICIT_BZERO" LIBHACL_FLAG_D="${LIBHACL_FLAG_D} -DLINUX_NO_EXPLICIT_BZERO"
fi fi
;; ;;
esac esac
LIBHACL_CFLAGS="${LIBHACL_FLAG_I} ${LIBHACL_FLAG_D} \$(PY_STDMODULE_CFLAGS) \$(CCSHARED)"
AC_SUBST([LIBHACL_CFLAGS]) AC_SUBST([LIBHACL_CFLAGS])
LIBHACL_LDFLAGS= # for now, no specific linker flags are needed
AC_SUBST([LIBHACL_LDFLAGS])
# The SIMD files use aligned_alloc, which is not available on older versions of # The SIMD files use aligned_alloc, which is not available on older versions of
# Android. # Android.
# The *mmintrin.h headers are x86-family-specific, so can't be used on WASI. # The *mmintrin.h headers are x86-family-specific, so can't be used on WASI.
if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || \
{ test -n "$ANDROID_API_LEVEL" && test "$ANDROID_API_LEVEL" -ge 28; }
then
dnl This can be extended here to detect e.g. Power8, which HACL* should also support. dnl This can be extended here to detect e.g. Power8, which HACL* should also support.
AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[ AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[
[LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"] [LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]
@ -7879,17 +7905,17 @@ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || tes
# isn't great, so it's disabled on ARM64. # isn't great, so it's disabled on ARM64.
AC_MSG_CHECKING([for HACL* SIMD128 implementation]) AC_MSG_CHECKING([for HACL* SIMD128 implementation])
if test "$UNIVERSAL_ARCHS" == "universal2"; then if test "$UNIVERSAL_ARCHS" == "universal2"; then
[LIBHACL_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o"] [LIBHACL_BLAKE2_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o"]
AC_MSG_RESULT([universal2]) AC_MSG_RESULT([universal2])
else else
[LIBHACL_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o"] [LIBHACL_BLAKE2_SIMD128_OBJS="Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o"]
AC_MSG_RESULT([standard]) AC_MSG_RESULT([standard])
fi fi
], [], [-Werror]) ], [], [-Werror])
fi fi
AC_SUBST([LIBHACL_SIMD128_FLAGS]) AC_SUBST([LIBHACL_SIMD128_FLAGS])
AC_SUBST([LIBHACL_SIMD128_OBJS]) AC_SUBST([LIBHACL_BLAKE2_SIMD128_OBJS])
# The SIMD files use aligned_alloc, which is not available on older versions of # The SIMD files use aligned_alloc, which is not available on older versions of
# Android. # Android.
@ -7898,7 +7924,9 @@ AC_SUBST([LIBHACL_SIMD128_OBJS])
# Although AVX support is not guaranteed on Android # Although AVX support is not guaranteed on Android
# (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a # (https://developer.android.com/ndk/guides/abis#86-64), this is safe because we do a
# runtime CPUID check. # runtime CPUID check.
if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || test "$ANDROID_API_LEVEL" -ge 28; then if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || \
{ test -n "$ANDROID_API_LEVEL" && test "$ANDROID_API_LEVEL" -ge 28; }
then
AX_CHECK_COMPILE_FLAG([-mavx2],[ AX_CHECK_COMPILE_FLAG([-mavx2],[
[LIBHACL_SIMD256_FLAGS="-mavx2"] [LIBHACL_SIMD256_FLAGS="-mavx2"]
AC_DEFINE([HACL_CAN_COMPILE_SIMD256], [1], [HACL* library can compile SIMD256 implementations]) AC_DEFINE([HACL_CAN_COMPILE_SIMD256], [1], [HACL* library can compile SIMD256 implementations])
@ -7909,23 +7937,57 @@ if test "$ac_sys_system" != "Linux-android" -a "$ac_sys_system" != "WASI" || tes
# wrapped implementation if we're building for universal2. # wrapped implementation if we're building for universal2.
AC_MSG_CHECKING([for HACL* SIMD256 implementation]) AC_MSG_CHECKING([for HACL* SIMD256 implementation])
if test "$UNIVERSAL_ARCHS" == "universal2"; then if test "$UNIVERSAL_ARCHS" == "universal2"; then
[LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o"] [LIBHACL_BLAKE2_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o"]
AC_MSG_RESULT([universal2]) AC_MSG_RESULT([universal2])
else else
[LIBHACL_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o"] [LIBHACL_BLAKE2_SIMD256_OBJS="Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o"]
AC_MSG_RESULT([standard]) AC_MSG_RESULT([standard])
fi fi
], [], [-Werror]) ], [], [-Werror])
fi fi
AC_SUBST([LIBHACL_SIMD256_FLAGS]) AC_SUBST([LIBHACL_SIMD256_FLAGS])
AC_SUBST([LIBHACL_SIMD256_OBJS]) AC_SUBST([LIBHACL_BLAKE2_SIMD256_OBJS])
### end(HACL* configuration)
###############################################################################
# HACL*-based cryptographic primitives
AC_MSG_CHECKING([for HACL* library linking type])
if test "$ac_sys_system" = "WASI"; then
LIBHACL_LDEPS_LIBTYPE=STATIC
AC_MSG_RESULT([static])
else
LIBHACL_LDEPS_LIBTYPE=SHARED
AC_MSG_RESULT([shared])
fi
# Used to complete the "MODULE_<NAME>_LDEPS" Makefile variable.
# The LDEPS variable is a Makefile rule prerequisite.
AC_SUBST([LIBHACL_LDEPS_LIBTYPE])
dnl PY_HACL_CREATE_MODULE([COMPONENT], [EXTNAME], [ENABLED-TEST])
dnl The COMPONENT is the name of the HACL* component being built in uppercase.
dnl Corresponding Makefile variables are named as LIBHACL_<COMPONENT>_*.
dnl The EXTNAME is the name of the extension module being built.
AC_DEFUN([PY_HACL_CREATE_MODULE], [
AS_VAR_PUSHDEF([v], [[LIBHACL_][$1][_LDFLAGS]])
AS_VAR_SET([v], [[LIBHACL_][$1][_LIB_${LIBHACL_LDEPS_LIBTYPE}]])
PY_STDLIB_MOD([$2], [$3], [], [$LIBHACL_CFLAGS], [\$($v)])
AS_VAR_POPDEF([v])
])
dnl By default we always compile these even when OpenSSL is available
dnl (see bpo-14693). The modules are small.
PY_HACL_CREATE_MODULE([MD5], [_md5], [test "$with_builtin_md5" = yes])
PY_HACL_CREATE_MODULE([SHA1], [_sha1], [test "$with_builtin_sha1" = yes])
PY_HACL_CREATE_MODULE([SHA2], [_sha2], [test "$with_builtin_sha2" = yes])
PY_HACL_CREATE_MODULE([SHA3], [_sha3], [test "$with_builtin_sha3" = yes])
PY_HACL_CREATE_MODULE([BLAKE2], [_blake2], [test "$with_builtin_blake2" = yes])
dnl HMAC builtin library does not need OpenSSL for now. In the future dnl HMAC builtin library does not need OpenSSL for now. In the future
dnl we might want to rely on OpenSSL EVP/NID interface or implement dnl we might want to rely on OpenSSL EVP/NID interface or implement
dnl our own for algorithm resolution. dnl our own for algorithm resolution.
PY_STDLIB_MOD([_hmac], [], [], PY_HACL_CREATE_MODULE([HMAC], [_hmac], [])
[$LIBHACL_CFLAGS], ### end(cryptographic primitives)
[$LIBHACL_CFLAGS Modules/_hacl/libHacl_HMAC.a])
PY_STDLIB_MOD([_ctypes], PY_STDLIB_MOD([_ctypes],
[], [test "$have_libffi" = yes], [], [test "$have_libffi" = yes],