1#!/bin/sh 2# $FreeBSD$ 3 4. $(dirname $0)/conf.sh 5 6base=`basename $0` 7sectors=32 8keyfile=`mktemp $base.XXXXXX` || exit 1 9rnd=`mktemp $base.XXXXXX` || exit 1 10 11echo "1..200" 12 13do_test() { 14 cipher=$1 15 secsize=$2 16 ealgo=${cipher%%:*} 17 keylen=${cipher##*:} 18 19 mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1 20 21 geli init -B none -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null 22 geli attach -p -k $keyfile md${no} 23 24 secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'` 25 26 dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1 27 dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null 28 29 md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5` 30 md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5` 31 md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5` 32 33 if [ ${md_rnd} = ${md_ddev} ]; then 34 echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" 35 else 36 echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" 37 fi 38 i=$((i+1)) 39 if [ ${md_rnd} != ${md_edev} ]; then 40 echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" 41 else 42 echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}" 43 fi 44 i=$((i+1)) 45 46 geli detach md${no} 47 mdconfig -d -u $no 48} 49 50i=1 51dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1 52for_each_geli_config_nointegrity do_test 53 54rm -f $rnd 55rm -f $keyfile 56