Skip to content

Commit b42ec65

Browse files
committed
gh-160333: remove SIMD support for HACL* BLAKE-2
The vectorized BLAKE-2 implementations were only enabled on some x86-64 platforms and caused build failures on many others. `_blake2` and `_hmac` now always use the portable HACL* implementations. The SIMD sources are no longer vendored; their headers are kept since `Hacl_Streaming_HMAC.c` includes them unconditionally.
1 parent e7e0b35 commit b42ec65

15 files changed

Lines changed: 28 additions & 3918 deletions

‎Doc/whatsnew/3.16.rst‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,6 +1299,14 @@ Build changes
12991299

13001300
(Contributed by Stan Ulbrych, Florian Mayer and AnnaAr321 in :gh:`156049`.)
13011301

1302+
* Remove SIMD support for the HACL\* implementation of BLAKE-2 used by
1303+
:mod:`hashlib` and :mod:`hmac`. The vectorized implementations were only
1304+
enabled on some x86-64 platforms and caused build failures on many others.
1305+
The :program:`configure` script no longer checks for the compiler flags
1306+
needed to build them.
1307+
1308+
(Contributed by Bénédikt Tran in :gh:`160333`.)
1309+
13021310

13031311
C API changes
13041312
=============

‎Makefile.pre.in‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,6 @@ LIBEXPAT_A= Modules/expat/libexpat.a
238238
# HACL* build configuration
239239
LIBHACL_CFLAGS=@LIBHACL_CFLAGS@
240240
LIBHACL_LDFLAGS=@LIBHACL_LDFLAGS@
241-
LIBHACL_BLAKE2_SIMD128_CFLAGS=@LIBHACL_SIMD128_FLAGS@ -DHACL_CAN_COMPILE_VEC128
242-
LIBHACL_BLAKE2_SIMD256_CFLAGS=@LIBHACL_SIMD256_FLAGS@ -DHACL_CAN_COMPILE_VEC256
243241

244242
# Module state, compiler flags and linker flags
245243
# Empty CFLAGS and LDFLAGS are omitted.
@@ -673,14 +671,10 @@ LIBHACL_SHA3_OBJS= \
673671
LIBHACL_SHA3_LIB_STATIC=Modules/_hacl/libHacl_Hash_SHA3.a
674672
LIBHACL_SHA3_LIB_SHARED=$(LIBHACL_SHA3_OBJS)
675673

676-
LIBHACL_BLAKE2_SIMD128_OBJS=@LIBHACL_BLAKE2_SIMD128_OBJS@
677-
LIBHACL_BLAKE2_SIMD256_OBJS=@LIBHACL_BLAKE2_SIMD256_OBJS@
678674
LIBHACL_BLAKE2_OBJS= \
679675
Modules/_hacl/Hacl_Hash_Blake2s.o \
680676
Modules/_hacl/Hacl_Hash_Blake2b.o \
681-
Modules/_hacl/Lib_Memzero0.o \
682-
$(LIBHACL_BLAKE2_SIMD128_OBJS) \
683-
$(LIBHACL_BLAKE2_SIMD256_OBJS)
677+
Modules/_hacl/Lib_Memzero0.o
684678
LIBHACL_BLAKE2_LIB_STATIC=Modules/_hacl/libHacl_Hash_BLAKE2.a
685679
LIBHACL_BLAKE2_LIB_SHARED=$(LIBHACL_BLAKE2_OBJS)
686680

@@ -1530,14 +1524,6 @@ Modules/_hacl/Hacl_Hash_Blake2s.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s.c $
15301524
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s.c
15311525
Modules/_hacl/Hacl_Hash_Blake2b.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b.c $(LIBHACL_BLAKE2_HEADERS)
15321526
$(CC) -c $(LIBHACL_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b.c
1533-
Modules/_hacl/Hacl_Hash_Blake2s_Simd128.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c $(LIBHACL_BLAKE2_HEADERS)
1534-
$(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_BLAKE2_SIMD128_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128.c
1535-
Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.c $(LIBHACL_BLAKE2_HEADERS)
1536-
$(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_BLAKE2_SIMD128_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2s_Simd128_universal2.c
1537-
Modules/_hacl/Hacl_Hash_Blake2b_Simd256.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c $(LIBHACL_BLAKE2_HEADERS)
1538-
$(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_BLAKE2_SIMD256_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256.c
1539-
Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.o: $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.c $(LIBHACL_BLAKE2_HEADERS)
1540-
$(CC) -c $(LIBHACL_CFLAGS) $(LIBHACL_BLAKE2_SIMD256_CFLAGS) -o $@ $(srcdir)/Modules/_hacl/Hacl_Hash_Blake2b_Simd256_universal2.c
15411527
$(LIBHACL_BLAKE2_LIB_STATIC): $(LIBHACL_BLAKE2_OBJS)
15421528
-rm -f $@
15431529
$(AR) $(ARFLAGS) $@ $(LIBHACL_BLAKE2_OBJS)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Remove SIMD support for the HACL\* implementation of BLAKE-2 used by
2+
:mod:`hashlib` and :mod:`hmac`. The vectorized implementations were only
3+
enabled on some x86-64 platforms and caused build failures on many others.
4+
Patch by Bénédikt Tran.

‎Misc/sbom.spdx.json‎

Lines changed: 0 additions & 76 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)