diff --git a/Makefile.pre.in b/Makefile.pre.in index 650838d68286c7..c62c65f7c985e2 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1581,8 +1581,9 @@ $(LIBHACL_BLAKE2_LIB_STATIC): $(LIBHACL_BLAKE2_OBJS) 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 +# The vendored HMAC source uses undefined SIMD macros as zero. 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) -Wno-undef -o $@ $(srcdir)/Modules/_hacl/Hacl_Streaming_HMAC.c $(LIBHACL_HMAC_LIB_STATIC): $(LIBHACL_HMAC_OBJS) -rm -f $@ $(AR) $(ARFLAGS) $@ $(LIBHACL_HMAC_OBJS) diff --git a/Modules/blake2module.c b/Modules/blake2module.c index 551ebd7cd052af..c14a49b1d7d2b6 100644 --- a/Modules/blake2module.c +++ b/Modules/blake2module.c @@ -51,6 +51,13 @@ # undef _Py_HACL_CAN_COMPILE_VEC256 #endif +#ifndef _Py_HACL_CAN_COMPILE_VEC128 +# define _Py_HACL_CAN_COMPILE_VEC128 0 +#endif +#ifndef _Py_HACL_CAN_COMPILE_VEC256 +# define _Py_HACL_CAN_COMPILE_VEC256 0 +#endif + // HACL* expects HACL_CAN_COMPILE_VEC* macros to be set in order to enable // the corresponding SIMD instructions so we need to "forward" the values // we just deduced above. @@ -89,7 +96,7 @@ blake2_get_state(PyObject *module) return (Blake2State *)state; } -#if defined(_Py_HACL_CAN_COMPILE_VEC128) || defined(_Py_HACL_CAN_COMPILE_VEC256) +#if _Py_HACL_CAN_COMPILE_VEC128 || _Py_HACL_CAN_COMPILE_VEC256 static inline Blake2State * blake2_get_state_from_type(PyTypeObject *module) { @@ -334,7 +341,7 @@ is_blake2s(blake2_impl impl) static inline blake2_impl type_to_impl(PyTypeObject *type) { -#if defined(_Py_HACL_CAN_COMPILE_VEC128) || defined(_Py_HACL_CAN_COMPILE_VEC256) +#if _Py_HACL_CAN_COMPILE_VEC128 || _Py_HACL_CAN_COMPILE_VEC256 Blake2State *st = blake2_get_state_from_type(type); #endif if (!strcmp(type->tp_name, blake2b_type_spec.name)) { diff --git a/Modules/hmacmodule.c b/Modules/hmacmodule.c index a76a7056e49443..a02fb9791c1a33 100644 --- a/Modules/hmacmodule.c +++ b/Modules/hmacmodule.c @@ -35,6 +35,13 @@ # undef _Py_HACL_CAN_COMPILE_VEC256 #endif +#ifndef _Py_HACL_CAN_COMPILE_VEC128 +# define _Py_HACL_CAN_COMPILE_VEC128 0 +#endif +#ifndef _Py_HACL_CAN_COMPILE_VEC256 +# define _Py_HACL_CAN_COMPILE_VEC256 0 +#endif + // HACL* expects HACL_CAN_COMPILE_VEC* macros to be set in order to enable // the corresponding SIMD instructions so we need to "forward" the values // we just deduced above.