Add argon2_blake2b_512_hash_buffers() as the replacement of _gcry_digest_spec_blake2b_512.hash_buffers().
Signed-off-by: Gary Lin <g...@suse.com> --- conf/Makefile.extra-dist | 1 + .../09-blake2b-hash-buffers.patch | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 grub-core/lib/libgcrypt-patches/09-blake2b-hash-buffers.patch diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist index 49bca5577..9def61722 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -43,6 +43,7 @@ EXTRA_DIST += grub-core/lib/libgcrypt-patches/05_disable_rsa_shake.patch EXTRA_DIST += grub-core/lib/libgcrypt-patches/06_blake.patch EXTRA_DIST += grub-core/lib/libgcrypt-patches/07_disable_64div.patch EXTRA_DIST += grub-core/lib/libgcrypt-patches/08_sexp_leak.patch +EXTRA_DIST += grub-core/lib/libgcrypt-patches/09-blake2b-hash-buffers.patch EXTRA_DIST += grub-core/lib/libtasn1-patches/0001-libtasn1-disable-code-not-needed-in-grub.patch EXTRA_DIST += grub-core/lib/libtasn1-patches/0002-libtasn1-replace-strcat-with-strcpy-in-_asn1_str_cat.patch diff --git a/grub-core/lib/libgcrypt-patches/09-blake2b-hash-buffers.patch b/grub-core/lib/libgcrypt-patches/09-blake2b-hash-buffers.patch new file mode 100644 index 000000000..16846ca4a --- /dev/null +++ b/grub-core/lib/libgcrypt-patches/09-blake2b-hash-buffers.patch @@ -0,0 +1,54 @@ +From 9c4b1a458718d848d0121b81f8533bbc7f26469a Mon Sep 17 00:00:00 2001 +From: Gary Lin <g...@suse.com> +Date: Mon, 25 Aug 2025 15:54:24 +0800 +Subject: [PATCH 1/4] libgcrypt/kdf: Implement blake2b_512.hash_buffers() + +Add argon2_blake2b_512_hash_buffers() as the replacement of +_gcry_digest_spec_blake2b_512.hash_buffers(). + +Signed-off-by: Gary Lin <g...@suse.com> +--- + grub-core/lib/libgcrypt-grub/cipher/kdf.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/grub-core/lib/libgcrypt-grub/cipher/kdf.c b/grub-core/lib/libgcrypt-grub/cipher/kdf.c +index 0689f88b1..fd0c4a106 100644 +--- a/grub-core/lib/libgcrypt-grub/cipher/kdf.c ++++ b/grub-core/lib/libgcrypt-grub/cipher/kdf.c +@@ -129,6 +129,24 @@ beswap64_block (u64 *dst) + #endif + } + ++/* Implementation of _gcry_blake2b_512_hash_buffers */ ++static void ++argon2_blake2b_512_hash_buffers (void *outbuf, const gcry_buffer_t *iov, int iovcnt) ++{ ++ void *hd; ++ ++ hd = xtrymalloc (_gcry_digest_spec_blake2b_512.contextsize); ++ if (!hd) ++ return; ++ ++ _gcry_digest_spec_blake2b_512.init (hd, 0); ++ for (;iovcnt > 0; iov++, iovcnt--) ++ _gcry_digest_spec_blake2b_512.write (hd, (const char*)iov[0].data + iov[0].off, iov[0].len); ++ _gcry_digest_spec_blake2b_512.final (hd); ++ grub_memcpy (outbuf, _gcry_digest_spec_blake2b_512.read (hd), 512 / 8); ++ ++ xfree (hd); ++} + + static gpg_err_code_t + argon2_fill_first_blocks (argon2_ctx_t a) +@@ -195,7 +213,7 @@ argon2_fill_first_blocks (argon2_ctx_t a) + iov_count++; + } + +- _gcry_digest_spec_blake2b_512.hash_buffers (h0_01_i, 64, iov, iov_count); ++ argon2_blake2b_512_hash_buffers (h0_01_i, iov, iov_count); + + for (i = 0; i < a->lanes; i++) + { +-- +2.43.0 + -- 2.43.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel