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