[Pkg-loop-aes-commits] r1357 - /trunk/loop-aes-utils/debian/loop-aes-keygen

xam at users.alioth.debian.org xam at users.alioth.debian.org
Sat Feb 24 19:31:50 CET 2007


Author: xam
Date: Sat Feb 24 19:31:50 2007
New Revision: 1357

URL: http://svn.debian.org/wsvn/pkg-loop-aes/?sc=1&rev=1357
Log:
loop-aes-keygen: Add check for multi-key support in losetup

Modified:
    trunk/loop-aes-utils/debian/loop-aes-keygen

Modified: trunk/loop-aes-utils/debian/loop-aes-keygen
URL: http://svn.debian.org/wsvn/pkg-loop-aes/trunk/loop-aes-utils/debian/loop-aes-keygen?rev=1357&op=diff
==============================================================================
--- trunk/loop-aes-utils/debian/loop-aes-keygen (original)
+++ trunk/loop-aes-utils/debian/loop-aes-keygen Sat Feb 24 19:31:50 2007
@@ -137,6 +137,22 @@
 	return 0
 }
 
+check_multikey_support ()
+{
+	match=
+	case $1 in
+	1)
+		return 0;;
+	2)
+		match="multi-key";;
+	3)
+		match="multi-key-v3";;
+	*)
+		return 1;;
+	esac
+	grep -q "$match" /sbin/losetup
+}
+
 keygen()
 {
 	version=$1
@@ -148,10 +164,14 @@
 	#  v2.x   64   2880 bytes(45 * 64)  AES keys       
 	#  v3.x   65   2925 bytes(45 * 65)  #65 is md5 seed
 	case $version in
-	1) nkeys=1 ;;
-	2) nkeys=64 ;;
-	3) nkeys=65 ;;
-	*) return 1 ;;
+	1) 
+		nkeys=1;;
+	2) 
+		nkeys=64;;
+	3) 
+		nkeys=65;;
+	*) 
+		return 1;;
 	esac
 
 	bytes=$((45*$nkeys))
@@ -172,6 +192,10 @@
 if ! [ -x /usr/bin/uuencode ]; then
 	echo "Error: uuencode not found - see package sharutils"
 	exit 1
+fi
+
+if ! check_multikey_support $version; then
+	echo "Warning: /sbin/losetup too old for v$version keys."
 fi
 
 if [ -e $keyfile ]; then




More information about the Pkg-loop-aes-commits mailing list