Written by Jari Ruusu , August 26 2003 Copyright 2002,2003 by Jari Ruusu. Redistribution of this file is permitted under the GNU Public License. Table of Contents ~~~~~~~~~~~~~~~~~ 1. General information 2. Instructions for building loop cipher modules 3. Testing loop cipher modules 4. Cipher names that are available to losetup and mount programs 5. Example 6. Compatibility with other loop encryption implementations 7. Known bugs 8. Files 1. General information ~~~~~~~~~~~~~~~~~~~~~~ These cipher modules are intended to be used in combination with loop-AES version v1.7b or later and linux kernel versions 2.2 or later. Latest version of this package can be found at: http://loop-aes.sourceforge.net/ http://members.surfeu.fi/ce6c8edf/ (limited downloads) New versions are announced at linux-crypto mailing list: http://mail.nl.linux.org/linux-crypto/ http://marc.theaimsgroup.com/?l=linux-crypto 2. Instructions for building loop cipher modules ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To compile and install loop cipher modules, as root, use commands: make clean make Makefile tries to locate running kernel source directory, steal definitions from kernel Makefile, and build versions that match your running kernel. Following directories are tried, in this order: /lib/modules/`uname -r`/build /usr/src/linux /usr/src/linux-`uname -r` /usr/src/kernel-source-`uname -r` You can override automatic kernel source directory detection by specifying LINUX_SOURCE like this: make LINUX_SOURCE=/usr/src/linux-2.2.20aa1 Automatic kernel source directory detection is not foolproof. For best results, always specify LINUX_SOURCE, especially if modules appear to compile for wrong kernel. Observe last five lines of make output for clues. You can override default installation root directory by specifying INSTALL_MOD_PATH like this: make INSTALL_MOD_PATH=/path/to/destination/root 3. Testing loop cipher modules ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Run this command, as root, and Makefile will run series of tests. make tests Makefile will display "*** Test results ok ***" message if tests are completed successfully. If tests fail, do not use these modules as they are broken. 4. Cipher names that are available to losetup and mount programs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ loop_twofish.o : twofish128 twofish160 twofish192 twofish256 loop_blowfish.o : blowfish128 blowfish192 blowfish256 loop_serpent.o : serpent128 serpent192 serpent256 5. Example ~~~~~~~~~~ This example shows how to create an ext2 file system on encrypted hard disk partition. This example uses a fictious partition /dev/hda666 for storage and fictious directory /mnt666 as mount point. The "losetup -e" command asks for encryption password, make up one and don't forget it. modprobe loop_twofish losetup -e twofish128 -T /dev/loop0 /dev/hda666 mkfs -t ext2 /dev/loop0 losetup -d /dev/loop0 mkdir /mnt666 Add this to your /etc/fstab file: /dev/hda666 /mnt666 ext2 defaults,noauto,loop=/dev/loop0,encryption=twofish128 0 0 Now you should be able to mount the file system like this. The "mount" command asks for your encryption password. modprobe loop_twofish mount /mnt666 And unmount it like this: umount /mnt666 Or without modifying /etc/fstab, you can mount and and unmount file system like this: modprobe loop_twofish mount -t ext2 /dev/hda666 /mnt666 -o loop=/dev/loop0,encryption=twofish128 umount /mnt666 Or fsck, mount and unmount like this. Losetup -F option reads loop related options from /etc/fstab. Partition name /dev/hda666 and encryption=twofish128 come from /etc/fstab. modprobe loop_twofish losetup -F -T /dev/loop0 fsck -t ext2 -f -y /dev/loop0 mount -t ext2 /dev/loop0 /mnt666 umount /mnt666 losetup -d /dev/loop0 6. Compatibility with other loop encryption implementations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To use (big-endian-)serpent, AES, twofish, or blowfish disk images encrypted using kerneli.org 512-byte-IV version (which uses RIPE-MD160 as password hash), use commands like these: losetup -e twofish128 -H rmd160 /dev/loop0 /dev/hda9 or ^^^^^^^^^ mount -t ext2 /dev/hda9 /mnt9 -o loop,encryption=twofish128,phash=rmd160 ^^^^^^^^^^^^ Serpent module interprets loinit=1 option as "little-endian" flag. To use correct little-endian serpent disk images, use commands like these: losetup -e serpent128 -I 1 /dev/loop0 /dev/hda9 or ^^^^ mount -t ext2 /dev/hda9 /mnt9 -o loop,encryption=serpent128,loinit=1 ^^^^^^^^ Blowfish module interprets loinit=1 option as "bug-compatible" flag. To use mutated-little-endian blowfish disk images encrypted using kerneli.org 512-byte-IV version, use commands like these: losetup -e blowfish128 -H rmd160 -I 1 /dev/loop0 /dev/hda9 or ^^^^^^^^^ ^^^^ mount -t ext2 /dev/hda9 /mnt9 -o loop,encryption=blowfish128,phash=rmd160,loinit=1 ^^^^^^^^^^^^ ^^^^^^^^ Twofish module interprets loinit=1 option as "SuSE-compatible" flag. To use twofish disk images encrypted using SuSE-kernel-twofish version (which uses constant IV for each 512 byte sector), use commands like these: losetup -e twofish160 -H rmd160 -I 1 /dev/loop0 /dev/hda9 or ^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^ mount -t ext2 /dev/hda9 /mnt9 -o loop,encryption=twofish160,phash=rmd160,loinit=1 ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^ ^^^^^^^^ 7. Known bugs ~~~~~~~~~~~~~ Serpent loop cipher module implementation in v1.0 versions of this package have a bug: They encode on-disk data in big-endian format when data should be encoded in little-endian format. Blowfish and twofish loop cipher modules are not affected. This bug doesn't compromise security of data, but it does cause on-disk format incompatibility. This version understands both on-disk formats, but by default uses incorrect big-endian encoding for 100% compatibility with earlier releases. To be fully compatible with correct little-endian encoded disk images, losetup program needs "-I 1" option and mount program needs "-o loinit=1" mount option. Mount option can be given on command line (root user only), or it can be added to /etc/fstab file. 8. Files ~~~~~~~~ ChangeLog History of changes and public releases. Makefile Makefile to build and install loop cipher modules. README This README file. loop_blowfish.c Loop cipher module that provides blowfish encryption. loop_serpent.c Loop cipher module that provides serpent encryption. loop_twofish.c Loop cipher module that provides twofish encryption.