Changes UUID comparisons so that LUKS1 and LUKS2 are both recognized
as being LUKS cryptodisks.
---
 grub-core/osdep/devmapper/getroot.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/grub-core/osdep/devmapper/getroot.c 
b/grub-core/osdep/devmapper/getroot.c
index 9ba5c9865..ad1daf9c8 100644
--- a/grub-core/osdep/devmapper/getroot.c
+++ b/grub-core/osdep/devmapper/getroot.c
@@ -138,7 +138,7 @@ grub_util_get_dm_abstraction (const char *os_dev)
       grub_free (uuid);
       return GRUB_DEV_ABSTRACTION_LVM;
     }
-  if (strncmp (uuid, "CRYPT-LUKS1-", 12) == 0)
+  if (strncmp (uuid, "CRYPT-LUKS", sizeof ("CRYPT-LUKS") - 1) == 0)
     {
       grub_free (uuid);
       return GRUB_DEV_ABSTRACTION_LUKS;
@@ -179,7 +179,7 @@ grub_util_pull_devmapper (const char *os_dev)
          grub_util_pull_device (subdev);
        }
     }
-  if (uuid && strncmp (uuid, "CRYPT-LUKS1-", sizeof ("CRYPT-LUKS1-") - 1) == 0
+  if (uuid && strncmp (uuid, "CRYPT-LUKS", sizeof ("CRYPT-LUKS") - 1) == 0
       && lastsubdev)
     {
       char *grdev = grub_util_get_grub_dev (lastsubdev);
@@ -253,11 +253,11 @@ grub_util_get_devmapper_grub_dev (const char *os_dev)
       {
        char *dash;
 
-       dash = grub_strchr (uuid + sizeof ("CRYPT-LUKS1-") - 1, '-');
+       dash = grub_strchr (uuid + sizeof ("CRYPT-LUKS*-") - 1, '-');
        if (dash)
          *dash = 0;
        grub_dev = grub_xasprintf ("cryptouuid/%s",
-                                  uuid + sizeof ("CRYPT-LUKS1-") - 1);
+                                  uuid + sizeof ("CRYPT-LUKS*-") - 1);
        grub_free (uuid);
        return grub_dev;
       }
-- 
2.36.0


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to