1213173Spjd#!/bin/sh 2213173Spjd# $FreeBSD$ 3213173Spjd 4293436Sngie. $(dirname $0)/conf.sh 5293436Sngie 6213173Spjdbase=`basename $0` 7213173Spjdsectors=100 8293436Sngiekeyfile0=`mktemp $base.XXXXXX` || exit 1 9293436Sngiekeyfile1=`mktemp $base.XXXXXX` || exit 1 10293436Sngiepassfile0=`mktemp $base.XXXXXX` || exit 1 11293436Sngiepassfile1=`mktemp $base.XXXXXX` || exit 1 12213173Spjdmdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1 13213173Spjd 14213173Spjdecho "1..150" 15213173Spjd 16213173Spjddd if=/dev/random of=${keyfile0} bs=512 count=16 >/dev/null 2>&1 17213173Spjddd if=/dev/random of=${keyfile1} bs=512 count=16 >/dev/null 2>&1 18213173Spjddd if=/dev/random bs=512 count=16 2>/dev/null | sha1 > ${passfile0} 19213173Spjddd if=/dev/random bs=512 count=16 2>/dev/null | sha1 > ${passfile1} 20213173Spjd 21213173Spjdi=1 22213173Spjdfor iter in -1 0 64; do 23213173Spjd geli init -i ${iter} -B none -J ${passfile0} -P md${no} 2>/dev/null && echo -n "not " 24213173Spjd echo "ok ${i}"; i=$((i+1)) 25213173Spjd geli init -i ${iter} -B none -J ${passfile0} -P -K ${keyfile0} md${no} 2>/dev/null && echo -n "not " 26213173Spjd echo "ok ${i}"; i=$((i+1)) 27213173Spjd geli init -i ${iter} -B none -J ${passfile0} -K ${keyfile0} md${no} 2>/dev/null || echo -n "not " 28213173Spjd echo "ok ${i}"; i=$((i+1)) 29213173Spjd geli attach -k ${keyfile0} -p md${no} 2>/dev/null && echo -n "not " 30213173Spjd echo "ok ${i}"; i=$((i+1)) 31213173Spjd geli attach -j ${passfile0} md${no} 2>/dev/null && echo -n "not " 32213173Spjd echo "ok ${i}"; i=$((i+1)) 33213173Spjd geli attach -j ${keyfile0} md${no} 2>/dev/null && echo -n "not " 34213173Spjd echo "ok ${i}"; i=$((i+1)) 35213173Spjd geli attach -k ${passfile0} -p md${no} 2>/dev/null && echo -n "not " 36213173Spjd echo "ok ${i}"; i=$((i+1)) 37213173Spjd geli attach -j ${keyfile0} -k ${passfile0} md${no} 2>/dev/null && echo -n "not " 38213173Spjd echo "ok ${i}"; i=$((i+1)) 39213173Spjd geli attach -j ${keyfile0} -k ${keyfile0} md${no} 2>/dev/null && echo -n "not " 40213173Spjd echo "ok ${i}"; i=$((i+1)) 41213173Spjd geli attach -j ${passfile0} -k ${passfile0} md${no} 2>/dev/null && echo -n "not " 42213173Spjd echo "ok ${i}"; i=$((i+1)) 43213173Spjd geli attach -j ${passfile0} -k ${keyfile0} md${no} 2>/dev/null || echo -n "not " 44213173Spjd echo "ok ${i}"; i=$((i+1)) 45213173Spjd geli detach md${no} || echo -n "not " 46213173Spjd echo "ok ${i}"; i=$((i+1)) 47213173Spjd cat ${keyfile0} | geli attach -j ${passfile0} -k - md${no} 2>/dev/null || echo -n "not " 48213173Spjd echo "ok ${i}"; i=$((i+1)) 49213173Spjd geli detach md${no} || echo -n "not " 50213173Spjd echo "ok ${i}"; i=$((i+1)) 51213173Spjd cat ${passfile0} | geli attach -j - -k ${keyfile0} md${no} 2>/dev/null || echo -n "not " 52213173Spjd echo "ok ${i}"; i=$((i+1)) 53213173Spjd geli detach md${no} || echo -n "not " 54213173Spjd echo "ok ${i}"; i=$((i+1)) 55213173Spjd 56213173Spjd geli init -i ${iter} -B none -J ${passfile0} -J ${passfile1} -P md${no} 2>/dev/null && echo -n "not " 57213173Spjd echo "ok ${i}"; i=$((i+1)) 58213173Spjd geli init -i ${iter} -B none -J ${passfile0} -J ${passfile1} -P -K ${keyfile0} -K ${keyfile1} md${no} 2>/dev/null && echo -n "not " 59213173Spjd echo "ok ${i}"; i=$((i+1)) 60213173Spjd geli init -i ${iter} -B none -J ${passfile0} -J ${passfile1} -K ${keyfile0} -K ${keyfile1} md${no} 2>/dev/null || echo -n "not " 61213173Spjd echo "ok ${i}"; i=$((i+1)) 62213173Spjd geli attach -k ${keyfile0} -p md${no} 2>/dev/null && echo -n "not " 63213173Spjd echo "ok ${i}"; i=$((i+1)) 64213173Spjd geli attach -k ${keyfile1} -p md${no} 2>/dev/null && echo -n "not " 65213173Spjd echo "ok ${i}"; i=$((i+1)) 66213173Spjd geli attach -j ${passfile0} md${no} 2>/dev/null && echo -n "not " 67213173Spjd echo "ok ${i}"; i=$((i+1)) 68213173Spjd geli attach -j ${passfile1} md${no} 2>/dev/null && echo -n "not " 69213173Spjd echo "ok ${i}"; i=$((i+1)) 70213173Spjd geli attach -k ${keyfile0} -k ${keyfile1} -p md${no} 2>/dev/null && echo -n "not " 71213173Spjd echo "ok ${i}"; i=$((i+1)) 72213173Spjd geli attach -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " 73213173Spjd echo "ok ${i}"; i=$((i+1)) 74213173Spjd geli attach -k ${keyfile0} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " 75213173Spjd echo "ok ${i}"; i=$((i+1)) 76213173Spjd geli attach -k ${keyfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " 77213173Spjd echo "ok ${i}"; i=$((i+1)) 78213173Spjd geli attach -k ${keyfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " 79213173Spjd echo "ok ${i}"; i=$((i+1)) 80213173Spjd geli attach -k ${keyfile1} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " 81213173Spjd echo "ok ${i}"; i=$((i+1)) 82213173Spjd geli attach -k ${keyfile0} -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " 83213173Spjd echo "ok ${i}"; i=$((i+1)) 84213173Spjd geli attach -k ${keyfile1} -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " 85213173Spjd echo "ok ${i}"; i=$((i+1)) 86213173Spjd geli attach -k ${keyfile0} -k ${keyfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " 87213173Spjd echo "ok ${i}"; i=$((i+1)) 88213173Spjd geli attach -k ${keyfile0} -k ${keyfile1} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " 89213173Spjd echo "ok ${i}"; i=$((i+1)) 90213173Spjd geli attach -k ${keyfile1} -k ${keyfile0} -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not " 91213173Spjd echo "ok ${i}"; i=$((i+1)) 92213173Spjd geli attach -k ${keyfile0} -k ${keyfile1} -j ${passfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " 93213173Spjd echo "ok ${i}"; i=$((i+1)) 94213173Spjd geli attach -k ${keyfile1} -k ${keyfile0} -j ${passfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not " 95213173Spjd echo "ok ${i}"; i=$((i+1)) 96213173Spjd geli attach -j ${passfile0} -j ${passfile1} -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " 97213173Spjd echo "ok ${i}"; i=$((i+1)) 98213173Spjd geli detach md${no} || echo -n "not " 99213173Spjd echo "ok ${i}"; i=$((i+1)) 100213173Spjd cat ${passfile0} | geli attach -j - -j ${passfile1} -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " 101213173Spjd echo "ok ${i}"; i=$((i+1)) 102213173Spjd geli detach md${no} || echo -n "not " 103213173Spjd echo "ok ${i}"; i=$((i+1)) 104213173Spjd cat ${passfile1} | geli attach -j ${passfile0} -j - -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " 105213173Spjd echo "ok ${i}"; i=$((i+1)) 106213173Spjd geli detach md${no} || echo -n "not " 107213173Spjd echo "ok ${i}"; i=$((i+1)) 108213173Spjd cat ${keyfile0} | geli attach -j ${passfile0} -j ${passfile1} -k - -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " 109213173Spjd echo "ok ${i}"; i=$((i+1)) 110213173Spjd geli detach md${no} || echo -n "not " 111213173Spjd echo "ok ${i}"; i=$((i+1)) 112213173Spjd cat ${keyfile1} | geli attach -j ${passfile0} -j ${passfile1} -k ${keyfile0} -k - md${no} 2>/dev/null || echo -n "not " 113213173Spjd echo "ok ${i}"; i=$((i+1)) 114213173Spjd geli detach md${no} || echo -n "not " 115213173Spjd echo "ok ${i}"; i=$((i+1)) 116213173Spjd cat ${keyfile0} ${keyfile1} | geli attach -j ${passfile0} -j ${passfile1} -k - md${no} 2>/dev/null || echo -n "not " 117213173Spjd echo "ok ${i}"; i=$((i+1)) 118213173Spjd geli detach md${no} || echo -n "not " 119213173Spjd echo "ok ${i}"; i=$((i+1)) 120213173Spjd cat ${passfile0} ${passfile1} | awk '{printf "%s", $0}' | geli attach -j - -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not " 121213173Spjd echo "ok ${i}"; i=$((i+1)) 122213173Spjd geli detach md${no} || echo -n "not " 123213173Spjd echo "ok ${i}"; i=$((i+1)) 124213173Spjddone 125213173Spjd 126213173Spjdrm -f ${keyfile0} ${keyfile1} ${passfile0} ${passfile1} 127