From: Glenn Washburn <development@efficientek.com>
To: grub-devel@gnu.org, Daniel Kiper <dkiper@net-space.pl>
Cc: Patrick Steinhardt <ps@pks.im>,
Pierre-Louis Bonicoli <pierre-louis.bonicoli@libregerbil.fr>,
Josselin Poiret <dev@jpoiret.xyz>, Fabian Vogt <fvogt@suse.de>,
Glenn Washburn <development@efficientek.com>
Subject: [PATCH 2/4] devmapper/getroot: Have devmapper recognize LUKS2
Date: Thu, 12 Jan 2023 17:05:08 -0600 [thread overview]
Message-ID: <20230112230510.1319896-3-development@efficientek.com> (raw)
In-Reply-To: <20230112230510.1319896-1-development@efficientek.com>
From: Josselin Poiret <dev@jpoiret.xyz>
Changes UUID comparisons so that LUKS1 and LUKS2 are both recognized
as being LUKS cryptodisks.
Signed-off-by: Josselin Poiret <dev@jpoiret.xyz>
Tested-by: Glenn Washburn <development@efficientek.com>
---
grub-core/osdep/devmapper/getroot.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/grub-core/osdep/devmapper/getroot.c b/grub-core/osdep/devmapper/getroot.c
index 9ba5c98655..2bf4264cf0 100644
--- a/grub-core/osdep/devmapper/getroot.c
+++ b/grub-core/osdep/devmapper/getroot.c
@@ -138,7 +138,8 @@ 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-LUKS1-", sizeof ("CRYPT-LUKS1-") - 1) == 0
+ || strncmp (uuid, "CRYPT-LUKS2-", sizeof ("CRYPT-LUKS2-") - 1) == 0)
{
grub_free (uuid);
return GRUB_DEV_ABSTRACTION_LUKS;
@@ -179,7 +180,9 @@ 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-LUKS1-", sizeof ("CRYPT-LUKS1-") - 1) == 0
+ || strncmp (uuid, "CRYPT-LUKS2-", sizeof ("CRYPT-LUKS2-") - 1) == 0)
&& lastsubdev)
{
char *grdev = grub_util_get_grub_dev (lastsubdev);
@@ -253,11 +256,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.34.1
next prev parent reply other threads:[~2023-01-12 23:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-12 23:05 [PATCH 0/4] LUKS1/2 testing in fs-tester and LUKS2 support in grub-probe Glenn Washburn
2023-01-12 23:05 ` [PATCH 1/4] disk/cryptodisk: When cheatmounting, use the sector info of the cheat device Glenn Washburn
2023-01-12 23:05 ` Glenn Washburn [this message]
2023-01-12 23:05 ` [PATCH 3/4] devmapper/getroot: Set up cheated LUKS2 cryptodisk mount from DM parameters Glenn Washburn
2023-01-13 8:29 ` Patrick Steinhardt
2023-01-13 22:14 ` Vladimir 'phcoder' Serbinenko
2023-01-12 23:05 ` [PATCH 4/4] grub-fs-tester: Add luks1 and luks2 support Glenn Washburn
2023-01-13 8:31 ` [PATCH 0/4] LUKS1/2 testing in fs-tester and LUKS2 support in grub-probe Patrick Steinhardt
2023-01-16 20:58 ` Glenn Washburn
2023-01-25 19:17 ` Daniel Kiper
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230112230510.1319896-3-development@efficientek.com \
--to=development@efficientek.com \
--cc=dev@jpoiret.xyz \
--cc=dkiper@net-space.pl \
--cc=fvogt@suse.de \
--cc=grub-devel@gnu.org \
--cc=pierre-louis.bonicoli@libregerbil.fr \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.