A tentative change to build blake2 and sha256 with x86_64 optimization code from libgcrypt
Signed-off-by: Gary Lin <g...@suse.com> --- .../09_build_x86_64_opt_code.patch | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 grub-core/lib/libgcrypt-patches/09_build_x86_64_opt_code.patch diff --git a/grub-core/lib/libgcrypt-patches/09_build_x86_64_opt_code.patch b/grub-core/lib/libgcrypt-patches/09_build_x86_64_opt_code.patch new file mode 100644 index 000000000..7af752d03 --- /dev/null +++ b/grub-core/lib/libgcrypt-patches/09_build_x86_64_opt_code.patch @@ -0,0 +1,80 @@ +From 4979228c02f1a93999645b685f99f4612edd6449 Mon Sep 17 00:00:00 2001 +From: Gary Lin <g...@suse.com> +Date: Fri, 18 Jul 2025 15:23:25 +0800 +Subject: [PATCH 2/2] Build blake2 and sha256 with x86_64 optimization assembly + code + +A tentative change to build blake2 and sha256 with x86_64 optimization +code from libgcrypt + +Signed-off-by: Gary Lin <g...@suse.com> +--- + grub-core/Makefile.gcry.def | 39 +++++++++++++++++++++++++++++++++++-- + 1 file changed, 37 insertions(+), 2 deletions(-) + +diff --git a/grub-core/Makefile.gcry.def b/grub-core/Makefile.gcry.def +index 6d9b7cb24..f2885cae3 100644 +--- a/grub-core/Makefile.gcry.def ++++ b/grub-core/Makefile.gcry.def +@@ -17,8 +17,20 @@ module = { + module = { + name = gcry_blake2; + common = lib/libgcrypt-grub/cipher/blake2.c; ++ x86_64 = lib/libgcrypt-grub/cipher/blake2b-amd64-avx2.S; ++ x86_64 = lib/libgcrypt-grub/cipher/blake2b-amd64-avx512.S; ++ x86_64 = lib/libgcrypt-grub/cipher/blake2s-amd64-avx.S; ++ x86_64 = lib/libgcrypt-grub/cipher/blake2s-amd64-avx512.S; ++ ++ emu = lib/libgcrypt-grub/cipher/blake2b-amd64-avx2.S; ++ emu = lib/libgcrypt-grub/cipher/blake2b-amd64-avx512.S; ++ emu = lib/libgcrypt-grub/cipher/blake2s-amd64-avx.S; ++ emu = lib/libgcrypt-grub/cipher/blake2s-amd64-avx512.S; ++ + cflags = '$(CFLAGS_GCRY)'; +- cppflags = '$(CPPFLAGS_GCRY)'; ++ cppflags = '$(CPPFLAGS_GCRY) $(CPPFLAGS_GCRY_ASM)'; ++ ++ emu_condition = COND_emu_hw_asm; + }; + + module = { +@@ -165,8 +177,20 @@ module = { + module = { + name = gcry_sha256; + common = lib/libgcrypt-grub/cipher/sha256.c; ++ x86_64 = lib/libgcrypt-grub/cipher/sha256-ssse3-amd64.S; ++ x86_64 = lib/libgcrypt-grub/cipher/sha256-avx-amd64.S; ++ x86_64 = lib/libgcrypt-grub/cipher/sha256-avx2-bmi2-amd64.S; ++ x86_64 = lib/libgcrypt-grub/cipher/sha256-intel-shaext.c; ++ ++ emu = lib/libgcrypt-grub/cipher/sha256-ssse3-amd64.S; ++ emu = lib/libgcrypt-grub/cipher/sha256-avx-amd64.S; ++ emu = lib/libgcrypt-grub/cipher/sha256-avx2-bmi2-amd64.S; ++ emu = lib/libgcrypt-grub/cipher/sha256-intel-shaext.c; ++ + cflags = '$(CFLAGS_GCRY) -Wno-cast-align'; +- cppflags = '$(CPPFLAGS_GCRY)'; ++ cppflags = '$(CPPFLAGS_GCRY) -DUSE_SHA256 $(CPPFLAGS_GCRY_ASM)'; ++ ++ emu_condition = COND_emu_hw_asm; + }; + + module = { +@@ -219,3 +243,14 @@ module = { + cppflags = '$(CPPFLAGS_GCRY)'; + }; + ++module = { ++ name = gcry_hwfeatures; ++ common = lib/libgcrypt-grub/src/hwfeatures.c; ++ x86_64 = lib/libgcrypt-grub/src/hwf-x86.c; ++ emu = lib/libgcrypt-grub/src/hwf-x86.c; ++ ++ cflags = '$(CFLAGS_GCRY)'; ++ cppflags = '$(CPPFLAGS_GCRY) $(CPPFLAGS_GCRY_ASM)'; ++ ++ emu_condition = COND_emu_hw_asm; ++}; +-- +2.43.0 + -- 2.43.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel