gpg_err_code_from_errno() requires libgcrypt_wrap/mem.c which is not in Makefile.utilgcry.def. This commit replaces gpg_err_code_from_errno() with GPG_ERR_* to avoid the build errors.
Signed-off-by: Gary Lin <g...@suse.com> --- conf/Makefile.extra-dist | 1 + .../10-kdf-use-GPG-errs.patch | 48 +++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 grub-core/lib/libgcrypt-patches/10-kdf-use-GPG-errs.patch diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist index 9def61722..ac72a7ecf 100644 --- a/conf/Makefile.extra-dist +++ b/conf/Makefile.extra-dist @@ -44,6 +44,7 @@ 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/libgcrypt-patches/10-kdf-use-GPG-errs.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/10-kdf-use-GPG-errs.patch b/grub-core/lib/libgcrypt-patches/10-kdf-use-GPG-errs.patch new file mode 100644 index 000000000..e18ef4d15 --- /dev/null +++ b/grub-core/lib/libgcrypt-patches/10-kdf-use-GPG-errs.patch @@ -0,0 +1,48 @@ +From 0344b5a1c206aaa8ec591824c5d0ccf5d9a1e6c0 Mon Sep 17 00:00:00 2001 +From: Gary Lin <g...@suse.com> +Date: Mon, 25 Aug 2025 15:56:03 +0800 +Subject: [PATCH 2/4] libgcrypt/kdf: Get rid of gpg_err_code_from_errno() + +gpg_err_code_from_errno() requires libgcrypt_wrap/mem.c which is not in +Makefile.utilgcry.def. This commit replaces gpg_err_code_from_errno() +with GPG_ERR_* to avoid the build errors. + +Signed-off-by: Gary Lin <g...@suse.com> +--- + grub-core/lib/libgcrypt-grub/cipher/kdf.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/grub-core/lib/libgcrypt-grub/cipher/kdf.c b/grub-core/lib/libgcrypt-grub/cipher/kdf.c +index fd0c4a106..55294672b 100644 +--- a/grub-core/lib/libgcrypt-grub/cipher/kdf.c ++++ b/grub-core/lib/libgcrypt-grub/cipher/kdf.c +@@ -260,7 +260,7 @@ argon2_init (argon2_ctx_t a, unsigned int parallelism, + block = xtrymalloc (1024 * memory_blocks); + if (!block) + { +- ec = gpg_err_code_from_errno (errno); ++ ec = GPG_ERR_OUT_OF_MEMORY; + return ec; + } + memset (block, 0, 1024 * memory_blocks); +@@ -268,7 +268,7 @@ argon2_init (argon2_ctx_t a, unsigned int parallelism, + thread_data = xtrymalloc (a->lanes * sizeof (struct argon2_thread_data)); + if (!thread_data) + { +- ec = gpg_err_code_from_errno (errno); ++ ec = GPG_ERR_OUT_OF_MEMORY; + xfree (block); + return ec; + } +@@ -619,7 +619,7 @@ argon2_open (gcry_kdf_hd_t *hd, int subalgo, + n = offsetof (struct argon2_context, out) + taglen; + a = xtrymalloc (n); + if (!a) +- return gpg_err_code_from_errno (errno); ++ return GPG_ERR_OUT_OF_MEMORY; + + a->algo = GCRY_KDF_ARGON2; + a->hash_type = hash_type; +-- +2.43.0 + -- 2.43.0 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel