From: Gary Lin Date: Wed, 15 Oct 2025 03:00:19 +0000 (+0800) Subject: libgcrypt/kdf: Get rid of gpg_err_code_from_errno() X-Git-Tag: grub-2.14-rc1~55 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ff72064178794b13ad3bf690bfa37e8fc76e2b9;p=thirdparty%2Fgrub.git 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 Reviewed-by: Daniel Kiper --- diff --git a/conf/Makefile.extra-dist b/conf/Makefile.extra-dist index 6da09b6d9..e1e569de0 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..53ca52d53 --- /dev/null +++ b/grub-core/lib/libgcrypt-patches/10-kdf-use-GPG-errs.patch @@ -0,0 +1,48 @@ +From 89f793515d927d8f7099b61d0b7b200611e56acd Mon Sep 17 00:00:00 2001 +From: Gary Lin +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 +--- + 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 08e3ef658..6e0351d8a 100644 +--- a/grub-core/lib/libgcrypt-grub/cipher/kdf.c ++++ b/grub-core/lib/libgcrypt-grub/cipher/kdf.c +@@ -265,7 +265,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); +@@ -273,7 +273,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; + } +@@ -624,7 +624,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.51.0 +