Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile.pre.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
11 changes: 9 additions & 2 deletions Modules/blake2module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)) {
Expand Down
7 changes: 7 additions & 0 deletions Modules/hmacmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Loading