Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > media > main-src > by-pkgid > 087c07ba1119dc259cb65abc62ef69e9 > files > 36

e2fsprogs-1.39-20.el5.src.rpm

From: Karsten Hopp <karsten@redhat.com>
Date: Thu, 21 Jun 2007 17:43:33 +0000 (-0400)
Subject: Add support for LUKS encrypted partitions
X-Git-Tag: E2FSPROGS-1_40~11
X-Git-Url: http://git.kernel.org/?p=fs%2Fext2%2Fe2fsprogs.git;a=commitdiff_plain;h=e382a7eaded3ec6b38114988ae9b0723bb48002a

Add support for LUKS encrypted partitions

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>
---

Index: e2fsprogs-1.39/lib/blkid/ChangeLog
===================================================================
--- e2fsprogs-1.39.orig/lib/blkid/ChangeLog	2008-09-30 13:24:05.000000000 -0500
+++ e2fsprogs-1.39/lib/blkid/ChangeLog	2008-09-30 13:24:57.752001049 -0500
@@ -1,3 +1,7 @@
+2007-05-22  Karsten Hopp  <karsten@redhat.com>
+
+	* probe.c (probe_luks): Add support for cryptsetup-luks partitions
+
 2007-03-23  Theodore Tso  <tytso@mit.edu>
 
 	* read.c (parse_dev): Fix memory leak on error path.
Index: e2fsprogs-1.39/lib/blkid/probe.c
===================================================================
--- e2fsprogs-1.39.orig/lib/blkid/probe.c	2008-09-30 13:24:06.000000000 -0500
+++ e2fsprogs-1.39/lib/blkid/probe.c	2008-09-30 13:24:28.410064545 -0500
@@ -666,6 +666,18 @@ static int probe_jfs(struct blkid_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)
@@ -975,6 +987,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 }
 };