diff --git a/SOURCES/1000-Add-support-for-printableString-in-x509.patch b/SOURCES/1000-Add-support-for-printableString-in-x509.patch new file mode 100644 index 0000000..ded39b4 --- /dev/null +++ b/SOURCES/1000-Add-support-for-printableString-in-x509.patch @@ -0,0 +1,85 @@ +From 14123e7711a5fec457c5b342c646c3a1f1544963 Mon Sep 17 00:00:00 2001 +From: Andrew Lukoshko +Date: Sat, 29 Mar 2025 23:35:42 +0000 +Subject: [PATCH] Add support for printableString in x509 + +Original patch by Daniel Axtens + +Signed-off-by: Andrew Lukoshko +--- + grub-core/commands/appendedsig/x509.c | 44 ++++++++++++++++++--------- + 1 file changed, 29 insertions(+), 15 deletions(-) + +diff --git a/grub-core/commands/appendedsig/x509.c b/grub-core/commands/appendedsig/x509.c +index 42ec65c..e58dcab 100644 +--- a/grub-core/commands/appendedsig/x509.c ++++ b/grub-core/commands/appendedsig/x509.c +@@ -310,22 +310,36 @@ decode_string (char *der, int der_size, char **string, + goto cleanup; + } + +- if (grub_strncmp ("utf8String", choice, choice_size)) ++ if (grub_strncmp ("utf8String", choice, choice_size) == 0) + { +- err = +- grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, +- "Only UTF-8 DirectoryStrings are supported, got %s", +- choice); +- goto cleanup_choice; ++ result = asn1_read_value (strasn, "utf8String", NULL, &tmp_size); ++ if (result != ASN1_MEM_ERROR) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading size of UTF-8 string: %s", ++ asn1_strerror (result)); ++ goto cleanup_choice; ++ } + } +- +- result = asn1_read_value (strasn, "utf8String", NULL, &tmp_size); +- if (result != ASN1_MEM_ERROR) ++ else if (grub_strncmp("printableString", choice, choice_size) == 0) ++ { ++ result = asn1_read_value (strasn, "printableString", NULL, &tmp_size); ++ if (result != ASN1_MEM_ERROR) ++ { ++ err = ++ grub_error (GRUB_ERR_BAD_FILE_TYPE, ++ "Error reading size of UTF-8 string: %s", ++ asn1_strerror (result)); ++ goto cleanup_choice; ++ } ++ } ++ else + { + err = +- grub_error (GRUB_ERR_BAD_FILE_TYPE, +- "Error reading size of UTF-8 string: %s", +- asn1_strerror (result)); ++ grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, ++ "Only UTF-8 and printable DirectoryStrings are supported, got %s", ++ choice); + goto cleanup_choice; + } + +@@ -341,13 +355,13 @@ decode_string (char *der, int der_size, char **string, + goto cleanup_choice; + } + +- result = asn1_read_value (strasn, "utf8String", *string, &tmp_size); ++ result = asn1_read_value (strasn, choice, *string, &tmp_size); + if (result != ASN1_SUCCESS) + { + err = + grub_error (GRUB_ERR_BAD_FILE_TYPE, +- "Error reading out UTF-8 string in DirectoryString: %s", +- asn1_strerror (result)); ++ "Error reading out %s in DirectoryString: %s", ++ choice, asn1_strerror (result)); + grub_free (*string); + goto cleanup_choice; + } +-- +2.43.5 + diff --git a/SPECS/grub2.spec b/SPECS/grub2.spec index c4cf01c..d22ae1e 100644 --- a/SPECS/grub2.spec +++ b/SPECS/grub2.spec @@ -16,7 +16,7 @@ Name: grub2 Epoch: 1 Version: 2.06 -Release: 100%{?dist}.alma.1 +Release: 100%{?dist}.alma.2 Summary: Bootloader with support for Linux, Multiboot and more License: GPLv3+ URL: http://www.gnu.org/software/grub/ @@ -91,6 +91,9 @@ hardware devices.\ # generate with do-rebase %include %{SOURCE11} +# AlmaLinux +Patch1000: 1000-Add-support-for-printableString-in-x509.patch + %description %{desc} @@ -538,6 +541,9 @@ mv ${EFI_HOME}/grub.cfg.stb ${EFI_HOME}/grub.cfg %endif %changelog +* Sun Mar 30 2025 Andrew Lukoshko - 1:2.06-100.alma.2 +- Add support for printableString in x509 + * Fri Mar 28 2025 Eduard Abdullin - 1:2.06-100.alma.1 - Debrand for AlmaLinux