diff options
author | Alan Somers <asomers@FreeBSD.org> | 2020-07-21 19:18:29 +0000 |
---|---|---|
committer | Alan Somers <asomers@FreeBSD.org> | 2020-07-21 19:18:29 +0000 |
commit | aafaa8b79491b563c628ebe3a4eadb151683ca45 (patch) | |
tree | 3fcd8dcc6612a691689d1f04d81e244b3a6588a4 /tests | |
parent | 716df522b8792692e99f767cef9a4b5e21961b8f (diff) | |
download | src-test-aafaa8b79491b563c628ebe3a4eadb151683ca45.tar.gz src-test-aafaa8b79491b563c628ebe3a4eadb151683ca45.zip |
Fix geli's null cipher, and add a test case
PR: 247954
Submitted by: jhb (sys), asomers (tests)
Reviewed by: jhb (tests), asomers (sys)
MFC after: 2 weeks
Sponsored by: Axcient
Notes
Notes:
svn path=/head/; revision=363402
Diffstat (limited to 'tests')
-rw-r--r-- | tests/sys/geom/class/eli/onetime_test.sh | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/sys/geom/class/eli/onetime_test.sh b/tests/sys/geom/class/eli/onetime_test.sh index 65939db5761c4..479d4d771877c 100644 --- a/tests/sys/geom/class/eli/onetime_test.sh +++ b/tests/sys/geom/class/eli/onetime_test.sh @@ -130,9 +130,54 @@ onetime_d_cleanup() geli_test_cleanup } +atf_test_case onetime cleanup +onetime_null_head() +{ + atf_set "descr" "geli onetime can use the null cipher" + atf_set "require.user" "root" +} +onetime_null_body() +{ + geli_test_setup + + sectors=100 + + dd if=/dev/random of=rnd bs=${MAX_SECSIZE} count=${sectors} status=none + + secsize=512 + ealgo=${cipher%%:*} + keylen=${cipher##*:} + + md=$(attach_md -t malloc -s 100k) + + atf_check -s exit:0 -o ignore -e ignore \ + geli onetime -e null -s ${secsize} ${md} + + atf_check dd if=rnd of=/dev/${md}.eli bs=${secsize} count=${sectors} status=none + + md_rnd=`dd if=rnd bs=${secsize} count=${sectors} status=none | md5` + atf_check_equal 0 $? + md_ddev=`dd if=/dev/${md}.eli bs=${secsize} count=${sectors} status=none | md5` + atf_check_equal 0 $? + md_edev=`dd if=/dev/${md} bs=${secsize} count=${sectors} status=none | md5` + atf_check_equal 0 $? + + if [ ${md_rnd} != ${md_ddev} ]; then + atf_fail "geli did not return the original data" + fi + if [ ${md_rnd} != ${md_edev} ]; then + atf_fail "geli encrypted the data even with the null cipher" + fi +} +onetime_null_cleanup() +{ + geli_test_cleanup +} + atf_init_test_cases() { atf_add_test_case onetime atf_add_test_case onetime_a atf_add_test_case onetime_d + atf_add_test_case onetime_null } |