Skip to contentSkip to conversation

Add MMC Password Protection (lock/unlock) support V6

RFC PATCH In review Anderson Briglia 2 participants 2 messages Nov 17, 2006 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

RFC PATCH 2/6 Add MMC Password Protection (lock/unlock) support V6

Implement key retention operations.

Signed-off-by Carlos Eduardo Aguiar <carlos.aguiar <at> indt.org.br>
Signed-off-by Anderson Lizardo <anderson.lizardo <at> indt.org.br>
Signed-off-by Anderson Briglia <anderson.briglia <at> indt.org.br>
drivers/mmc/Kconfig +13 -0
Index: linux-omap-2.6.git/drivers/mmc/Kconfig
===================================================================
@@ -19,6 +19,19 @@ config MMC_DEBUG
 	  This is an option for use by developers; most people should
 	  say N here.  This enables MMC core and driver debugging.
 
+config MMC_PASSWORDS
+	boolean "MMC card lock/unlock passwords (EXPERIMENTAL)"
+	depends on MMC && EXPERIMENTAL
+	select KEYS
+	help
+	  Say Y here to enable the use of passwords to lock and unlock
+	  MMC cards.  This uses the access key retention support, using
+	  request_key to look up the key associated with each card.
+
+	  For example, if you have an MMC card that was locked using
+	  Symbian OS on your cell phone, you won't be able to read it
+	  on Linux without this support.
+
 config MMC_BLOCK
 	tristate "MMC block device driver"
 	depends on MMC && BLOCK
drivers/mmc/mmc.h +8 -0
Index: linux-omap-2.6.git/drivers/mmc/mmc.h
===================================================================
@@ -19,6 +19,14 @@ int mmc_add_host_sysfs(struct mmc_host *
 void mmc_remove_host_sysfs(struct mmc_host *host);
 void mmc_free_host_sysfs(struct mmc_host *host);
 
+/* core-internal data */
+extern struct key_type mmc_key_type;
+struct mmc_key_payload {
+	struct rcu_head	rcu;		/* RCU destructor */
+	unsigned short	datalen;	/* length of this data */
+	char		data[0];	/* actual data */
+};
+
 int mmc_schedule_work(struct work_struct *work);
 int mmc_schedule_delayed_work(struct work_struct *work, unsigned long delay);
 void mmc_flush_scheduled_work(void);
drivers/mmc/mmc_sysfs.c +87 -1

119 lines not on this page · raw message

Implement key retention operations.

Signed-off-by Carlos Eduardo Aguiar <carlos.aguiar <at> indt.org.br>
Signed-off-by Anderson Lizardo <anderson.lizardo <at> indt.org.br>
Signed-off-by Anderson Briglia <anderson.briglia <at> indt.org.br>
drivers/mmc/Kconfig +13 -0
Index: linux-omap-2.6.git/drivers/mmc/Kconfig
===================================================================
@@ -19,6 +19,19 @@ config MMC_DEBUG
 	  This is an option for use by developers; most people should
 	  say N here.  This enables MMC core and driver debugging.
 
+config MMC_PASSWORDS
+	boolean "MMC card lock/unlock passwords (EXPERIMENTAL)"
+	depends on MMC && EXPERIMENTAL
+	select KEYS
+	help
+	  Say Y here to enable the use of passwords to lock and unlock
+	  MMC cards.  This uses the access key retention support, using
+	  request_key to look up the key associated with each card.
+
+	  For example, if you have an MMC card that was locked using
+	  Symbian OS on your cell phone, you won't be able to read it
+	  on Linux without this support.
+
 config MMC_BLOCK
 	tristate "MMC block device driver"
 	depends on MMC && BLOCK
drivers/mmc/mmc.h +8 -0
Index: linux-omap-2.6.git/drivers/mmc/mmc.h
===================================================================
@@ -19,6 +19,14 @@ int mmc_add_host_sysfs(struct mmc_host *
 void mmc_remove_host_sysfs(struct mmc_host *host);
 void mmc_free_host_sysfs(struct mmc_host *host);
 
+/* core-internal data */
+extern struct key_type mmc_key_type;
+struct mmc_key_payload {
+	struct rcu_head	rcu;		/* RCU destructor */
+	unsigned short	datalen;	/* length of this data */
+	char		data[0];	/* actual data */
+};
+
 int mmc_schedule_work(struct work_struct *work);
 int mmc_schedule_delayed_work(struct work_struct *work, unsigned long delay);
 void mmc_flush_scheduled_work(void);
drivers/mmc/mmc_sysfs.c +87 -1

120 lines not on this page · raw message

#1 lore raw

drivers/mmc/mmc_sysfs.c static int __init mmc_init(void) · line 443

Quoted 12 lines · Anderson Briglia
drivers/mmc/mmc_sysfs.c +7 -1
@@ -366,15 +434,33 @@ static int __init mmc_init(void)
 	if (ret == 0) {
 		ret = class_register(&mmc_host_class);
 		if (ret)
-			bus_unregister(&mmc_bus_type);
+			goto error;
+	}
+#ifdef	CONFIG_MMC_PASSWORDS
+	else {
+		ret = register_key_type(&mmc_key_type);
+		if (ret)
+			goto error_mmc_pwd;

This is obviously untested - you won't get to register the key type if bus_register() succeeds. You actually only register it if bus_register() fails.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core