[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [RFC] Erase LVM/crypto issues and proposed partman reorg



On Tuesday 04 December 2007, Max Vozeler wrote:
> David's changes include good code that can be reintroduced
> later on to a large extent [...]

Yes, absolutely. Same goes for the changes suggested by Jérémy.

I have committed the revert.

> > 1) Rename current "wipe" functions
> >
> > For partman-crypto I have a patch that renames the existing functions
> > to include the crypto namespace:
> > - wipe -> crypto_do_wipe
> > - dev_wipe -> crypto_wipe_device
>
> Good change, agreed. In fact I have a patch sitting here
> that does the exact same change, among others.

OK. Attached my version of the patch that also includes some other minor 
cleanups. Let me know if I should commit this or that you want to commit 
your own version. However, I will commit my version before I start on the 
reorganization (see below).

> I'm willing to put in some work to help deal with the
> implementation and fallout of this and the other proposed
> changes, (and eventually contribute to the reimplementation
> of the removal of crypto devices). I'm happy to set aside
> some time this weekend and review or test changes.

That's great. I don't expect much fallout, but some extra testing is always 
welcome. And help with the re-implementation is especially welcome.

I will start work on this tomorrow. If anybody has any pending changes for 
partman (that are solid enough), please commit them before then.

commit 57a25e19a742c544634c9c26d218a32e7b8eaab4
Author: Frans Pop <fjp@debian.org>
Date:   Mon Dec 3 00:30:36 2007 +0100

    Rename functions dev_wipe and wipe to be in crypto namespace

diff --git a/packages/partman/partman-crypto/active_partition/erasepart/do_option b/packages/partman/partman-crypto/active_partition/erasepart/do_option
index 35b696e..f53b6c1 100755
--- a/packages/partman/partman-crypto/active_partition/erasepart/do_option
+++ b/packages/partman/partman-crypto/active_partition/erasepart/do_option
@@ -22,5 +22,4 @@ open_dialog PARTITION_INFO $id
 read_line num id size type fs path name
 close_dialog
 
-dev_wipe $path $size $type || true
-
+crypto_wipe_device $path $size $type "" || true
diff --git a/packages/partman/partman-crypto/crypto_tools.sh b/packages/partman/partman-crypto/crypto_tools.sh
index d7f525b..4ed8931 100644
--- a/packages/partman/partman-crypto/crypto_tools.sh
+++ b/packages/partman/partman-crypto/crypto_tools.sh
@@ -129,7 +129,7 @@ setup_loopaes () {
 
 	log-output -t partman-crypto \
 	/sbin/losetup-aes -e $cipher $opts -p0 -G / $loop $device < $pass
-	if [ $? -ne 0 ] ; then
+	if [ $? -ne 0 ]; then
 		log "losetup failed"
 		return 2
 	fi
@@ -151,7 +151,7 @@ setup_dmcrypt () {
 
 	log-output -t partman-crypto \
 	/sbin/cryptsetup -c $cipher-$iv -d $pass -h $hash -s $size create $mapping $device
-	if [ $? -ne 0 ] ; then
+	if [ $? -ne 0 ]; then
 		log "cryptsetup failed"
 		return 2
 	fi
@@ -172,14 +172,14 @@ setup_luks () {
 
 	log-output -t partman-crypto \
 	/sbin/cryptsetup -c $cipher-$iv -s $size luksFormat $device $pass
-	if [ $? -ne 0 ] ; then
+	if [ $? -ne 0 ]; then
 		log "luksFormat failed"
 		return 2
 	fi
 
 	log-output -t partman-crypto \
 	/sbin/cryptsetup -d $pass luksOpen $device $mapping
-	if [ $? -ne 0 ] ; then
+	if [ $? -ne 0 ]; then
 		log "luksOpen failed"
 		return 2
 	fi
@@ -240,7 +240,7 @@ setup_cryptdev () {
 	return 0
 }
 
-wipe () {
+crypto_do_wipe () {
 	local template dev fifo pid x
 	template=$1
 	dev=$2
@@ -271,14 +271,14 @@ wipe () {
 	return $ret
 }
 
-dev_wipe () {
+crypto_wipe_device () {
 	local device size method interactive targetdevice
 	device=$1
 	size=$2
 	method=$3
 	interactive=$4
-	if [ "$interactive" != "no" ]; then
-		interactive="yes"
+	if [ "$interactive" != no ]; then
+		interactive=yes
 	fi
 	ret=1
 
@@ -311,7 +311,7 @@ dev_wipe () {
 	# Erase
 	template="partman-crypto/progress/erase"
 	db_subst $template DEVICE $(humandev $device)
-	if ! wipe $template $targetdevice; then
+	if ! crypto_do_wipe $template $targetdevice; then
 		template="partman-crypto/erase_failed"
 		db_subst $template DEVICE $(humandev $device)
 		db_input critical $template || true
@@ -773,7 +773,7 @@ crypto_setup() {
 				continue
 			fi
 
-			if ! dev_wipe $path $size $(cat $id/crypto_type) $interactive; then
+			if ! crypto_wipe_device $path $size $(cat $id/crypto_type) $interactive; then
 				db_fset partman-crypto/commit_failed seen false
 				db_input critical partman-crypto/commit_failed
 				db_go || true
diff --git a/packages/partman/partman-crypto/debian/changelog b/packages/partman/partman-crypto/debian/changelog
index 5d625f2..648b22d 100644
--- a/packages/partman/partman-crypto/debian/changelog
+++ b/packages/partman/partman-crypto/debian/changelog
@@ -1,10 +1,14 @@
 partman-crypto (24) UNRELEASED; urgency=low
 
+  [ Max Vozeler ]
   * Use veto_filesystems to allow only ext2 on crypto
     devices with random keys. Closes: #414638. This is only 
     effective with partman-basicmethods 36 or later.
 
- -- Max Vozeler <xam@debian.org>  Mon, 03 Dec 2007 00:19:49 +0100
+  [ Frans Pop ]
+  * Rename functions dev_wipe and wipe to be in crypto namespace.
+
+ -- Frans Pop <fjp@debian.org>  Mon, 03 Dec 2007 00:26:25 +0100
 
 partman-crypto (23) unstable; urgency=low
 

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: