This patch series speeds up LUKS PBKDF2 unlocking by using assembly files
from libgcrypt 1.11.0 to enable hardware-accelerated SHA-256 and SHA-512.

As an initial step, the scope is limited to x86_64 EFI targets.

Patch 1 modifies autoconf/automake files to check the availablity of
special CPU instructions.
Patch 2 and 3 introduce the functions to enable/disable the hardware
features.
Patch 4 and 5 copy the selected assembly files.
Patch 6 implements _gcry_get_hw_features() to control the hardware
features detection in libgcrypt.
Patch 7 fixes a potential build error when compiling the Intel SHA
extention function for the gcry_sha256 module.
Patch 8 and 9 build the gcry_sha256 and gcry_sha512 modules with the
assembly files.
Patch 10 adds a new option to cryptomount to enable hardware
acceleration.

NOTE: The libgcrypt patch numbering begins at 13 to follow the Argon2
patch set(*).

(*) https://lists.gnu.org/archive/html/grub-devel/2025-09/msg00020.html

Gary Lin (10):
  Tweak autoconf/automake files to detect x86_64 features
  lib/hwfeatures-gcry: Introduce functions to manage hardware features
  lib/hwfeatures-gcry: Enable SSE and AVX for x86_64 EFI
  libgcrypt: Copy sha256 x86_64 assembly files
  libgcrypt: Copy sha512 x86_64 assembly files
  libgcrypt: Implement _gcry_get_hw_features()
  libgcrypt: Declare the sha256 shaext function
  libgcrypt: Add hardware acceleration for gcry_sha256
  libgcrypt: Add hardware acceleration for gcry_sha512
  disk/cryptodisk: Add '--hw-accel' to enable hardware acceleration

 Makefile.util.def                             |   1 +
 autogen.sh                                    |  11 +
 conf/Makefile.common                          |   2 +
 conf/Makefile.extra-dist                      |   4 +
 configure.ac                                  | 233 +++++++++++++++++
 docs/grub.texi                                |   5 +-
 grub-core/Makefile.core.def                   |   2 +
 grub-core/disk/cryptodisk.c                   |  26 +-
 grub-core/lib/hwfeatures-gcry.c               |  52 ++++
 .../libgcrypt-patches/13_add_hwfeatures.patch |  87 +++++++
 .../14_fix_build_shaext.patch                 |  35 +++
 .../15_build_sha256_x86_64_efi_opt_code.patch |  43 +++
 .../16_build_sha512_x86_64_efi_opt_code.patch |  35 +++
 grub-core/lib/x86_64/efi/hwfeatures-gcry.c    | 244 ++++++++++++++++++
 grub-core/normal/main.c                       |   2 +-
 include/grub/crypto.h                         |   7 +-
 include/grub/hwfeatures-gcry.h                |  26 ++
 include/grub/x86_64/cpuid.h                   |   1 +
 include/grub/x86_64/efi/hwfeatures-gcry.h     |  25 ++
 19 files changed, 833 insertions(+), 8 deletions(-)
 create mode 100644 grub-core/lib/hwfeatures-gcry.c
 create mode 100644 grub-core/lib/libgcrypt-patches/13_add_hwfeatures.patch
 create mode 100644 grub-core/lib/libgcrypt-patches/14_fix_build_shaext.patch
 create mode 100644 
grub-core/lib/libgcrypt-patches/15_build_sha256_x86_64_efi_opt_code.patch
 create mode 100644 
grub-core/lib/libgcrypt-patches/16_build_sha512_x86_64_efi_opt_code.patch
 create mode 100644 grub-core/lib/x86_64/efi/hwfeatures-gcry.c
 create mode 100644 include/grub/hwfeatures-gcry.h
 create mode 100644 include/grub/x86_64/cpuid.h
 create mode 100644 include/grub/x86_64/efi/hwfeatures-gcry.h

-- 
2.51.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to