13 test_md=$(mdconfig -a "$@") || atf_fail "failed to allocate md(4)"
14 echo $test_md >> $TEST_MDS_FILE || exit
18 # Execute `func` for each combination of cipher, sectorsize, and hmac algo
19 # `func` usage should be:
20 # func <cipher> <aalgo> <secsize>
21 for_each_geli_config() {
25 # Double the sector size to allow for the HMACs' storage space.
26 osecsize=$(( $MAX_SECSIZE * 2 ))
27 # geli needs 512B for the label.
28 bytes=`expr $osecsize \* $sectors + 512`b
30 if [ -n "$backing_filename" ]; then
31 # Use a file-backed md(4) device, so we can deliberatly corrupt
32 # it without detaching the geli device first.
33 truncate -s $bytes backing_file
34 md=$(attach_md -t vnode -f backing_file)
36 md=$(attach_md -t malloc -s $bytes)
39 for cipher in aes-xts:128 aes-xts:256 \
40 aes-cbc:128 aes-cbc:192 aes-cbc:256 \
42 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \
43 blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \
44 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \
45 blowfish-cbc:416 blowfish-cbc:448 \
46 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
49 for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 \
50 hmac/sha384 hmac/sha512; do
51 for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do
52 ${func} $cipher $aalgo $secsize
53 geli detach ${md} 2>/dev/null
59 # Execute `func` for each combination of cipher, and sectorsize, with no hmac
60 # `func` usage should be:
61 # func <cipher> <secsize>
62 for_each_geli_config_nointegrity() {
65 # geli needs 512B for the label.
66 bytes=`expr $MAX_SECSIZE \* $sectors + 512`b
67 md=$(attach_md -t malloc -s $bytes)
68 for cipher in aes-xts:128 aes-xts:256 \
69 aes-cbc:128 aes-cbc:192 aes-cbc:256 \
71 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 \
72 blowfish-cbc:224 blowfish-cbc:256 blowfish-cbc:288 \
73 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \
74 blowfish-cbc:416 blowfish-cbc:448 \
75 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
78 for secsize in 512 1024 2048 4096 $MAX_SECSIZE; do
79 ${func} $cipher $secsize
80 geli detach ${md} 2>/dev/null
88 if [ -f "$TEST_MDS_FILE" ]; then
90 [ -c /dev/${md}.eli ] && \
91 geli detach $md.eli 2>/dev/null
92 mdconfig -d -u $md 2>/dev/null
98 . `dirname $0`/../geom_subr.sh