conf.sh revision 312828
1#!/bin/sh
2# $FreeBSD: stable/10/tests/sys/geom/class/eli/conf.sh 312828 2017-01-26 20:10:31Z asomers $
3
4class="eli"
5base=`basename $0`
6
7# We need to use linear probing in order to detect the first available md(4)
8# device instead of using mdconfig -a -t, because geli(8) attachs md(4) devices
9no=0
10while [ -c /dev/md$no ]; do
11	: $(( no += 1 ))
12done
13
14# Execute `func` for each combination of cipher, sectorsize, and hmac algo
15# `func` usage should be:
16# func <cipher> <aalgo> <secsize>
17for_each_geli_config() {
18	func=$1
19
20	for cipher in aes-xts:128 aes-xts:256 \
21	    aes-cbc:128 aes-cbc:192 aes-cbc:256 \
22	    3des-cbc:192 \
23	    blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \
24	    blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \
25	    blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \
26	    blowfish-cbc:416 blowfish-cbc:448 \
27	    camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
28		ealgo=${cipher%%:*}
29		keylen=${cipher##*:}
30		for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \
31		    hmac/sha384 hmac/sha512; do
32			for secsize in 512 1024 2048 4096 8192; do
33				${func} $cipher $aalgo $secsize
34			done
35		done
36	done
37}
38
39# Execute `func` for each combination of cipher, and sectorsize, with no hmac
40# `func` usage should be:
41# func <cipher> <secsize>
42for_each_geli_config_nointegrity() {
43	func=$1
44
45	for cipher in aes-xts:128 aes-xts:256 \
46	    aes-cbc:128 aes-cbc:192 aes-cbc:256 \
47	    3des-cbc:192 \
48	    blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \
49	    blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \
50	    blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \
51	    blowfish-cbc:416 blowfish-cbc:448 \
52	    camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
53		ealgo=${cipher%%:*}
54		keylen=${cipher##*:}
55		for secsize in 512 1024 2048 4096 8192; do
56			${func} $cipher $aalgo $secsize
57		done
58	done
59}
60
61
62geli_test_cleanup()
63{
64	[ -c /dev/md${no}.eli ] && geli detach md${no}.eli
65	mdconfig -d -u $no
66}
67trap geli_test_cleanup ABRT EXIT INT TERM
68
69. `dirname $0`/../geom_subr.sh
70