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