Skip to content

Commit b1029ab

Browse files
mhsmithblhsing
authored andcommitted
pythongh-99108: Inform HACL when explicit_bzero is unavailable (pythonGH-123027)
Inform HACL whether explicit_bzero is available
1 parent e2d0b9c commit b1029ab

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

Makefile.pre.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ LIBMPDEC_A= Modules/_decimal/libmpdec/libmpdec.a
222222
LIBEXPAT_A= Modules/expat/libexpat.a
223223
LIBHACL_SHA2_A= Modules/_hacl/libHacl_Hash_SHA2.a
224224
LIBHACL_BLAKE2_A= Modules/_hacl/libHacl_Hash_Blake2.a
225+
LIBHACL_CFLAGS=@LIBHACL_CFLAGS@
225226
LIBHACL_SIMD128_FLAGS=@LIBHACL_SIMD128_FLAGS@
226227
LIBHACL_SIMD256_FLAGS=@LIBHACL_SIMD256_FLAGS@
227228
LIBHACL_SIMD128_OBJS=@LIBHACL_SIMD128_OBJS@
@@ -1368,7 +1369,6 @@ $(LIBEXPAT_A): $(LIBEXPAT_OBJS)
13681369
# Build HACL* static libraries for hashlib: libHacl_Hash_SHA2.a, and
13691370
# libHacl_Blake2.a -- the contents of the latter vary depending on whether we
13701371
# have the ability to compile vectorized versions
1371-
LIBHACL_CFLAGS=-I$(srcdir)/Modules/_hacl -I$(srcdir)/Modules/_hacl/include -D_BSD_SOURCE -D_DEFAULT_SOURCE $(PY_STDMODULE_CFLAGS) $(CCSHARED)
13721372

13731373
Modules/_hacl/Hacl_Hash_SHA2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_SHA2.c $(LIBHACL_SHA2_HEADERS)
13741374
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_SHA2.c

configure

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

+10
Original file line numberDiff line numberDiff line change
@@ -7792,6 +7792,16 @@ PY_STDLIB_MOD([_sha2], [test "$with_builtin_sha2" = yes])
77927792
PY_STDLIB_MOD([_sha3], [test "$with_builtin_sha3" = yes])
77937793
PY_STDLIB_MOD([_blake2], [test "$with_builtin_blake2" = yes])
77947794

7795+
LIBHACL_CFLAGS='-I$(srcdir)/Modules/_hacl -I$(srcdir)/Modules/_hacl/include -D_BSD_SOURCE -D_DEFAULT_SOURCE $(PY_STDMODULE_CFLAGS) $(CCSHARED)'
7796+
case "$ac_sys_system" in
7797+
Linux*)
7798+
if test "$ac_cv_func_explicit_bzero" = "no"; then
7799+
LIBHACL_CFLAGS="$LIBHACL_CFLAGS -DLINUX_NO_EXPLICIT_BZERO"
7800+
fi
7801+
;;
7802+
esac
7803+
AC_SUBST([LIBHACL_CFLAGS])
7804+
77957805
dnl This can be extended here to detect e.g. Power8, which HACL* should also support.
77967806
AX_CHECK_COMPILE_FLAG([-msse -msse2 -msse3 -msse4.1 -msse4.2],[
77977807
[LIBHACL_SIMD128_FLAGS="-msse -msse2 -msse3 -msse4.1 -msse4.2"]

0 commit comments

Comments
 (0)