xref: /freebsd/tests/sys/geom/class/eli/init_test.sh (revision 96950419f15510287080c557174e0d8409f06956)
109d98641SEnji Cooper#!/bin/sh
209d98641SEnji Cooper
3cf551b8aSAlan Somers. $(atf_get_srcdir)/conf.sh
4cf551b8aSAlan Somers
5f397a004SAlan Somersinit_test()
6f397a004SAlan Somers{
7f92ce022SAlan Somers	cipher=$1
8f92ce022SAlan Somers	secsize=$2
909d98641SEnji Cooper	ealgo=${cipher%%:*}
1009d98641SEnji Cooper	keylen=${cipher##*:}
1109d98641SEnji Cooper
12f397a004SAlan Somers	atf_check -s exit:0 -e ignore \
1348c29f84SAlan Somers		geli init -B none -e $ealgo -l $keylen -P -K keyfile \
145dce212dSAlan Somers		-s $secsize ${md}
15f397a004SAlan Somers	atf_check geli attach -p -k keyfile ${md}
1609d98641SEnji Cooper
175dce212dSAlan Somers	atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} \
185dce212dSAlan Somers		status=none
1909d98641SEnji Cooper
205dce212dSAlan Somers	md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5`
21f397a004SAlan Somers	atf_check_equal 0 $?
225dce212dSAlan Somers	md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5`
23f397a004SAlan Somers	atf_check_equal 0 $?
245dce212dSAlan Somers	md_edev=`dd if=/dev/${md} bs=${secsize} count=${sectors} status=none | md5`
25f397a004SAlan Somers	atf_check_equal 0 $?
2609d98641SEnji Cooper
27f397a004SAlan Somers	if [ ${md_rnd} != ${md_ddev} ]; then
28f397a004SAlan Somers		atf_fail "Miscompare for ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
2909d98641SEnji Cooper	fi
30f397a004SAlan Somers	if [ ${md_rnd} == ${md_edev} ]; then
31f397a004SAlan Somers		atf_fail "Data was not encrypted for ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
3209d98641SEnji Cooper	fi
33f397a004SAlan Somers}
34f397a004SAlan Somersatf_test_case init cleanup
35f397a004SAlan Somersinit_head()
36f397a004SAlan Somers{
37f397a004SAlan Somers	atf_set "descr" "Basic I/O with geli"
38f397a004SAlan Somers	atf_set "require.user" "root"
39f397a004SAlan Somers	atf_set "timeout" 600
40f397a004SAlan Somers}
41f397a004SAlan Somersinit_body()
42f397a004SAlan Somers{
43cf551b8aSAlan Somers	geli_test_setup
44f397a004SAlan Somers
45f397a004SAlan Somers	sectors=32
46f397a004SAlan Somers
47f397a004SAlan Somers	atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
485dce212dSAlan Somers	atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \
495dce212dSAlan Somers		status=none
50f397a004SAlan Somers	for_each_geli_config_nointegrity init_test
51f397a004SAlan Somers}
52f397a004SAlan Somersinit_cleanup()
53f397a004SAlan Somers{
54f397a004SAlan Somers	geli_test_cleanup
55f92ce022SAlan Somers}
5609d98641SEnji Cooper
57f397a004SAlan Somersatf_test_case init_B cleanup
58f397a004SAlan Somersinit_B_head()
59f397a004SAlan Somers{
60f397a004SAlan Somers	atf_set "descr" "init -B can select an alternate backup metadata file"
61f397a004SAlan Somers	atf_set "require.user" "root"
62f397a004SAlan Somers}
63f397a004SAlan Somersinit_B_body()
64f397a004SAlan Somers{
65cf551b8aSAlan Somers	geli_test_setup
66f92ce022SAlan Somers
67f397a004SAlan Somers	sectors=100
68f397a004SAlan Somers
69f397a004SAlan Somers	atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
70f397a004SAlan Somers
71*96950419SGleb Smirnoff	attach_md md -t malloc -s $sectors
72f397a004SAlan Somers
73f397a004SAlan Somers	# -B none
74f397a004SAlan Somers	rm -f /var/backups/${md}.eli
75f397a004SAlan Somers	atf_check -s exit:0 -o ignore geli init -B none -P -K keyfile ${md}
76f397a004SAlan Somers	if [ -f /var/backups/${md}.eli ]; then
77f397a004SAlan Somers		atf_fail "geli created a backup file even with -B none"
78f397a004SAlan Somers	fi
79f397a004SAlan Somers
80f397a004SAlan Somers	# no -B
81f397a004SAlan Somers	rm -f /var/backups/${md}.eli
82f397a004SAlan Somers	atf_check -s exit:0 -o ignore geli init -P -K keyfile ${md}
83f397a004SAlan Somers	if [ ! -f /var/backups/${md}.eli ]; then
84f397a004SAlan Somers		atf_fail "geli did not create a backup file"
85f397a004SAlan Somers	fi
86f397a004SAlan Somers	atf_check geli clear ${md}
87f397a004SAlan Somers	atf_check -s not-exit:0 -e ignore geli attach -p -k keyfile ${md}
88f397a004SAlan Somers	atf_check -s exit:0 -o ignore geli restore /var/backups/${md}.eli ${md}
89f397a004SAlan Somers	atf_check -s exit:0 -o ignore geli attach -p -k keyfile ${md}
90f397a004SAlan Somers	atf_check geli detach ${md}
91f397a004SAlan Somers	rm -f /var/backups/${md}.eli
92f397a004SAlan Somers
93f397a004SAlan Somers	# -B file
94f397a004SAlan Somers	rm -f backupfile
95f397a004SAlan Somers	atf_check -s exit:0 -o ignore \
96f397a004SAlan Somers		geli init -B backupfile -P -K keyfile ${md}
97f397a004SAlan Somers	if [ ! -f backupfile ]; then
98f397a004SAlan Somers		atf_fail "geli init -B did not create a backup file"
99f397a004SAlan Somers	fi
100f397a004SAlan Somers	atf_check geli clear ${md}
101f397a004SAlan Somers	atf_check -s not-exit:0 -e ignore geli attach -p -k keyfile ${md}
102f397a004SAlan Somers	atf_check geli restore backupfile ${md}
103f397a004SAlan Somers	atf_check geli attach -p -k keyfile ${md}
104f397a004SAlan Somers}
105f397a004SAlan Somersinit_B_cleanup()
106f397a004SAlan Somers{
107f397a004SAlan Somers	geli_test_cleanup
108f397a004SAlan Somers}
109f397a004SAlan Somers
110f397a004SAlan Somersatf_test_case init_J cleanup
111f397a004SAlan Somersinit_J_head()
112f397a004SAlan Somers{
113f397a004SAlan Somers	atf_set "descr" "init -J accepts a passfile"
114f397a004SAlan Somers	atf_set "require.user" "root"
115f397a004SAlan Somers}
116f397a004SAlan Somersinit_J_body()
117f397a004SAlan Somers{
118cf551b8aSAlan Somers	geli_test_setup
119f397a004SAlan Somers
120f397a004SAlan Somers	sectors=100
121*96950419SGleb Smirnoff	attach_md md -t malloc -s `expr $sectors + 1`
122f397a004SAlan Somers
123f397a004SAlan Somers	atf_check dd if=/dev/random of=keyfile0 bs=512 count=16 status=none
124f397a004SAlan Somers	atf_check dd if=/dev/random of=keyfile1 bs=512 count=16 status=none
125f397a004SAlan Somers	dd if=/dev/random bs=512 count=16 status=none | sha1 > passfile0
126f397a004SAlan Somers	atf_check_equal 0 $?
127f397a004SAlan Somers	dd if=/dev/random bs=512 count=16 status=none | sha1 > passfile1
128f397a004SAlan Somers	atf_check_equal 0 $?
129f397a004SAlan Somers
130f397a004SAlan Somers	for iter in -1 0 64; do
131f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
132f397a004SAlan Somers			geli init -i ${iter} -B none -J passfile0 -P ${md}
133f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
134f397a004SAlan Somers			geli init -i ${iter} -B none -J passfile0 -P -K keyfile0 ${md}
135f397a004SAlan Somers		atf_check geli init -i ${iter} -B none -J passfile0 -K keyfile0 ${md}
136f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
137f397a004SAlan Somers			geli attach -k keyfile0 -p ${md}
138f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
139f397a004SAlan Somers			geli attach -j passfile0 ${md}
140f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
141f397a004SAlan Somers			geli attach -j keyfile0 ${md}
142f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
143f397a004SAlan Somers			geli attach -k passfile0 -p ${md}
144f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
145f397a004SAlan Somers			geli attach -j keyfile0 -k passfile0 ${md}
146f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
147f397a004SAlan Somers			geli attach -j keyfile0 -k keyfile0 ${md}
148f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
149f397a004SAlan Somers			geli attach -j passfile0 -k passfile0 ${md}
150f397a004SAlan Somers		atf_check -s exit:0 -e ignore \
151f397a004SAlan Somers			geli attach -j passfile0 -k keyfile0 ${md}
152f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
153f397a004SAlan Somers		atf_check -s exit:0 -e ignore -x \
154f397a004SAlan Somers			"cat keyfile0 | geli attach -j passfile0 -k - ${md}"
155f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
156f397a004SAlan Somers		atf_check -s exit:0 -e ignore -x \
157f397a004SAlan Somers			"cat passfile0 | geli attach -j - -k keyfile0 ${md}"
158f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
159f397a004SAlan Somers
160f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
161f397a004SAlan Somers			geli init -i ${iter} -B none -J passfile0 -J passfile1 -P ${md}
162f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
163f397a004SAlan Somers			geli init -i ${iter} -B none -J passfile0 -J passfile1 -P -K keyfile0 -K keyfile1 ${md}
164f397a004SAlan Somers		atf_check -s exit:0 -e ignore \
165f397a004SAlan Somers			geli init -i ${iter} -B none -J passfile0 -J passfile1 -K keyfile0 -K keyfile1 ${md}
166f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
167f397a004SAlan Somers			geli attach -k keyfile0 -p ${md}
168f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
169f397a004SAlan Somers			geli attach -k keyfile1 -p ${md}
170f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
171f397a004SAlan Somers			geli attach -j passfile0 ${md}
172f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
173f397a004SAlan Somers			geli attach -j passfile1 ${md}
174f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
175f397a004SAlan Somers			geli attach -k keyfile0 -k keyfile1 -p ${md}
176f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
177f397a004SAlan Somers			geli attach -j passfile0 -j passfile1 ${md}
178f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
179f397a004SAlan Somers			geli attach -k keyfile0 -j passfile0 ${md}
180f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
181f397a004SAlan Somers			geli attach -k keyfile0 -j passfile1 ${md}
182f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
183f397a004SAlan Somers			geli attach -k keyfile1 -j passfile0 ${md}
184f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
185f397a004SAlan Somers			geli attach -k keyfile1 -j passfile1 ${md}
186f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
187f397a004SAlan Somers			geli attach -k keyfile0 -j passfile0 -j passfile1 ${md}
188f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
189f397a004SAlan Somers			geli attach -k keyfile1 -j passfile0 -j passfile1 ${md}
190f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
191f397a004SAlan Somers			geli attach -k keyfile0 -k keyfile1 -j passfile0 ${md}
192f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
193f397a004SAlan Somers			geli attach -k keyfile0 -k keyfile1 -j passfile1 ${md}
194f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
195f397a004SAlan Somers			geli attach -k keyfile1 -k keyfile0 -j passfile0 -j passfile1 ${md}
196f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
197f397a004SAlan Somers			geli attach -k keyfile0 -k keyfile1 -j passfile1 -j passfile0 ${md}
198f397a004SAlan Somers		atf_check -s not-exit:0 -e ignore \
199f397a004SAlan Somers			geli attach -k keyfile1 -k keyfile0 -j passfile1 -j passfile0 ${md}
200f397a004SAlan Somers		atf_check -s exit:0 -e ignore \
201f397a004SAlan Somers			geli attach -j passfile0 -j passfile1 -k keyfile0 -k keyfile1 ${md}
202f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
203f397a004SAlan Somers		atf_check -s exit:0 -e ignore -x \
204f397a004SAlan Somers			"cat passfile0 | geli attach -j - -j passfile1 -k keyfile0 -k keyfile1 ${md}"
205f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
206f397a004SAlan Somers		atf_check -s exit:0 -e ignore -x \
207f397a004SAlan Somers			"cat passfile1 | geli attach -j passfile0 -j - -k keyfile0 -k keyfile1 ${md}"
208f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
209f397a004SAlan Somers		atf_check -s exit:0 -e ignore -x \
210f397a004SAlan Somers			"cat keyfile0 | geli attach -j passfile0 -j passfile1 -k - -k keyfile1 ${md}"
211f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
212f397a004SAlan Somers		atf_check -s exit:0 -e ignore -x \
213f397a004SAlan Somers			"cat keyfile1 | geli attach -j passfile0 -j passfile1 -k keyfile0 -k - ${md}"
214f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
215f397a004SAlan Somers		atf_check -s exit:0 -e ignore -x \
216f397a004SAlan Somers			"cat keyfile0 keyfile1 | geli attach -j passfile0 -j passfile1 -k - ${md}"
217f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
218f397a004SAlan Somers		atf_check -s exit:0 -e ignore -x \
219f397a004SAlan Somers			"cat passfile0 passfile1 | awk '{printf \"%s\", \$0}' | geli attach -j - -k keyfile0 -k keyfile1 ${md}"
220f397a004SAlan Somers		atf_check -s exit:0 -e ignore geli detach ${md}
221f397a004SAlan Somers	done
222f397a004SAlan Somers}
223f397a004SAlan Somersinit_J_cleanup()
224f397a004SAlan Somers{
225f397a004SAlan Somers	geli_test_cleanup
226f397a004SAlan Somers}
227f397a004SAlan Somers
228f397a004SAlan Somersinit_a_test()
229f397a004SAlan Somers{
230f397a004SAlan Somers	cipher=$1
231f397a004SAlan Somers	aalgo=$2
232f397a004SAlan Somers	secsize=$3
233f397a004SAlan Somers	ealgo=${cipher%%:*}
234f397a004SAlan Somers	keylen=${cipher##*:}
235f397a004SAlan Somers
2365dce212dSAlan Somers	atf_check -s exit:0 -e ignore \
2375dce212dSAlan Somers		geli init -B none -a $aalgo -e $ealgo -l $keylen -P -K keyfile \
2385dce212dSAlan Somers		-s $secsize ${md}
239f397a004SAlan Somers	atf_check geli attach -p -k keyfile ${md}
240f397a004SAlan Somers
2415dce212dSAlan Somers	atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none
242f397a004SAlan Somers
2435dce212dSAlan Somers	md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5`
244f397a004SAlan Somers	atf_check_equal 0 $?
2455dce212dSAlan Somers	md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5`
246f397a004SAlan Somers	atf_check_equal 0 $?
247f397a004SAlan Somers
248f397a004SAlan Somers	if [ ${md_rnd} != ${md_ddev} ]; then
249f397a004SAlan Somers		atf_fail "Miscompare for aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
250f397a004SAlan Somers	fi
251f397a004SAlan Somers}
252f397a004SAlan Somersatf_test_case init_a cleanup
253f397a004SAlan Somersinit_a_head()
254f397a004SAlan Somers{
255f397a004SAlan Somers	atf_set "descr" "I/O with geli and HMACs"
256f397a004SAlan Somers	atf_set "require.user" "root"
257f397a004SAlan Somers	atf_set "timeout" 3600
258f397a004SAlan Somers}
259f397a004SAlan Somersinit_a_body()
260f397a004SAlan Somers{
261cf551b8aSAlan Somers	geli_test_setup
262f397a004SAlan Somers
263f397a004SAlan Somers	sectors=100
264f397a004SAlan Somers
265f397a004SAlan Somers	atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
2665dce212dSAlan Somers	atf_check dd if=/dev/random of=rnd bs=$MAX_SECSIZE count=${sectors} \
2675dce212dSAlan Somers		status=none
268f397a004SAlan Somers	for_each_geli_config init_a_test
269f397a004SAlan Somers	true
270f397a004SAlan Somers}
271f397a004SAlan Somersinit_a_cleanup()
272f397a004SAlan Somers{
273f397a004SAlan Somers	geli_test_cleanup
274f397a004SAlan Somers}
275f397a004SAlan Somers
276f397a004SAlan Somersinit_alias_test() {
277f397a004SAlan Somers	ealgo=$1
278f397a004SAlan Somers	keylen=$2
279f397a004SAlan Somers	expected_ealgo=$3
280f397a004SAlan Somers	expected_keylen=$4
281f397a004SAlan Somers
282f397a004SAlan Somers	atf_check geli init -B none -e $ealgo -l $keylen -P -K keyfile ${md}
283f397a004SAlan Somers	atf_check geli attach -p -k keyfile ${md}
284f397a004SAlan Somers	real_ealgo=`geli list ${md}.eli | awk '/EncryptionAlgorithm/ {print $2}'`
285f397a004SAlan Somers	real_keylen=`geli list ${md}.eli | awk '/KeyLength/ {print $2}'`
286f397a004SAlan Somers
287f397a004SAlan Somers	if [ "${real_ealgo}" != "${expected_ealgo}" ]; then
288f397a004SAlan Somers		atf_fail "expected ${expected_ealgo} but got ${real_ealgo}"
289f397a004SAlan Somers	fi
290f397a004SAlan Somers
291f397a004SAlan Somers	if [ "${real_keylen}" != "${expected_keylen}" ]; then
292f397a004SAlan Somers		atf_fail "expected ${expected_keylen} but got ${real_keylen}"
293f397a004SAlan Somers	fi
294f397a004SAlan Somers	atf_check geli detach ${md}
295f397a004SAlan Somers}
296f397a004SAlan Somersatf_test_case init_alias cleanup
297f397a004SAlan Somersinit_alias_head()
298f397a004SAlan Somers{
299f397a004SAlan Somers	atf_set "descr" "geli init accepts cipher aliases"
300f397a004SAlan Somers	atf_set "require.user" "root"
301f397a004SAlan Somers}
302f397a004SAlan Somersinit_alias_body()
303f397a004SAlan Somers{
304cf551b8aSAlan Somers	geli_test_setup
305f397a004SAlan Somers
306*96950419SGleb Smirnoff	attach_md md -t malloc -s 1024k
307f397a004SAlan Somers	atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
308f397a004SAlan Somers
309f397a004SAlan Somers	for spec in aes:0:AES-XTS:128 aes:128:AES-XTS:128 aes:256:AES-XTS:256 \
310f397a004SAlan Somers		camellia:0:CAMELLIA-CBC:128 camellia:128:CAMELLIA-CBC:128 \
311f397a004SAlan Somers		camellia:256:CAMELLIA-CBC:256 ; do
312f397a004SAlan Somers
313f397a004SAlan Somers		ealgo=`echo $spec | cut -d : -f 1`
314f397a004SAlan Somers		keylen=`echo $spec | cut -d : -f 2`
315f397a004SAlan Somers		expected_ealgo=`echo $spec | cut -d : -f 3`
316f397a004SAlan Somers		expected_keylen=`echo $spec | cut -d : -f 4`
317f397a004SAlan Somers
318f397a004SAlan Somers		init_alias_test $ealgo $keylen $expected_ealgo $expected_keylen
319f397a004SAlan Somers	done
320f397a004SAlan Somers}
321f397a004SAlan Somersinit_alias_cleanup()
322f397a004SAlan Somers{
323f397a004SAlan Somers	geli_test_cleanup
324f397a004SAlan Somers}
325f397a004SAlan Somers
326f397a004SAlan Somersatf_test_case init_i_P cleanup
327f397a004SAlan Somersinit_i_P_head()
328f397a004SAlan Somers{
329f397a004SAlan Somers	atf_set "descr" "geli: Options -i and -P are mutually exclusive"
330f397a004SAlan Somers	atf_set "require.user" "root"
331f397a004SAlan Somers}
332f397a004SAlan Somersinit_i_P_body()
333f397a004SAlan Somers{
334cf551b8aSAlan Somers	geli_test_setup
335f397a004SAlan Somers
336f397a004SAlan Somers	sectors=100
337*96950419SGleb Smirnoff	attach_md md -t malloc -s `expr $sectors + 1`
338f397a004SAlan Somers
339f397a004SAlan Somers	atf_check dd if=/dev/random of=keyfile bs=512 count=16 status=none
340f397a004SAlan Somers
3415dce212dSAlan Somers	atf_check -s not-exit:0 -e "match:Options -i and -P are mutually exclusive"\
342f397a004SAlan Somers		geli init -B none -i 64 -P -K keyfile $md
343f397a004SAlan Somers}
344f397a004SAlan Somersinit_i_P_cleanup()
345f397a004SAlan Somers{
346f397a004SAlan Somers	geli_test_cleanup
347f397a004SAlan Somers}
348f397a004SAlan Somers
349565a0a2cSAlan Somersatf_test_case nokey cleanup
350565a0a2cSAlan Somersnokey_head()
351565a0a2cSAlan Somers{
352565a0a2cSAlan Somers	atf_set "descr" "geli init fails if called with no key component"
353565a0a2cSAlan Somers	atf_set "require.user" "root"
354565a0a2cSAlan Somers}
355565a0a2cSAlan Somersnokey_body()
356565a0a2cSAlan Somers{
357cf551b8aSAlan Somers	geli_test_setup
358565a0a2cSAlan Somers
359565a0a2cSAlan Somers	sectors=100
360*96950419SGleb Smirnoff	attach_md md -t malloc -s `expr $sectors + 1`
361565a0a2cSAlan Somers
362565a0a2cSAlan Somers	atf_check -s not-exit:0 -e match:"No key components given" \
363565a0a2cSAlan Somers		geli init -B none -P ${md}
364565a0a2cSAlan Somers}
365565a0a2cSAlan Somersnokey_cleanup()
366565a0a2cSAlan Somers{
367565a0a2cSAlan Somers	geli_test_cleanup
368565a0a2cSAlan Somers}
369565a0a2cSAlan Somers
370f397a004SAlan Somersatf_init_test_cases()
371f397a004SAlan Somers{
372f397a004SAlan Somers	atf_add_test_case init
373f397a004SAlan Somers	atf_add_test_case init_B
374f397a004SAlan Somers	atf_add_test_case init_J
375f397a004SAlan Somers	atf_add_test_case init_a
376f397a004SAlan Somers	atf_add_test_case init_alias
377f397a004SAlan Somers	atf_add_test_case init_i_P
378565a0a2cSAlan Somers	atf_add_test_case nokey
379f397a004SAlan Somers}
380