All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mikulas Patocka <mpatocka@redhat.com>
To: dm-devel@redhat.com
Cc: Milan Broz <mbroz@redhat.com>, Alasdair G Kergon <agk@redhat.com>,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH] dm-crypt: disable block encryption with arc4
Date: Mon, 25 Jan 2010 13:39:48 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.64.1001251336311.18309@hs20-bc2-1.build.redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1001251324310.18309@hs20-bc2-1.build.redhat.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 206 bytes --]

BTW. I created a script that tests all possible ciphers, keysizes, 
chaining modes and iv modes for dm-crypt. arc4 is the only one that fails. 
You can add it your regression testsuite if you want.

Mikulas

[-- Attachment #2: test-cipher --]
[-- Type: TEXT/PLAIN, Size: 285 bytes --]

#!/bin/sh
dmsetup remove cr0
set -e
cipher="$@"
cryptsetup -d key $cipher create cr0 /dev/ram0
mkfs.ext3 -b 1024 /dev/mapper/cr0
fsck.ext2 -fn /dev/mapper/cr0
dmsetup remove cr0
cryptsetup -d key $cipher create cr0 /dev/ram0
fsck.ext2 -fn /dev/mapper/cr0
dmsetup remove cr0

[-- Attachment #3: cryptest --]
[-- Type: TEXT/PLAIN, Size: 3987 bytes --]

#!/bin/sh
set -e
>log
# arc4 - doesn't work
for cipher in aes anubis blowfish camellia cast5 cast6 des des3_ede fcrypt khazad seed serpent tnepres tea xtea xeta; do
	if [ -n "$1" -a "$cipher" != "$1" ]; then
		continue
	fi
	if [ $cipher = aes ]; then
		keysizes="128 192 256"
		blocksize=128
	elif [ $cipher = anubis ]; then
		keysizes="`seq 128 32 320`"
		blocksize=128
	elif [ $cipher = arc4 ]; then
		keysizes="`seq 8 256 2048` 2048"
		blocksize=1
	elif [ $cipher = blowfish ]; then
		keysizes="`seq 32 8 448`"
		blocksize=64
	elif [ $cipher = camellia ]; then
		keysizes="128 192 256"
		blocksize=128
	elif [ $cipher = cast5 ]; then
		keysizes="`seq 40 8 128`"
		blocksize=64
	elif [ $cipher = cast6 ]; then
		keysizes="`seq 128 32 256`"
		blocksize=128
	elif [ $cipher = des ]; then
		keysizes=64
		blocksize=64
	elif [ $cipher = des3_ede ]; then
		keysizes=192
		blocksize=64
	elif [ $cipher = fcrypt ]; then
		keysizes=64
		blocksize=64
	elif [ $cipher = khazad ]; then
		keysizes=128
		blocksize=64
	elif [ $cipher = seed ]; then
		keysizes=128
		blocksize=128
	elif [ $cipher = serpent -o $cipher = tnepres ]; then
		keysizes="`seq 0 8 256`"
		blocksize=128
	elif [ $cipher = tea -o $cipher = xtea -o $cipher = xeta ]; then
		keysizes=128
		blocksize=64
	elif [ $cipher = twofish ]; then
		keysizes="128 192 256"
		blocksize=128
	else
		echo UNKNOWN CIPHER
		exit 1
	fi
	for keysize in $keysizes; do
		# if ! echo $keysizes | grep -qw $keysize$; then continue; fi
		for chaining in cbc ctr ecb lrw pcbc xts; do
			chaining_keysize=$keysize
			if [ $chaining = xts ]; then
				chaining_keysize=`expr $chaining_keysize \* 2 | cat`;
				if [ $blocksize != 128 ]; then continue; fi
			fi
			if [ $chaining = lrw ]; then
				chaining_keysize=`expr $chaining_keysize + $blocksize | cat`
				if [ $blocksize != 128 ]; then continue; fi
			fi
			for iv in null plain benbi essiv:md4 essiv:md5 essiv:michael_mic essiv:rmd128 essiv:rmd160 essiv:rmd256 essiv:rmd320 essiv:sha1 essiv:sha224 essiv:sha256 essiv:sha384 essiv:sha512 essiv:tgr128 essiv:tgr160 essiv:tgr192 essiv:wp256 essiv:wp384 essiv:wp512; do
				if [ $chaining = ecb ] && echo "$iv" | grep -q ^essiv; then continue; fi
				if [ $iv = essiv:md4 ] && ! echo $keysizes | grep -qw 128; then continue; fi
				if [ $iv = essiv:md5 ] && ! echo $keysizes | grep -qw 128; then continue; fi
				if [ $iv = essiv:michael_mic ] && ! echo $keysizes | grep -qw 64; then continue; fi
				if [ $iv = essiv:rmd128 ] && ! echo $keysizes | grep -qw 128; then continue; fi
				if [ $iv = essiv:rmd160 ] && ! echo $keysizes | grep -qw 160; then continue; fi
				if [ $iv = essiv:rmd256 ] && ! echo $keysizes | grep -qw 256; then continue; fi
				if [ $iv = essiv:rmd320 ] && ! echo $keysizes | grep -qw 320; then continue; fi
				if [ $iv = essiv:sha1 ] && ! echo $keysizes | grep -qw 160; then continue; fi
				if [ $iv = essiv:sha224 ] && ! echo $keysizes | grep -qw 224; then continue; fi
				if [ $iv = essiv:sha256 ] && ! echo $keysizes | grep -qw 256; then continue; fi
				if [ $iv = essiv:sha384 ] && ! echo $keysizes | grep -qw 384; then continue; fi
				if [ $iv = essiv:sha512 ] && ! echo $keysizes | grep -qw 512; then continue; fi
				if [ $iv = essiv:tgr128 ] && ! echo $keysizes | grep -qw 128; then continue; fi
				if [ $iv = essiv:tgr160 ] && ! echo $keysizes | grep -qw 160; then continue; fi
				if [ $iv = essiv:tgr192 ] && ! echo $keysizes | grep -qw 192; then continue; fi
				if [ $iv = essiv:wp256 ] && ! echo $keysizes | grep -qw 256; then continue; fi
				if [ $iv = essiv:wp384 ] && ! echo $keysizes | grep -qw 384; then continue; fi
				if [ $iv = essiv:wp512 ] && ! echo $keysizes | grep -qw 512; then continue; fi
				echo TESTING: CIPHER $cipher, KEYSIZE $chaining_keysize, CHAINING $chaining, IV $iv | tee -a log
				./test-cipher -s $chaining_keysize -c $cipher-$chaining-$iv
			done
		done
	done
done
echo PASSED

      parent reply	other threads:[~2010-01-25 18:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-25 18:29 [PATCH] dm-crypt: disable block encryption with arc4 Mikulas Patocka
2010-01-25 18:39 ` Milan Broz
2010-01-26  9:22   ` Sebastian Andrzej Siewior
2010-01-26 10:48     ` Milan Broz
2010-01-26 12:27       ` Mikulas Patocka
2010-01-26 13:34         ` Sebastian Andrzej Siewior
2010-01-26 17:11           ` Mikulas Patocka
2010-02-09  7:37         ` Herbert Xu
2010-02-09 14:02           ` Mikulas Patocka
2010-02-09 20:42             ` Herbert Xu
2010-02-09 14:57           ` Sebastian Andrzej Siewior
2010-02-09 20:45             ` Herbert Xu
2010-02-09 21:12               ` Sebastian Andrzej Siewior
2010-02-09 21:45                 ` Herbert Xu
2010-02-12  8:42                   ` [PATCH] crypto/arc4: convert this stream cipher into a block cipher Sebastian Andrzej Siewior
2010-02-12  9:34                     ` Adrian-Ken Rueegsegger
2010-02-12  9:57                       ` Sebastian Andrzej Siewior
2010-02-14 20:42                     ` Sebastian Andrzej Siewior
2010-02-15  0:10                       ` Herbert Xu
2010-02-15  8:49                         ` Sebastian Andrzej Siewior
2010-02-16 12:51                     ` Herbert Xu
2010-02-21 20:01                       ` Sebastian Andrzej Siewior
2010-02-22  0:45                         ` Herbert Xu
2010-02-22  0:52                           ` Herbert Xu
2010-02-22 22:08                             ` Sebastian Andrzej Siewior
2010-02-23  0:32                               ` Herbert Xu
2010-03-14  8:24                                 ` Sebastian Andrzej Siewior
2010-03-14  9:06                                   ` Herbert Xu
     [not found]                       ` <Pine.LNX.4.64.1002221400090.31819@hs20-bc2-1.build.redhat.com>
2010-02-23  0:15                         ` Herbert Xu
2010-01-26 12:59   ` [dm-devel] [PATCH] dm-crypt: disable block encryption with arc4 Alasdair G Kergon
2010-01-25 18:39 ` Mikulas Patocka [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.1001251336311.18309@hs20-bc2-1.build.redhat.com \
    --to=mpatocka@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=mbroz@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.