]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
Add support for LUKS encrypted partitions
authorKarsten Hopp <karsten@redhat.com>
Thu, 21 Jun 2007 17:43:33 +0000 (13:43 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 21 Jun 2007 17:43:33 +0000 (13:43 -0400)
This patch adds support for cryptsetup-luks (http://luks.endorphin.org)
UUIDs to libblkid.  This is required p.e. to avoid hardcoding device
names for encrypted partitions.  Could you please take a look at it and
consider inclusion in the next e2fsprogs release ?

Signed-off-by: Karsten Hopp <karsten@redhat.com>
lib/blkid/ChangeLog
lib/blkid/probe.c

index d2de7b9c05fee8ab3feb3c962ea3d4e42d88da1f..a4b469b820575f45a0d52ec08c9b1ca7bbd7eb17 100644 (file)
@@ -1,3 +1,7 @@
+2007-05-22  Karsten Hopp  <karsten@redhat.com>
+
+       * probe.c (probe_luks): Add support for cryptsetup-luks partitions
+
 2007-06-19  Theodore Tso  <tytso@mit.edu>
 
        * probe.c (probe_ntfs): Add probe function which is more paranoid
index 211c8bd4c03e32ed092149b73bbcacd407154f54..0a1d8db63c4564e10cc901f2b7cff6eae9fa2b21 100644 (file)
@@ -575,6 +575,18 @@ static int probe_jfs(struct blkid_probe *probe,
        return 0;
 }
 
+static int probe_luks(struct blkid_probe *probe,
+                      struct blkid_magic *id __BLKID_ATTR((unused)),
+                      unsigned char *buf)
+{
+       unsigned char uuid[40];
+       /* 168 is the offset to the 40 character uuid:
+        * http://luks.endorphin.org/LUKS-on-disk-format.pdf */
+       strncpy(uuid, buf+168, 40);
+       blkid_set_tag(probe->dev, "UUID", uuid, sizeof(uuid));
+       return 0;
+}
+
 static int probe_romfs(struct blkid_probe *probe,
                       struct blkid_magic *id __BLKID_ATTR((unused)), 
                       unsigned char *buf)
@@ -882,6 +894,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 }
 };