From: Karsten Hopp <karsten@redhat.com>
To: linux-ext4@vger.kernel.org
Subject: Patch to support LUKS UUIDs in libblkid
Date: Tue, 05 Jun 2007 13:23:10 +0200 [thread overview]
Message-ID: <4665479E.2060707@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 553 bytes --]
Hello,
I've already posted this at the e2fsprogs sourceforge site, but our e2fsprogs maintainer
suggested that I should post it here as well for a review:
Attached is a patch to add cryptsetup-luks UUID detection in libblkid.so
This is required when we want to use UUIDs instead of hardcoded device names for
encrypted partitions.
Regards
Karsten Hopp
--
Karsten Hopp | Mail: karsten@redhat.de
Red Hat Deutschland | Tel: +49-711-96437-0
Hauptstaetterstr.58 | Fax: +49-711-613590
D-70178 Stuttgart | http://www.redhat.de
[-- Attachment #2: e2fsprogs-1.39-luks.patch --]
[-- Type: text/x-patch, Size: 1998 bytes --]
e2fsprogs-1.39-luks.patch
Problem: libblkid doesn't detect/report UUIDs of cryptsetup-luks partitions
Solution: Add probe for luks UUID
Signed-off-by: Karsten Hopp <karsten@redhat.com>
--- e2fsprogs-1.39/lib/blkid/ChangeLog.luksuuid 2007-05-22 20:51:54.000000000 +0200
+++ e2fsprogs-1.39/lib/blkid/ChangeLog 2007-05-22 20:55:08.000000000 +0200
@@ -0,0 +1,4 @@
+2007-05-22 Karsten Hopp <karsten@redhat.com>
+
+ * probe.c (probe_luks): Add support for cryptsetup-luks partitions
+
--- e2fsprogs-1.39/lib/blkid/probe.c.luksuuid 2007-05-22 14:48:12.000000000 +0200
+++ e2fsprogs-1.39/lib/blkid/probe.c 2007-05-22 20:49:17.000000000 +0200
@@ -468,6 +468,27 @@ static int probe_jfs(struct blkid_probe
return 0;
}
+/* check it manually as using LUKS_read_phdr from libcryptsetup
+ * prints too many warnings if it isn't a luks partition and would add a
+ * dependency on the lib */
+static int probe_luks(struct blkid_probe *probe,
+ struct blkid_magic *id __BLKID_ATTR((unused)),
+ unsigned char *buf)
+{
+ const char *luks_magic = id->bim_magic;
+ unsigned char *p_buf = buf;
+ unsigned char uuid[40];
+ if(strncmp(buf, luks_magic, strlen(luks_magic)) == 0) /* ID matches, continue */
+ {
+ /* 168 is the offset to the 40 character uuid: http://luks.endorphin.org/LUKS-on-disk-format.pdf */
+ p_buf += 168;
+ strncpy(uuid, p_buf, 40);
+ blkid_set_tag(probe->dev, "UUID", uuid, sizeof(uuid));
+ blkid_set_tag(probe->dev, "SEC_TYPE", "crypt_LUKS", sizeof("crypt_LUKS"));
+ }
+ return 0;
+}
+
static int probe_romfs(struct blkid_probe *probe,
struct blkid_magic *id __BLKID_ATTR((unused)),
unsigned char *buf)
@@ -775,6 +796,7 @@ static struct blkid_magic type_array[] =
{ "ocfs2", 2, 0, 6, "OCFSV2", probe_ocfs2 },
{ "ocfs2", 4, 0, 6, "OCFSV2", probe_ocfs2 },
{ "ocfs2", 8, 0, 6, "OCFSV2", probe_ocfs2 },
+ { "crypt_LUKS", 0, 0, 6, "LUKS\xba\xbe", probe_luks },
{ NULL, 0, 0, 0, NULL, NULL }
};
next reply other threads:[~2007-06-05 11:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-05 11:23 Karsten Hopp [this message]
2007-06-05 14:20 ` Patch to support LUKS UUIDs in libblkid Eric Sandeen
2007-06-05 23:17 ` Andreas Dilger
2007-06-08 15:36 ` Theodore Tso
2007-06-11 11:51 ` Karsten Hopp
2007-06-12 23:40 ` Theodore Tso
2007-06-13 11:00 ` Karsten Hopp
2007-06-21 17:56 ` Theodore Tso
2007-07-03 9:19 ` Karsten Hopp
2007-07-03 15:57 ` Eric Sandeen
[not found] ` <46964694.7000707@redhat.com>
2007-07-23 15:00 ` Karsten Hopp
2007-07-23 16:19 ` Theodore Tso
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=4665479E.2060707@redhat.com \
--to=karsten@redhat.com \
--cc=linux-ext4@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).