[PATCH 0/3] Use -shared compilation instead of -Wl,-r

2025-04-08 Thread Vladimir Serbinenko
-Wl,-r is a partial linking and this file is only intended as intermediate result for linker, not really intended for any other use. To make them usable we end up doing all the linker job twice over: in mkimage and in runtime. -shared on the other hand is meant to be loaded and relocated and hence

[PATCH 0/3] Use -shared compilation instead of -Wl,-r

2025-04-08 Thread Vladimir Serbinenko
-Wl,-r is a partial linking and this file is only intended as intermediate result for linker, not really intended for any other use. To make them usable we end up doing all the linker job twice over: in mkimage and in runtime. -shared on the other hand is meant to be loaded and relocated and hence

[PATCH 2/3] loongarch64: Use la.pcrel instead of la.

2025-04-08 Thread Vladimir Serbinenko
la.pcrel unlike la should work even above 4GiB mark. Signed-off-by: Vladimir Serbinenko --- grub-core/kern/loongarch64/efi/startup.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/kern/loongarch64/efi/startup.S b/grub-core/kern/loongarch64/efi/startup.S index

[PATCH v9 04/11] Adjust import script, definitions and API users for libgcrypt 1.11

2025-04-08 Thread Vladimir Serbinenko
This patches modifies the GRUB-libgcrypt API to match new libgcrypt 1.11 Signed-off-by: Vladimir Serbinenko --- autogen.sh| 5 + conf/Makefile.common | 4 +- grub-core/Makefile.core.def | 20 +- grub-core/command

[PATCH v9 00/11] Update libgcrypt to 1.11

2025-04-08 Thread Vladimir Serbinenko
This series of patches upgrades libgcrypt to 1.11. Differences to version 8: * Add back missing file * Fix mips compilation * Silence the warnings * Enabled blake hashes ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/list

[PATCH v9 02/11] Import b64dec from gpg-error

2025-04-08 Thread Vladimir Serbinenko
Imported from libgpg-error 1.51 Signed-off-by: Vladimir Serbinenko --- grub-core/lib/b64dec.c | 279 + 1 file changed, 279 insertions(+) create mode 100644 grub-core/lib/b64dec.c diff --git a/grub-core/lib/b64dec.c b/grub-core/lib/b64dec.c new file mode

[PATCH v9 03/11] b64dec: Adjust for compilation in GRUB environment

2025-04-08 Thread Vladimir Serbinenko
Signed-off-by: Vladimir Serbinenko --- grub-core/lib/b64dec.c | 36 +--- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/grub-core/lib/b64dec.c b/grub-core/lib/b64dec.c index 868d98568..8aafa9700 100644 --- a/grub-core/lib/b64dec.c +++ b/grub-core/l

[PATCH v9 08/11] Remove now unneeded gcrypt compilation flag

2025-04-08 Thread Vladimir Serbinenko
HAVE_STRTOUL is now defined in stdlib.h. Include it in g10lib.h rather than defining on command line Signed-off-by: Vladimir Serbinenko --- conf/Makefile.common | 2 +- util/import_gcry.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.

[PATCH v9 07/11] libgcrypt: Fix coverity warnings

2025-04-08 Thread Vladimir Serbinenko
Signed-off-by: Vladimir Serbinenko --- .../libgcrypt-patches/03_mpiutil_alloc.patch | 20 ++ .../lib/libgcrypt-patches/03_sexp_free.patch | 37 +++ 2 files changed, 57 insertions(+) create mode 100644 grub-core/lib/libgcrypt-patches/03_mpiutil_alloc.patch create mode 1

[PATCH v9 09/11] Implement __aeabi_uldivmod

2025-04-08 Thread Vladimir Serbinenko
Some arm compilers insert 64-bit division into the code compiled from libgcrypt source and possibly others. Rether than fighting it, simply provide the function in question. Signed-off-by: Vladimir Serbinenko --- grub-core/kern/arm/compiler-rt.S | 11 +++ include/grub/compiler-rt.h

[PATCH v9 06/11] keccak: Disable acceleration with SSE asm

2025-04-08 Thread Vladimir Serbinenko
Libgcrypt code assumes that on x64 all SSE registers are fair game. While it's true that CPUs in question support it, we disable it in our compilation options. Disable the offending optimization. Signed-off-by: Vladimir Serbinenko --- .../lib/libgcrypt-patches/02_keccak_sse.patch | 25 ++

[PATCH v9 10/11] gcry: Ignore sign-compare warnings

2025-04-08 Thread Vladimir Serbinenko
libgcrypt itself is compiled with -Wno-sign-compare. Do the same for consistency Signed-off-by: Vladimir Serbinenko --- conf/Makefile.common | 2 +- grub-core/Makefile.core.def | 10 +- grub-core/kern/compiler-rt.c | 32 ++-- include/grub/compiler-rt

[PATCH v9 11/11] libgcrypt: Import blake family of hashes

2025-04-08 Thread Vladimir Serbinenko
Signed-off-by: Vladimir Serbinenko --- .../lib/libgcrypt-patches/06_blake.patch | 80 +++ include/grub/crypto.h | 6 ++ util/import_gcry.py | 36 +++-- 3 files changed, 115 insertions(+), 7 deletions(-) create mode 10064

[PATCH v9 05/11] Add DSA and RSA SEXP tests

2025-04-08 Thread Vladimir Serbinenko
This allows us to test purely the integration of the implementation of DSA and RSA from libgcrypt without concerning with additional code. Signed-off-by: Vladimir Serbinenko --- grub-core/Makefile.core.def | 16 grub-core/tests/dsa_sexp_test.c | 127 gr

[PATCH 1/3] Use ET_DYN instead of ET_REL modules

2025-04-08 Thread Vladimir Serbinenko
ET_DYN also known as .so files are actually meant to be loaded dynamically. Most of the work of linking is done by normal linker and we need to do only simple relocation by offset. This significantly simplifies our dynamic loading. Moreover the tools are meant to produce .so files and so it's easie

[PATCH v10 04/12] Adjust import script, definitions and API users for libgcrypt 1.11

2025-04-08 Thread Vladimir Serbinenko
This patches modifies the GRUB-libgcrypt API to match new libgcrypt 1.11 Signed-off-by: Vladimir Serbinenko --- autogen.sh| 5 + conf/Makefile.common | 4 +- grub-core/Makefile.core.def | 20 +- grub-core/command

[PATCH v10 09/12] Implement __aeabi_uldivmod

2025-04-08 Thread Vladimir Serbinenko
Some arm compilers insert 64-bit division into the code compiled from libgcrypt source and possibly others. Rether than fighting it, simply provide the function in question. Signed-off-by: Vladimir Serbinenko --- grub-core/kern/arm/compiler-rt.S | 11 +++ include/grub/compiler-rt.h

[PATCH v10 12/12] libgcrypt: Import blake family of hashes

2025-04-08 Thread Vladimir Serbinenko
Signed-off-by: Vladimir Serbinenko --- .../lib/libgcrypt-patches/06_blake.patch | 80 +++ include/grub/crypto.h | 6 ++ util/import_gcry.py | 36 +++-- 3 files changed, 115 insertions(+), 7 deletions(-) create mode 10064

[PATCH v10 03/12] b64dec: Adjust for compilation in GRUB environment

2025-04-08 Thread Vladimir Serbinenko
Signed-off-by: Vladimir Serbinenko --- grub-core/lib/b64dec.c | 36 +--- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/grub-core/lib/b64dec.c b/grub-core/lib/b64dec.c index 868d98568..8aafa9700 100644 --- a/grub-core/lib/b64dec.c +++ b/grub-core/l

[PATCH v10 02/12] Import b64dec from gpg-error

2025-04-08 Thread Vladimir Serbinenko
Imported from libgpg-error 1.51 Signed-off-by: Vladimir Serbinenko --- grub-core/lib/b64dec.c | 279 + 1 file changed, 279 insertions(+) create mode 100644 grub-core/lib/b64dec.c diff --git a/grub-core/lib/b64dec.c b/grub-core/lib/b64dec.c new file mode

[PATCH v10 11/12] gcry: Ignore sign-compare warnings

2025-04-08 Thread Vladimir Serbinenko
libgcrypt itself is compiled with -Wno-sign-compare. Do the same for consistency Signed-off-by: Vladimir Serbinenko --- conf/Makefile.common| 2 +- grub-core/Makefile.core.def | 10 +- util/import_gcry.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --

[PATCH v10 10/12] Enable udivdi3 and umoddi3 for mips

2025-04-08 Thread Vladimir Serbinenko
Some mips compilers insert 64-bit division into the code compiled from libgcrypt source and possibly others. Rether than fighting it, simply provide the function in question. Signed-off-by: Vladimir Serbinenko --- grub-core/kern/compiler-rt.c | 32 ++-- include/grub/c

[PATCH v10 00/12] Upgrade libgcrypt to 1.11

2025-04-08 Thread Vladimir Serbinenko
Changes from v9: * Split accidentally squashed unrelated patches ___ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel

[PATCH v10 06/12] keccak: Disable acceleration with SSE asm

2025-04-08 Thread Vladimir Serbinenko
Libgcrypt code assumes that on x64 all SSE registers are fair game. While it's true that CPUs in question support it, we disable it in our compilation options. Disable the offending optimization. Signed-off-by: Vladimir Serbinenko --- .../lib/libgcrypt-patches/02_keccak_sse.patch | 25 ++

[PATCH v10 07/12] libgcrypt: Fix coverity warnings

2025-04-08 Thread Vladimir Serbinenko
Signed-off-by: Vladimir Serbinenko --- .../libgcrypt-patches/03_mpiutil_alloc.patch | 20 ++ .../lib/libgcrypt-patches/03_sexp_free.patch | 37 +++ 2 files changed, 57 insertions(+) create mode 100644 grub-core/lib/libgcrypt-patches/03_mpiutil_alloc.patch create mode 1

[PATCH v10 05/12] Add DSA and RSA SEXP tests

2025-04-08 Thread Vladimir Serbinenko
This allows us to test purely the integration of the implementation of DSA and RSA from libgcrypt without concerning with additional code. Signed-off-by: Vladimir Serbinenko --- grub-core/Makefile.core.def | 16 grub-core/tests/dsa_sexp_test.c | 127 gr

[PATCH v10 08/12] Remove now unneeded gcrypt compilation flag

2025-04-08 Thread Vladimir Serbinenko
HAVE_STRTOUL is now defined in stdlib.h. Include it in g10lib.h rather than defining on command line Signed-off-by: Vladimir Serbinenko --- conf/Makefile.common | 2 +- util/import_gcry.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/conf/Makefile.common b/conf/Makefile.

[PATCH 3/3] Use ET_DYN images and PHDRs for creating relocatable images

2025-04-08 Thread Vladimir Serbinenko
ET_REL images contain lots of complicated relocations. One new relocation we need to support is R_LARCH_GOT_PC_HI20/LO12. Rather than the eternal chasing of complicated we can use linker to handle them and then only relatively simple dynamic relocs remain to handle. This required small adjustments