[Pkg-cryptsetup-devel] Bug#445186: cryptsetup: Please load optimized cipher kernel modules by default

Reinhard Tartler siretart at ubuntu.com
Wed Oct 3 20:52:19 UTC 2007


Package: cryptsetup
Version: 2:1.0.5-2
Severity: wishlist

Hey there,

In ubuntu, we have patched cryptsetup so that it looks for
optimized ciphers kernel modules and loads them if
available. Please consider merging this patch to debian.

You can find the complete patch here:

http://patches.ubuntu.com/c/cryptsetup/cryptsetup_2:1.0.5-2ubuntu1.patch


Find the changes for this particular issue:

diff -pruN 2:1.0.5-2/debian/cryptdisks.functions 2:1.0.5-2ubuntu1/debian/cryptdisks.functions
--- 2:1.0.5-2/debian/cryptdisks.functions	2007-10-03 00:08:07.000000000 +0100
+++ 2:1.0.5-2ubuntu1/debian/cryptdisks.functions	2007-10-03 00:07:57.000000000 +0100
@@ -1,3 +1,8 @@
+#
+# This file is for inclusion with
+#	. /lib/cryptsetup/cryptdisks.functions
+# and should not be executed directly.
+
 PATH="/sbin:/bin"
 TABFILE=/etc/crypttab
 CRYPTDISKS_ENABLE="Yes"
@@ -391,6 +412,18 @@ do_close () {
 	return $?
 }
 
+load_optimized_aes_module () {
+        local asm_module modulesdir
+
+        # find directory with kernel modules
+        modulesdir="/lib/modules/`uname -r`"
+        # Add assembly optimized AES module if it exists
+        asm_module=`ls -1 "$modulesdir"/kernel/arch/*/*/aes*.ko`
+        if [ $asm_module ];then
+           insmod $asm_module 2>/dev/null || true
+        fi
+}
+
 # Sets up all entries in crypttab
 do_start () {
 	local dst src key opts result
@@ -399,6 +432,7 @@ do_start () {
 	modprobe -qb dm-crypt || true
 	dmsetup mknodes > /dev/null 2>&1 || true
 	log_action_begin_msg "Starting $INITSTATE crypto disks"
+	load_optimized_aes_module
 	mount_fs
 
 	egrep -v "^[[:space:]]*(#|$)" "$TABFILE" | while read dst src key opts; do

--- 2:1.0.5-2/debian/initramfs/cryptroot-hook	2007-10-03 00:08:07.000000000 +0100
+++ 2:1.0.5-2ubuntu1/debian/initramfs/cryptroot-hook	2007-10-03 00:07:57.000000000 +0100
@@ -357,9 +371,18 @@ add_device() {
 
 # Unless MODULES = "dep", we always add a basic subset of modules/tools
 if [ "$MODULES" != "dep" ]; then
-	for mod in dm_mod dm_crypt aes sha256 cbc; do
+	for mod in dm_mod dm_crypt sha256 cbc; do
 		manual_add_modules $mod
 	done
+
+	# Add assembly optimized AES module if it exists
+	asm_module=`find "$MODULESDIR"/kernel/arch/ -name aes\*`
+	if [ $asm_module ];then
+		manual_add_modules `basename "$asm_module"|sed s/.ko//`
+	else
+		manual_add_modules aes
+	fi
+
 	copy_exec /sbin/cryptsetup /sbin
 	copy_exec /sbin/dmsetup /sbin
 fi



-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4





More information about the Pkg-cryptsetup-devel mailing list