hal/volume_id luks.c, 1.2, 1.3 util.c, 1.2, 1.3 util.h, 1.2, 1.3 volume_id.c, 1.4, 1.5 volume_id.h, 1.5, 1.6

Kay Sievers kay at freedesktop.org
Thu Mar 3 16:42:02 PST 2005


Update of /cvs/hal/hal/volume_id
In directory gabe:/tmp/cvs-serv23762/volume_id

Modified Files:
	luks.c util.c util.h volume_id.c volume_id.h 
Log Message:
2005-03-04  Kay Sievers  <kay.sievers at vrfy.org>

        * volume_id/luks.c: (volume_id_probe_luks): Remove unneeded stuff.

        * volume_id/volume_id.h: Version v37.


2005-03-02  W. Michael Petullo  <mike at flyn.org>

        * volume_id/luks.c: (volume_id_probe_luks) Use new 
        UUID_DCE_UNPARSED format for volume_id_set_uuid call.

        * volume_id/util.c: (volume_id_set_uuid) Add UUID_DCE_UNPARSED
        format.

        * volume_id/util.h: Add UUID_DCE_UNPARSED format.

        * volume_id/volume_id.c: Only #include "luks.h" once.



Index: luks.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/luks.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- luks.c	25 Feb 2005 17:21:48 -0000	1.2
+++ luks.c	4 Mar 2005 00:42:00 -0000	1.3
@@ -40,58 +40,47 @@
 #include "logging.h"
 #include "luks.h"
 
-/* from cryptsetup-luks internal.h */
-#define SECTOR_SHIFT            9
-#define SECTOR_SIZE             (1 << SECTOR_SHIFT)
+#define SECTOR_SHIFT			9
+#define SECTOR_SIZE			(1 << SECTOR_SHIFT)
 
-/* from cryptsetup-luks luks.h */
-#define LUKS_CIPHERNAME_L 32
-#define LUKS_CIPHERMODE_L 32
-#define LUKS_HASHSPEC_L 32
-#define LUKS_DIGESTSIZE 20 /* since SHA1 */
-#define LUKS_SALTSIZE 32
-#define LUKS_NUMKEYS 8
+#define LUKS_CIPHERNAME_L		32
+#define LUKS_CIPHERMODE_L		32
+#define LUKS_HASHSPEC_L			32
+#define LUKS_DIGESTSIZE			20
+#define LUKS_SALTSIZE			32
+#define LUKS_NUMKEYS			8
 
-/* from cryptsetup-luks luks.h */
 const unsigned char LUKS_MAGIC[] = {'L','U','K','S', 0xba, 0xbe};
 #define LUKS_MAGIC_L 6
-
-/* from cryptsetup-luks luks.h */
 #define LUKS_PHDR_SIZE (sizeof(struct luks_phdr)/SECTOR_SIZE+1)
-
-/* from cryptsetup-luks luks.h */
 #define UUID_STRING_L 40
 
+struct luks_phdr {
+	char		magic[LUKS_MAGIC_L];
+	uint16_t	version;
+	char		cipherName[LUKS_CIPHERNAME_L];
+	char		cipherMode[LUKS_CIPHERMODE_L];
+	char		hashSpec[LUKS_HASHSPEC_L];
+	uint32_t	payloadOffset;
+	uint32_t	keyBytes;
+	char		mkDigest[LUKS_DIGESTSIZE];
+	char		mkDigestSalt[LUKS_SALTSIZE];
+	uint32_t	mkDigestIterations;
+	char		uuid[UUID_STRING_L];
+	struct {
+		uint32_t active;
+		uint32_t	passwordIterations;
+		char		passwordSalt[LUKS_SALTSIZE];
+		uint32_t	keyMaterialOffset;
+		uint32_t	stripes;
+	} keyblock[LUKS_NUMKEYS];
+};
+
 int volume_id_probe_luks(struct volume_id *id, __u64 off)
 {
-	/* from cryptsetup-luks luks.h */
-	struct luks_phdr {
-		char            magic[LUKS_MAGIC_L];
-		uint16_t        version;
-		char            cipherName[LUKS_CIPHERNAME_L];
-		char            cipherMode[LUKS_CIPHERMODE_L];
-		char            hashSpec[LUKS_HASHSPEC_L];
-		uint32_t        payloadOffset;
-		uint32_t        keyBytes;
-		char            mkDigest[LUKS_DIGESTSIZE];
-		char            mkDigestSalt[LUKS_SALTSIZE];
-		uint32_t        mkDigestIterations;
-		char            uuid[UUID_STRING_L];
-		struct {
-			uint32_t active;
-
-			/* parameters used for password processing */
-			uint32_t passwordIterations;
-			char     passwordSalt[LUKS_SALTSIZE];
-
-			/* parameters used for AF store/load */
-			uint32_t keyMaterialOffset;
-			uint32_t stripes;
-		} keyblock[LUKS_NUMKEYS];
-	} *header;
+	struct luks_phdr *header;
 
 	header = (struct luks_phdr*) volume_id_get_buffer(id, off, LUKS_PHDR_SIZE);
-
 	if (header == NULL)
 		return -1;
 
@@ -99,7 +88,8 @@
 		return -1;
 
 	volume_id_set_usage(id, VOLUME_ID_CRYPTO);
-	volume_id_set_uuid(id, header->uuid, UUID_DCE);
+	volume_id_set_uuid(id, header->uuid, UUID_DCE_STRING);
+
 	id->type = "crypto_LUKS";
 
 	return 0;

Index: util.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/util.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- util.c	16 Feb 2005 20:16:55 -0000	1.2
+++ util.c	4 Mar 2005 00:42:00 -0000	1.3
@@ -138,8 +138,13 @@
 		break;
 	case UUID_DCE:
 		count = 16;
+		break;
+	case UUID_DCE_STRING:
+		count = 36;
+		break;
 	}
 	memcpy(id->uuid_raw, buf, count);
+	id->uuid_raw_len = count;
 
 	/* if set, create string in the same format, the native platform uses */
 	for (i = 0; i < count; i++)
@@ -172,6 +177,10 @@
 			buf[8], buf[9],
 			buf[10], buf[11], buf[12], buf[13], buf[14],buf[15]);
 		break;
+	case UUID_DCE_STRING:
+		memcpy(id->uuid, buf, count);
+		id->uuid[count] = '\0';
+		break;
 	}
 }
 

Index: util.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/util.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- util.h	16 Feb 2005 22:40:47 -0000	1.2
+++ util.h	4 Mar 2005 00:42:00 -0000	1.3
@@ -71,6 +71,7 @@
 #endif
 
 enum uuid_format {
+	UUID_DCE_STRING,
 	UUID_DCE,
 	UUID_DOS,
 	UUID_NTFS,

Index: volume_id.c
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- volume_id.c	25 Feb 2005 17:21:48 -0000	1.4
+++ volume_id.c	4 Mar 2005 00:42:00 -0000	1.5
@@ -51,8 +51,8 @@
 #include "ntfs.h"
 #include "iso9660.h"
 #include "udf.h"
-#include "luks.h"
 #include "highpoint.h"
+#include "luks.h"
 #include "linux_swap.h"
 #include "linux_raid.h"
 #include "lvm.h"
@@ -60,7 +60,6 @@
 #include "hpfs.h"
 #include "romfs.h"
 #include "sysv.h"
-#include "luks.h"
 #include "mac.h"
 #include "msdos.h"
 

Index: volume_id.h
===================================================================
RCS file: /cvs/hal/hal/volume_id/volume_id.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- volume_id.h	25 Feb 2005 17:21:48 -0000	1.5
+++ volume_id.h	4 Mar 2005 00:42:00 -0000	1.6
@@ -21,11 +21,10 @@
 #ifndef _VOLUME_ID_H_
 #define _VOLUME_ID_H_
 
-#define VOLUME_ID_VERSION		36
+#define VOLUME_ID_VERSION		37
 
 #define VOLUME_ID_LABEL_SIZE		64
-#define VOLUME_ID_UUID_SIZE		16
-#define VOLUME_ID_UUID_STRING_SIZE	37
+#define VOLUME_ID_UUID_SIZE		36
 #define VOLUME_ID_FORMAT_SIZE		32
 #define VOLUME_ID_PATH_MAX		256
 #define VOLUME_ID_PARTITIONS_MAX	256
@@ -55,7 +54,8 @@
 	unsigned int	label_raw_len;
 	char		label[VOLUME_ID_LABEL_SIZE+1];
 	unsigned char	uuid_raw[VOLUME_ID_UUID_SIZE];
-	char		uuid[VOLUME_ID_UUID_STRING_SIZE];
+	unsigned int	uuid_raw_len;
+	char		uuid[VOLUME_ID_UUID_SIZE+1];
 	enum		volume_id_usage usage_id;
 	char		*usage;
 	char		*type;




More information about the hal-commit mailing list