Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- tools/regression/geom_eli/attach-d-H.t.orig 2013-06-02 19:42:49.990933533 +0300
- +++ tools/regression/geom_eli/attach-d-H.t 2013-06-02 15:00:57.014966277 +0300
- @@ -0,0 +1,43 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +
- +echo 1..3
- +
- +i=1
- +
- +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- +geli init -B none -H $hd -P -K $keyfile md${no}
- +geli attach -d -H $hd -p -k $keyfile md${no}
- +
- +if [ -c /dev/md${no}.eli ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +dd if=/dev/md${no}.eli of=/dev/null 2>/dev/null
- +sleep 1
- +if [ -c /dev/md${no}.eli ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +true > /dev/md${no}.eli
- +sleep 1
- +if [ ! -c /dev/md${no}.eli ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +
- +mdconfig -d -u $no
- +rm -f $keyfile $hd
- --- tools/regression/geom_eli/configure-b-B-H.t.orig 2013-06-02 19:42:58.969753606 +0300
- +++ tools/regression/geom_eli/configure-b-B-H.t 2013-06-02 15:01:02.820704156 +0300
- @@ -0,0 +1,65 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +
- +echo 1..17
- +
- +i=1
- +
- +geli init -H $hd -B none -P -K /dev/null md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli dump -H $hd md${no} | egrep 'flags: 0x0$' >/dev/null || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli init -B none -H $hd -b -P -K /dev/null md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli dump -H $hd md${no} | egrep 'flags: 0x2$' >/dev/null || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli configure -B -H $hd md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli dump -H $hd md${no} | egrep 'flags: 0x0$' >/dev/null || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli configure -b -H $hd md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli dump -H $hd md${no} | egrep 'flags: 0x2$' >/dev/null || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli attach -H $hd -p -k /dev/null md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli list md${no}.eli | egrep '^Flags: .*BOOT' >/dev/null || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli configure -B -H $hd md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli list md${no}.eli | egrep '^Flags: .*BOOT' >/dev/null && echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli dump -H $hd md${no} | egrep 'flags: 0x0$' >/dev/null || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli configure -b -H $hd md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli list md${no}.eli | egrep '^Flags: .*BOOT' >/dev/null || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli dump -H $hd md${no} | egrep 'flags: 0x2$' >/dev/null || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli detach md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +mdconfig -d -u $no
- +rm -f $hd
- --- tools/regression/geom_eli/delkey-H.t.orig 2013-06-02 19:43:06.736921082 +0300
- +++ tools/regression/geom_eli/delkey-H.t 2013-06-02 15:01:08.811465551 +0300
- @@ -0,0 +1,99 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile2=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile3=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile4=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +
- +echo 1..14
- +
- +i=1
- +
- +dd if=/dev/random of=${keyfile1} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random of=${keyfile2} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random of=${keyfile3} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random of=${keyfile4} bs=512 count=16 >/dev/null 2>&1
- +
- +geli init -B none -H $hd -P -K $keyfile1 md${no}
- +geli attach -H $hd -p -k $keyfile1 md${no}
- +geli setkey -H $hd -n 1 -P -K $keyfile2 md${no} 1>/dev/null
- +
- +# Remove key 0 for attached provider.
- +geli delkey -H $hd -n 0 md${no} || echo -n "not "
- +echo ok $i - "Remove key 0 for attached provider"
- +geli detach md${no}
- +i=$((i + 1))
- +
- +# We cannot use keyfile1 anymore.
- +geli attach -H $hd -p -k $keyfile1 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i - "We cannot use keyfile anymore"
- +i=$((i + 1))
- +
- +# Attach with key 1.
- +geli attach -H $hd -p -k $keyfile2 md${no} || echo -n "not "
- +echo ok $i - "Attach with key 1"
- +i=$((i + 1))
- +
- +# We cannot remove last key without -f option (for attached provider).
- +geli delkey -H $hd -n 1 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i - "We cannot remove last key without -f option (for attached provider)"
- +i=$((i + 1))
- +
- +# Remove last key for attached provider.
- +geli delkey -H $hd -f -n 1 md${no} || echo -n "not "
- +echo ok $i - "Remove last key for attached provider"
- +i=$((i + 1))
- +
- +# If there are no valid keys, but provider is attached, we can save situation.
- +geli setkey -H $hd -n 0 -P -K $keyfile3 md${no} 1>/dev/null || echo -n "not "
- +echo ok $i - "If there are no valid keys, but provider is attached, we can save situation"
- +geli detach md${no}
- +i=$((i + 1))
- +
- +# We cannot use keyfile2 anymore.
- +geli attach -H $hd -p -k $keyfile2 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i - "We cannot use keyfile2 anymore"
- +i=$((i + 1))
- +
- +# Attach with key 0.
- +geli attach -H $hd -p -k $keyfile3 md${no} || echo -n "not "
- +echo ok $i - "Attach with key 0"
- +i=$((i + 1))
- +
- +# Setup key 1.
- +geli setkey -H $hd -n 1 -P -K $keyfile4 md${no} 1>/dev/null || echo -n "not "
- +echo ok $i - "Setup key 1"
- +geli detach md${no}
- +i=$((i + 1))
- +
- +# Remove key 1 for detached provider.
- +geli delkey -H $hd -n 1 md${no} || echo -n "not "
- +echo ok $i - "Remove key 1 for detached provider"
- +i=$((i + 1))
- +
- +# We cannot use keyfile4 anymore.
- +geli attach -H $hd -p -k $keyfile4 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i - "We cannot use keyfile4 anymore"
- +i=$((i + 1))
- +
- +# We cannot remove last key without -f option (for detached provider).
- +geli delkey -H $hd -n 0 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i - "We cannot remove last key without -f option (for detached provider)"
- +i=$((i + 1))
- +
- +# Remove last key for detached provider.
- +geli delkey -H $hd -f -n 0 md${no} || echo -n "not "
- +echo ok $i - "Remove last key for detached provider"
- +i=$((i + 1))
- +
- +# We cannot use keyfile3 anymore.
- +geli attach -H $hd -p -k $keyfile3 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i - "We cannot use keyfile3 anymore"
- +
- +mdconfig -d -u $no
- +rm -f $keyfile1 $keyfile2 $keyfile3 $keyfile4 $hd
- --- tools/regression/geom_eli/detach-l-H.t.orig 2013-06-02 19:43:20.795044949 +0300
- +++ tools/regression/geom_eli/detach-l-H.t 2013-06-02 15:01:14.852233302 +0300
- @@ -0,0 +1,52 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +
- +echo 1..4
- +
- +i=1
- +
- +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- +geli init -B none -H $hd -P -K $keyfile md${no}
- +geli attach -H $hd -p -k $keyfile md${no}
- +if [ -c /dev/md${no}.eli ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +dd if=/dev/md${no}.eli of=/dev/null 2>/dev/null
- +sleep 1
- +if [ -c /dev/md${no}.eli ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +geli detach -l md${no}
- +if [ -c /dev/md${no}.eli ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +dd if=/dev/md${no}.eli of=/dev/null 2>/dev/null
- +sleep 1
- +if [ ! -c /dev/md${no}.eli ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +mdconfig -d -u $no
- +rm -f $keyfile $hd
- --- tools/regression/geom_eli/init-B-H.t.orig 2013-06-02 19:43:28.315191155 +0300
- +++ tools/regression/geom_eli/init-B-H.t 2013-06-02 15:06:22.584344471 +0300
- @@ -0,0 +1,125 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +backupfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s $sectors -u $no || exit 1
- +
- +echo 1..13
- +
- +i=1
- +
- +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- +rm -f /var/backups/md${no}.eli
- +geli init -B none -H $hd -P -K $keyfile md${no} 2>/dev/null
- +if [ ! -f /var/backups/md${no}.eli ]; then
- + echo "ok $i - -B none"
- +else
- + echo "not ok $i - -B none"
- +fi
- +i=$((i + 1))
- +
- +rm -f /var/backups/md${no}.eli
- +geli init -H $hd -P -K $keyfile md${no} >/dev/null 2>&1
- +if [ -f /var/backups/md${no}.eli ]; then
- + echo "ok $i - no -B"
- +else
- + echo "not ok $i - no -B"
- +fi
- +i=$((i + 1))
- +
- +geli attach -p -k $keyfile md${no} 2>/dev/null
- +if [ $? -ne 0 ]; then
- + echo "ok $i - no -B"
- +else
- + echo "not ok $i - no -B"
- +fi
- +i=$((i + 1))
- +
- +if [ ! -c /dev/md${no}.eli ]; then
- + echo "ok $i - no -B"
- +else
- + echo "not ok $i - no -B"
- +fi
- +i=$((i + 1))
- +
- +geli restore $hd md${no}
- +if [ $? -eq 0 ]; then
- + echo "ok $i - no -B"
- +else
- + echo "not ok $i - no -B"
- +fi
- +i=$((i + 1))
- +
- +geli attach -p -k $keyfile md${no} 2>/dev/null
- +if [ $? -eq 0 ]; then
- + echo "ok $i - no -B"
- +else
- + echo "not ok $i - no -B"
- +fi
- +i=$((i + 1))
- +
- +if [ -c /dev/md${no}.eli ]; then
- + echo "ok $i - no -B"
- +else
- + echo "not ok $i - no -B"
- +fi
- +i=$((i + 1))
- +geli detach md${no}
- +
- +rm -f $backupfile
- +geli init -B $backupfile -H $hd -P -K $keyfile md${no} >/dev/null 2>&1
- +if [ -f $backupfile ]; then
- + echo "ok $i - -B file"
- +else
- + echo "not ok $i - -B file"
- +fi
- +i=$((i + 1))
- +geli clear md${no}
- +
- +geli attach -p -k $keyfile md${no} 2>/dev/null
- +if [ $? -ne 0 ]; then
- + echo "ok $i - -B file"
- +else
- + echo "not ok $i - -B file"
- +fi
- +i=$((i + 1))
- +
- +if [ ! -c /dev/md${no}.eli ]; then
- + echo "ok $i - -B file"
- +else
- + echo "not ok $i - -B file"
- +fi
- +i=$((i + 1))
- +
- +geli restore $hd md${no}
- +if [ $? -eq 0 ]; then
- + echo "ok $i - -B file"
- +else
- + echo "not ok $i - -B file"
- +fi
- +i=$((i + 1))
- +
- +geli attach -p -k $keyfile md${no} 2>/dev/null
- +if [ $? -eq 0 ]; then
- + echo "ok $i - -B file"
- +else
- + echo "not ok $i - -B file"
- +fi
- +i=$((i + 1))
- +
- +if [ -c /dev/md${no}.eli ]; then
- + echo "ok $i - -B file"
- +else
- + echo "not ok $i - -B file"
- +fi
- +i=$((i + 1))
- +geli detach md${no}
- +rm -f $backupfile
- +
- +mdconfig -d -u $no
- +rm -f $keyfile $hd
- --- tools/regression/geom_eli/init-H.t.orig 2013-06-02 19:43:36.111589789 +0300
- +++ tools/regression/geom_eli/init-H.t 2013-06-02 15:01:27.777876084 +0300
- @@ -0,0 +1,65 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- +echo 1..460
- +
- +i=1
- +
- +for cipher in aes:0 aes:128 aes:256 \
- + aes-xts:0 aes-xts:128 aes-xts:256 \
- + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \
- + 3des:0 3des:192 \
- + 3des-cbc:0 3des-cbc:192 \
- + blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
- + blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
- + blowfish:416 blowfish:448 \
- + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \
- + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \
- + blowfish-cbc:416 blowfish-cbc:448 \
- + camellia:0 camellia:128 camellia:192 camellia:256 \
- + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
- + ealgo=${cipher%%:*}
- + keylen=${cipher##*:}
- + for secsize in 512 1024 2048 4096 8192; do
- + hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- + rnd=`mktemp /tmp/$base.XXXXXX` || exit 1
- + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1
- +
- + dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- + geli init -B none -H $hd -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null
- + geli attach -H $hd -p -k $keyfile md${no}
- +
- + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'`
- +
- + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1
- + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null
- +
- + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5`
- + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5`
- + md_edev=`dd if=/dev/md${no} bs=${secsize} count=${secs} 2>/dev/null | md5`
- +
- + if [ ${md_rnd} = ${md_ddev} ]; then
- + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- + if [ ${md_rnd} != ${md_edev} ]; then
- + echo "ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + geli detach md${no}
- + rm -f $rnd $hd
- + mdconfig -d -u $no
- + done
- +done
- +
- +rm -f $keyfile
- --- tools/regression/geom_eli/init-J-H.t.orig 2013-06-02 19:43:45.135958250 +0300
- +++ tools/regression/geom_eli/init-J-H.t 2013-06-02 15:01:34.633747430 +0300
- @@ -0,0 +1,126 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile0=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
- +passfile0=`mktemp /tmp/$base.XXXXXX` || exit 1
- +passfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +
- +echo 1..150
- +
- +dd if=/dev/random of=${keyfile0} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random of=${keyfile1} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random bs=512 count=16 2>/dev/null | sha1 > ${passfile0}
- +dd if=/dev/random bs=512 count=16 2>/dev/null | sha1 > ${passfile1}
- +
- +i=1
- +for iter in -1 0 64; do
- + geli init -H $hd -i ${iter} -B none -J ${passfile0} -P md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli init -H $hd -i ${iter} -B none -J ${passfile0} -P -K ${keyfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli init -H $hd -i ${iter} -B none -J ${passfile0} -K ${keyfile0} md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile0} -p md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${passfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${keyfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${passfile0} -p md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${keyfile0} -k ${passfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${keyfile0} -k ${keyfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${passfile0} -k ${passfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${passfile0} -k ${keyfile0} md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + cat ${keyfile0} | geli attach -H $hd -j ${passfile0} -k - md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + cat ${passfile0} | geli attach -H $hd -j - -k ${keyfile0} md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- +
- + geli init -H $hd -i ${iter} -B none -J ${passfile0} -J ${passfile1} -P md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli init -H $hd -i ${iter} -B none -J ${passfile0} -J ${passfile1} -P -K ${keyfile0} -K ${keyfile1} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli init -H $hd -i ${iter} -B none -J ${passfile0} -J ${passfile1} -K ${keyfile0} -K ${keyfile1} md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile0} -p md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile1} -p md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${passfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${passfile1} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile0} -k ${keyfile1} -p md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile0} -j ${passfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile1} -j ${passfile1} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile0} -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile1} -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile0} -k ${keyfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile0} -k ${keyfile1} -j ${passfile1} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile1} -k ${keyfile0} -j ${passfile0} -j ${passfile1} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile0} -k ${keyfile1} -j ${passfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -k ${keyfile1} -k ${keyfile0} -j ${passfile1} -j ${passfile0} md${no} 2>/dev/null && echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli attach -H $hd -j ${passfile0} -j ${passfile1} -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + cat ${passfile0} | geli attach -H $hd -j - -j ${passfile1} -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + cat ${passfile1} | geli attach -H $hd -j ${passfile0} -j - -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + cat ${keyfile0} | geli attach -H $hd -j ${passfile0} -j ${passfile1} -k - -k ${keyfile1} md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + cat ${keyfile1} | geli attach -H $hd -j ${passfile0} -j ${passfile1} -k ${keyfile0} -k - md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + cat ${keyfile0} ${keyfile1} | geli attach -H $hd -j ${passfile0} -j ${passfile1} -k - md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + cat ${passfile0} ${passfile1} | awk '{printf "%s", $0}' | geli attach -H $hd -j - -k ${keyfile0} -k ${keyfile1} md${no} 2>/dev/null || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- + geli detach md${no} || echo -n "not "
- + echo "ok ${i}"; i=$((i+1))
- +done
- +
- +mdconfig -d -u $no
- +rm -f ${keyfile0} ${keyfile1} ${passfile0} ${passfile1} $hd
- --- tools/regression/geom_eli/init-a-H.t.orig 2013-06-02 19:43:52.456513585 +0300
- +++ tools/regression/geom_eli/init-a-H.t 2013-06-02 15:01:41.133573525 +0300
- @@ -0,0 +1,60 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- +echo 1..1380
- +
- +i=1
- +
- +for cipher in aes:0 aes:128 aes:256 \
- + aes-xts:0 aes-xts:128 aes-xts:256 \
- + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \
- + 3des:0 3des:192 \
- + 3des-cbc:0 3des-cbc:192 \
- + blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
- + blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
- + blowfish:416 blowfish:448 \
- + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \
- + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \
- + blowfish-cbc:416 blowfish-cbc:448 \
- + camellia:0 camellia:128 camellia:192 camellia:256 \
- + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
- + ealgo=${cipher%%:*}
- + keylen=${cipher##*:}
- + for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do
- + for secsize in 512 1024 2048 4096 8192; do
- + rnd=`mktemp /tmp/$base.XXXXXX` || exit 1
- + mdconfig -a -t malloc -s `expr $secsize \* $sectors + 512`b -u $no || exit 1
- +
- + dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- + geli init -B none -H $hd -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null
- + geli attach -H $hd -p -k $keyfile md${no}
- +
- + secs=`diskinfo /dev/md${no}.eli | awk '{print $4}'`
- +
- + dd if=/dev/random of=${rnd} bs=${secsize} count=${secs} >/dev/null 2>&1
- + dd if=${rnd} of=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null
- +
- + md_rnd=`dd if=${rnd} bs=${secsize} count=${secs} 2>/dev/null | md5`
- + md_ddev=`dd if=/dev/md${no}.eli bs=${secsize} count=${secs} 2>/dev/null | md5`
- +
- + if [ ${md_rnd} = ${md_ddev} ]; then
- + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + geli detach md${no}
- + rm -f $rnd
- + mdconfig -d -u $no
- + done
- + done
- +done
- +
- +rm -f $keyfile $hd
- --- tools/regression/geom_eli/init-i-P-H.t.orig 2013-06-02 19:44:00.977279982 +0300
- +++ tools/regression/geom_eli/init-i-P-H.t 2013-06-02 15:01:46.547261577 +0300
- @@ -0,0 +1,25 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- +echo 1..1
- +
- +i=1
- +
- +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- +geli init -B none -H $hd -i 64 -P -K ${keyfile} md${no} 2>/dev/null
- +if [ $? -ne 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +mdconfig -d -u $no
- +rm -f $keyfile $hd
- --- tools/regression/geom_eli/integrity-copy-H.t.orig 2013-06-02 19:44:09.314457542 +0300
- +++ tools/regression/geom_eli/integrity-copy-H.t 2013-06-02 15:01:54.075218341 +0300
- @@ -0,0 +1,100 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +sector=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- +echo 1..5520
- +
- +i=1
- +
- +for cipher in aes:0 aes:128 aes:256 \
- + aes-xts:0 aes-xts:128 aes-xts:256 \
- + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \
- + 3des:0 3des:192 \
- + 3des-cbc:0 3des-cbc:192 \
- + blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
- + blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
- + blowfish:416 blowfish:448 \
- + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \
- + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \
- + blowfish-cbc:416 blowfish-cbc:448 \
- + camellia:0 camellia:128 camellia:192 camellia:256 \
- + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
- + ealgo=${cipher%%:*}
- + keylen=${cipher##*:}
- + for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do
- + for secsize in 512 1024 2048 4096 8192; do
- + #mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1
- + mdconfig -a -t malloc -s $sectors -u $no || exit 1
- + hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- + dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- + geli init -B none -H $hd -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null
- + geli attach -H $hd -p -k $keyfile md${no}
- +
- + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1
- +
- + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1
- + if [ $? -eq 0 ]; then
- + echo "ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - small 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + geli detach md${no}
- + # Copy first small sector to the second small sector.
- + # This should be detected as corruption.
- + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1
- + dd if=${sector} of=/dev/md${no} bs=512 count=1 seek=1 >/dev/null 2>&1
- + geli attach -H $hd -p -k $keyfile md${no}
- +
- + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1
- + if [ $? -ne 0 ]; then
- + echo "ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - small 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + ms=`diskinfo /dev/md${no} | awk '{print $3 - 512}'`
- + ns=`diskinfo /dev/md${no}.eli | awk '{print $4}'`
- + usecsize=`echo "($ms / $ns) - (($ms / $ns) % 512)" | bc`
- +
- + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1
- +
- + dd if=/dev/md${no}.eli bs=${secsize} count=2 >/dev/null 2>&1
- + if [ $? -eq 0 ]; then
- + echo "ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - big 1 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + geli detach md${no}
- + # Copy first big sector to the second big sector.
- + # This should be detected as corruption.
- + dd if=/dev/md${no} of=${sector} bs=${usecsize} count=1 >/dev/null 2>&1
- + dd if=${sector} of=/dev/md${no} bs=${usecsize} count=1 seek=1 >/dev/null 2>&1
- + geli attach -H $hd -p -k $keyfile md${no}
- +
- + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=2 >/dev/null 2>&1
- + if [ $? -ne 0 ]; then
- + echo "ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - big 2 aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + geli detach md${no}
- + mdconfig -d -u $no
- + rm $hd
- + done
- + done
- +done
- +
- +rm -f $keyfile $sector
- --- tools/regression/geom_eli/integrity-data-H.t.orig 2013-06-02 19:44:16.511963301 +0300
- +++ tools/regression/geom_eli/integrity-data-H.t 2013-06-02 15:01:59.841951264 +0300
- @@ -0,0 +1,70 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +sector=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- +echo 1..2760
- +
- +i=1
- +
- +for cipher in aes:0 aes:128 aes:256 \
- + aes-xts:0 aes-xts:128 aes-xts:256 \
- + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \
- + 3des:0 3des:192 \
- + 3des-cbc:0 3des-cbc:192 \
- + blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
- + blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
- + blowfish:416 blowfish:448 \
- + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \
- + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \
- + blowfish-cbc:416 blowfish-cbc:448 \
- + camellia:0 camellia:128 camellia:192 camellia:256 \
- + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
- + ealgo=${cipher%%:*}
- + keylen=${cipher##*:}
- + for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do
- + for secsize in 512 1024 2048 4096 8192; do
- + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1
- + hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- + dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- + geli init -B none -H $hd -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null
- + geli attach -H $hd -p -k $keyfile md${no}
- +
- + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1
- +
- + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1
- + if [ $? -eq 0 ]; then
- + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + geli detach md${no}
- + # Corrupt 8 bytes of data.
- + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1
- + dd if=/dev/random of=${sector} bs=1 count=8 seek=64 conv=notrunc >/dev/null 2>&1
- + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1
- + geli attach -H $hd -p -k $keyfile md${no}
- +
- + dd if=/dev/md${no}.eli of=/dev/null bs=${secsize} count=1 >/dev/null 2>&1
- + if [ $? -ne 0 ]; then
- + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + geli detach md${no}
- + mdconfig -d -u $no
- + rm $hd
- + done
- + done
- +done
- +
- +rm -f $keyfile $sector
- --- tools/regression/geom_eli/integrity-hmac-H.t.orig 2013-06-02 19:44:23.520972406 +0300
- +++ tools/regression/geom_eli/integrity-hmac-H.t 2013-06-02 15:02:06.302772401 +0300
- @@ -0,0 +1,70 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +sector=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- +echo 1..2760
- +
- +i=1
- +
- +for cipher in aes:0 aes:128 aes:256 \
- + aes-xts:0 aes-xts:128 aes-xts:256 \
- + aes-cbc:0 aes-cbc:128 aes-cbc:192 aes-cbc:256 \
- + 3des:0 3des:192 \
- + 3des-cbc:0 3des-cbc:192 \
- + blowfish:0 blowfish:128 blowfish:160 blowfish:192 blowfish:224 \
- + blowfish:256 blowfish:288 blowfish:320 blowfish:352 blowfish:384 \
- + blowfish:416 blowfish:448 \
- + blowfish-cbc:0 blowfish-cbc:128 blowfish-cbc:160 blowfish-cbc:192 blowfish-cbc:224 \
- + blowfish-cbc:256 blowfish-cbc:288 blowfish-cbc:320 blowfish-cbc:352 blowfish-cbc:384 \
- + blowfish-cbc:416 blowfish-cbc:448 \
- + camellia:0 camellia:128 camellia:192 camellia:256 \
- + camellia-cbc:0 camellia-cbc:128 camellia-cbc:192 camellia-cbc:256; do
- + ealgo=${cipher%%:*}
- + keylen=${cipher##*:}
- + for aalgo in hmac/md5 hmac/sha1 hmac/ripemd160 hmac/sha256 hmac/sha384 hmac/sha512; do
- + for secsize in 512 1024 2048 4096 8192; do
- + mdconfig -a -t malloc -s `expr $secsize \* 2 + 512`b -u $no || exit 1
- + hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- + dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- + geli init -B none -H $hd -a $aalgo -e $ealgo -l $keylen -P -K $keyfile -s $secsize md${no} 2>/dev/null
- + geli attach -H $hd -p -k $keyfile md${no}
- +
- + dd if=/dev/random of=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1
- +
- + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1
- + if [ $? -eq 0 ]; then
- + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + geli detach md${no}
- + # Corrupt 8 bytes of HMAC.
- + dd if=/dev/md${no} of=${sector} bs=512 count=1 >/dev/null 2>&1
- + dd if=/dev/random of=${sector} bs=1 count=16 conv=notrunc >/dev/null 2>&1
- + dd if=${sector} of=/dev/md${no} bs=512 count=1 >/dev/null 2>&1
- + geli attach -H $hd -p -k $keyfile md${no}
- +
- + dd if=/dev/md${no}.eli bs=${secsize} count=1 >/dev/null 2>&1
- + if [ $? -ne 0 ]; then
- + echo "ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + else
- + echo "not ok $i - aalgo=${aalgo} ealgo=${ealgo} keylen=${keylen} sec=${secsize}"
- + fi
- + i=$((i+1))
- +
- + geli detach md${no}
- + mdconfig -d -u $no
- + rm $hd
- + done
- + done
- +done
- +
- +rm -f $keyfile $sector
- --- tools/regression/geom_eli/kill-H.t.orig 2013-06-02 19:44:31.851649909 +0300
- +++ tools/regression/geom_eli/kill-H.t 2013-06-02 15:03:47.244601588 +0300
- @@ -0,0 +1,40 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile2=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +
- +echo 1..2
- +
- +i=1
- +
- +dd if=/dev/random of=${keyfile1} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random of=${keyfile2} bs=512 count=16 >/dev/null 2>&1
- +
- +geli init -H $hd -B none -P -K $keyfile1 md${no}
- +geli attach -H $hd -p -k $keyfile1 md${no}
- +geli setkey -H $hd -n 1 -P -K $keyfile2 md${no}
- +
- +geli kill md${no}
- +if [ $? -eq 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +sleep 1
- +
- +if [ ! -c /dev/md{$no}.eli ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +
- +mdconfig -d -u $no
- +rm -f $keyfile1 $keyfile2 $hd
- --- tools/regression/geom_eli/nokey-H.t.orig 2013-06-02 19:44:38.948121946 +0300
- +++ tools/regression/geom_eli/nokey-H.t 2013-06-02 15:02:12.875607774 +0300
- @@ -0,0 +1,81 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +
- +echo 1..8
- +
- +i=1
- +
- +geli init -H $hd -B none -P md${no} 2>/dev/null
- +if [ $? -ne 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- +geli init -H $hd -B none -P -K ${keyfile} md${no} 2>/dev/null
- +if [ $? -eq 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +geli attach -H $hd -p md${no} 2>/dev/null
- +if [ $? -ne 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k ${keyfile} md${no} 2>/dev/null
- +if [ $? -eq 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +geli setkey -H $hd -n 0 -P md${no} 2>/dev/null
- +if [ $? -ne 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +geli detach md${no} 2>/dev/null
- +if [ $? -eq 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +geli setkey -H $hd -n 0 -p -P -K ${keyfile} md${no} 2>/dev/null
- +if [ $? -ne 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +geli setkey -H $hd -n 0 -p -k ${keyfile} -P md${no} 2>/dev/null
- +if [ $? -ne 0 ]; then
- + echo "ok $i"
- +else
- + echo "not ok $i"
- +fi
- +i=$((i + 1))
- +
- +mdconfig -d -u $no
- +rm -f $keyfile $hd
- --- tools/regression/geom_eli/readonly-H.t.orig 2013-06-02 19:44:47.704134861 +0300
- +++ tools/regression/geom_eli/readonly-H.t 2013-06-02 15:00:51.180224711 +0300
- @@ -0,0 +1,49 @@
- +#!/bin/sh
- +# $FreeBSD: stable/9/tools/regression/geom_eli/readonly.t 182452 2008-08-29 18:10:18Z pjd $
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +
- +echo 1..10
- +
- +i=1
- +
- +dd if=/dev/random of=${keyfile} bs=512 count=16 >/dev/null 2>&1
- +
- +geli init -H $hd -B none -P -K $keyfile md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli attach -H $hd -r -p -k $keyfile md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +sh -c "true >/dev/md${no}.eli" 2>/dev/null && echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli kill md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +if [ -c /dev/md{$no}.eli ]; then echo "not "; fi
- +echo ok $i; i=$((i + 1))
- +
- +geli attach -H $hd -r -p -k $keyfile md${no}
- +geli setkey -H $hd -n 1 -P -K /dev/null md${no} 2>/dev/null && echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli delkey -H $hd -n 0 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli delkey -H $hd -f -n 0 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli list md${no}.eli | egrep '^Flags: .*READ-ONLY' >/dev/null || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +geli detach md${no} || echo -n "not "
- +echo ok $i; i=$((i + 1))
- +
- +mdconfig -d -u $no
- +rm -f $keyfile $hd
- --- tools/regression/geom_eli/resize-H.t.orig 2013-06-02 19:44:55.207434024 +0300
- +++ tools/regression/geom_eli/resize-H.t 2013-06-02 14:58:47.222470318 +0300
- @@ -0,0 +1,156 @@
- +#! /bin/sh
- +
- +base=`basename $0`
- +
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +meta=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- +echo 1..26
- +
- +BLK=512
- +BLKS_PER_MB=2048
- +
- +md=$(mdconfig -s40m) || exit 1
- +unit=${md#md}
- +i=1
- +
- +setsize() {
- + partszMB=$1 unitszMB=$2
- +
- + {
- + echo a: $(($partszMB * $BLKS_PER_MB)) 0 4.2BSD 1024 8192
- + echo c: $(($unitszMB * $BLKS_PER_MB)) 0 unused 0 0
- + } | disklabel -R $md /dev/stdin
- +}
- +
- +# Initialise
- +
- +kldload geom_eli >/dev/null 2>&1
- +
- +setsize 10 40 || echo -n "not "
- +echo ok $i - "Sized ${md}a to 10m"
- +i=$((i + 1))
- +
- +echo secret > $keyfile
- +geli init -B none -H $hd -P -K $keyfile ${md}a || echo -n "not "
- +echo ok $i - "Initialised geli on ${md}a"
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k $keyfile ${md}a || echo -n "not "
- +echo ok $i - "Attached ${md}a as ${md}a.eli"
- +i=$((i + 1))
- +
- +newfs -U ${md}a.eli >/dev/null || echo -n "not "
- +echo ok $i - "Initialised the filesystem on ${md}a.eli"
- +i=$((i + 1))
- +
- +out=$(fsck -tufs -y ${md}a.eli)
- +echo "$out" | fgrep -q MODIFIED && echo -n "not "
- +echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \
- + "lines of output"
- +i=$((i + 1))
- +
- +geli detach ${md}a.eli || echo -n "not "
- +echo ok $i - "Detached ${md}a.eli"
- +i=$((i + 1))
- +
- +setsize 20 40 || echo -n "not "
- +echo ok $i - "Sized ${md}a to 20m"
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k $keyfile ${md}a 2>/dev/null && echo -n "not "
- +echo ok $i - "Attaching ${md}a fails after resizing the consumer"
- +i=$((i + 1))
- +
- +geli restore $hd ${md}a 2>/dev/null && echo -n "not "
- +echo ok $i - "Restoring metadata on ${md}a.eli fails without -f"
- +i=$((i + 1))
- +
- +geli restore -f $hd ${md}a || echo -n "not "
- +echo ok $i - "Restoring metadata on ${md}a.eli can be forced"
- +i=$((i + 1))
- +
- +geli backup ${md}a $hd
- +geli clear ${md}a
- +
- +geli attach -H $hd -p -k $keyfile ${md}a || echo -n "not "
- +echo ok $i - "Attaching ${md}a is now possible"
- +i=$((i + 1))
- +
- +growfs -y ${md}a.eli >/dev/null || echo -n "not "
- +echo ok $i - "Extended the filesystem on ${md}a.eli"
- +i=$((i + 1))
- +
- +out=$(fsck -tufs -y ${md}a.eli)
- +echo "$out" | fgrep -q MODIFIED && echo -n "not "
- +echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \
- + "lines of output"
- +i=$((i + 1))
- +
- +# Now do the resize properly
- +
- +geli detach ${md}a.eli || echo -n "not "
- +echo ok $i - "Detached ${md}a.eli"
- +i=$((i + 1))
- +
- +setsize 30 40 || echo -n "not "
- +echo ok $i - "Sized ${md}a to 30m"
- +i=$((i + 1))
- +
- +geli resize -H $hd -s20m ${md}a || echo -n "not "
- +echo ok $i - "Resizing works ok"
- +i=$((i + 1))
- +
- +geli resize -H $hd -s20m ${md}a 2>/dev/null && echo -n "not "
- +echo ok $i - "Resizing doesn't work a 2nd time (no old metadata)"
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k $keyfile ${md}a || echo -n "not "
- +echo ok $i - "Attaching ${md}a works ok"
- +i=$((i + 1))
- +
- +growfs -y ${md}a.eli >/dev/null || echo -n "not "
- +echo ok $i - "Extended the filesystem on ${md}a.eli"
- +i=$((i + 1))
- +
- +out=$(fsck -tufs -y ${md}a.eli)
- +echo "$out" | fgrep -q MODIFIED && echo -n "not "
- +echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \
- + "lines of output"
- +i=$((i + 1))
- +
- +geli detach ${md}a.eli
- +mdconfig -du$unit
- +
- +md=$(mdconfig -s40m) || exit 1
- +unit=${md#md}
- +
- +gpart create -s GPT $md 1>/dev/null || echo -n "not "
- +echo ok $i - "Installed a GPT on ${md}"
- +i=$((i + 1))
- +
- +gpart add -s 20m -t freebsd-ufs -i 1 $md 1>/dev/null || echo -n "not "
- +echo ok $i - "Added a 20m partition in slot 1"
- +i=$((i + 1))
- +
- +geli init -B none -H $hd -P -K ${keyfile} ${md}p1 || echo -n "not "
- +echo ok $i - "Initialised geli on ${md}p1"
- +i=$((i + 1))
- +
- +gpart resize -s 30m -i 1 $md 1>/dev/null || echo -n "not "
- +echo ok $i - "Resized partition ${md}p1 to 30m"
- +i=$((i + 1))
- +
- +geli resize -H $hd -s 20m ${md}p1 || echo -n "not "
- +echo ok $i - "Resized geli on ${md}p1 to 30m"
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k $keyfile ${md}p1 || echo -n "not "
- +echo ok $i - "Attached ${md}p1.eli"
- +i=$((i + 1))
- +
- +geli detach ${md}p1.eli
- +mdconfig -du$unit
- +
- +rm -f $keyfile $meta $hd
- --- tools/regression/geom_eli/setkey-H.t.orig 2013-06-02 19:45:04.168246920 +0300
- +++ tools/regression/geom_eli/setkey-H.t 2013-06-02 14:52:44.706396389 +0300
- @@ -0,0 +1,108 @@
- +#!/bin/sh
- +
- +base=`basename $0`
- +no=45
- +sectors=100
- +rnd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile1=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile2=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile3=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile4=`mktemp /tmp/$base.XXXXXX` || exit 1
- +keyfile5=`mktemp /tmp/$base.XXXXXX` || exit 1
- +hd=`mktemp /tmp/$base.XXXXXX` || exit 1
- +mdconfig -a -t malloc -s `expr $sectors + 1` -u $no || exit 1
- +
- +echo "1..16"
- +
- +i=1
- +
- +dd if=/dev/random of=${rnd} bs=512 count=${sectors} >/dev/null 2>&1
- +hash1=`dd if=${rnd} bs=512 count=${sectors} 2>/dev/null | md5`
- +dd if=/dev/random of=${keyfile1} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random of=${keyfile2} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random of=${keyfile3} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random of=${keyfile4} bs=512 count=16 >/dev/null 2>&1
- +dd if=/dev/random of=${keyfile5} bs=512 count=16 >/dev/null 2>&1
- +
- +geli init -B none -H $hd -P -K $keyfile1 md${no}
- +geli attach -H $hd -p -k $keyfile1 md${no}
- +
- +dd if=${rnd} of=/dev/md${no}.eli bs=512 count=${sectors} 2>/dev/null
- +rm -f $rnd
- +hash2=`dd if=/dev/md${no}.eli bs=512 count=${sectors} 2>/dev/null | md5`
- +
- +geli setkey -H $hd -P -K $keyfile2 md${no} 1>/dev/null || echo -n "not "
- +echo ok $i - "Change current key (0) for attached provider"
- +i=$((i + 1))
- +geli detach md${no}
- +
- +geli attach -H $hd -p -k $keyfile1 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i - "We cannot use keyfile1 anymore"
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k $keyfile2 md${no} || echo -n "not "
- +echo ok $i - "Attach with new key"
- +i=$((i + 1))
- +hash3=`dd if=/dev/md${no}.eli bs=512 count=${sectors} 2>/dev/null | md5`
- +
- +geli setkey -H $hd -n 1 -P -K $keyfile3 md${no} 1>/dev/null || echo -n "not "
- +echo ok $i - "Change key 1 for attached provider"
- +i=$((i + 1))
- +geli detach md${no}
- +
- +geli attach -H $hd -p -k $keyfile3 md${no} || echo -n "not "
- +echo ok $i - "Attach with key 1"
- +i=$((i + 1))
- +hash4=`dd if=/dev/md${no}.eli bs=512 count=${sectors} 2>/dev/null | md5`
- +geli detach md${no}
- +
- +geli setkey -H $hd -p -k $keyfile3 -P -K $keyfile4 md${no} 1>/dev/null || echo -n "not "
- +echo ok $i - "Change current (1) key for detached provider"
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k $keyfile3 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i - "We cannot use keyfile3 anymore"
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k $keyfile4 md${no} || echo -n "not "
- +echo ok $i - "Attach with key 1"
- +i=$((i + 1))
- +hash5=`dd if=/dev/md${no}.eli bs=512 count=${sectors} 2>/dev/null | md5`
- +geli detach md${no}
- +
- +geli setkey -H $hd -n 0 -p -k $keyfile4 -P -K $keyfile5 md${no} 1>/dev/null || echo -n "not "
- +echo ok $i - "Change key 0 for detached provider"
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k $keyfile2 md${no} 2>/dev/null && echo -n "not "
- +echo ok $i - "We cannot use keyfile2 anymore"
- +i=$((i + 1))
- +
- +geli attach -H $hd -p -k $keyfile5 md${no} || echo -n "not "
- +echo ok $i - "Attach with key 0"
- +i=$((i + 1))
- +hash6=`dd if=/dev/md${no}.eli bs=512 count=${sectors} 2>/dev/null | md5`
- +geli detach md${no}
- +
- +if [ ${hash1} != ${hash2} ]; then echo -n "not "; fi
- +echo ok $i - "key1 equal key2"
- +i=$((i + 1))
- +
- +if [ ${hash1} != ${hash3} ]; then echo -n "not "; fi
- +echo ok $i - "key1 equal key3"
- +i=$((i + 1))
- +
- +if [ ${hash1} != ${hash4} ]; then echo -n "not "; fi
- +echo ok $i - "key1 equal key4"
- +i=$((i + 1))
- +
- +if [ ${hash1} != ${hash5} ]; then echo -n "not "; fi
- +echo ok $i - "key1 equal key5"
- +i=$((i + 1))
- +
- +if [ ${hash1} != ${hash6} ]; then echo -n "not "; fi
- +echo ok $i - "key1 equal key6"
- +i=$((i + 1))
- +
- +mdconfig -d -u $no
- +rm -f $keyfile1 $keyfile2 $keyfile3 $keyfile4 $keyfile5 $hd
- --- tools/regression/geom_eli/resize.t.orig 2013-05-28 19:16:26.965730227 +0300
- +++ tools/regression/geom_eli/resize.t 2013-06-02 14:59:14.592948965 +0300
- @@ -2,6 +2,11 @@
- #
- # $FreeBSD: stable/9/tools/regression/geom_eli/resize.t 213231 2010-09-27 21:10:37Z pjd $
- +base=`basename $0`
- +
- +keyfile=`mktemp /tmp/$base.XXXXXX` || exit 1
- +meta=`mktemp /tmp/$base.XXXXXX` || exit 1
- +
- echo 1..27
- BLK=512
- @@ -28,17 +33,19 @@
- echo ok $i - "Sized ${md}a to 10m"
- i=$((i + 1))
- -echo secret >tmp.key
- -geli init -Bnone -PKtmp.key ${md}a || echo -n "not "
- +echo secret > $keyfile
- +geli init -B none -P -K $keyfile ${md}a || echo -n "not "
- echo ok $i - "Initialised geli on ${md}a"
- i=$((i + 1))
- -geli attach -pk tmp.key ${md}a || echo -n "not "
- +
- +geli attach -p -k $keyfile ${md}a || echo -n "not "
- echo ok $i - "Attached ${md}a as ${md}a.eli"
- i=$((i + 1))
- newfs -U ${md}a.eli >/dev/null || echo -n "not "
- echo ok $i - "Initialised the filesystem on ${md}a.eli"
- i=$((i + 1))
- +
- out=$(fsck -tufs -y ${md}a.eli)
- echo "$out" | fgrep -q MODIFIED && echo -n "not "
- echo ok $i - "fsck says ${md}a.eli is clean," $(echo $(echo "$out" | wc -l)) \
- @@ -49,7 +56,7 @@
- # Doing a backup, resize & restore must be forced (with -f) as geli
- # verifies that the provider size in the metadata matches the consumer.
- -geli backup ${md}a tmp.meta || echo -n "not "
- +geli backup ${md}a $meta || echo -n "not "
- echo ok $i - "Backed up ${md}a metadata"
- i=$((i + 1))
- @@ -60,18 +67,20 @@
- setsize 20 40 || echo -n "not "
- echo ok $i - "Sized ${md}a to 20m"
- i=$((i + 1))
- -geli attach -pktmp.key ${md}a && echo -n "not "
- +
- +geli attach -p -k $keyfile ${md}a 2>/dev/null && echo -n "not "
- echo ok $i - "Attaching ${md}a fails after resizing the consumer"
- i=$((i + 1))
- -geli restore tmp.meta ${md}a && echo -n "not "
- +geli restore $meta ${md}a 2>/dev/null && echo -n "not "
- echo ok $i - "Restoring metadata on ${md}a.eli fails without -f"
- i=$((i + 1))
- -geli restore -f tmp.meta ${md}a || echo -n "not "
- +
- +geli restore -f $meta ${md}a || echo -n "not "
- echo ok $i - "Restoring metadata on ${md}a.eli can be forced"
- i=$((i + 1))
- -geli attach -pktmp.key ${md}a || echo -n "not "
- +geli attach -p -k $keyfile ${md}a || echo -n "not "
- echo ok $i - "Attaching ${md}a is now possible"
- i=$((i + 1))
- @@ -99,11 +108,12 @@
- geli resize -s20m ${md}a || echo -n "not "
- echo ok $i - "Resizing works ok"
- i=$((i + 1))
- -geli resize -s20m ${md}a && echo -n "not "
- +
- +geli resize -s20m ${md}a 2>/dev/null && echo -n "not "
- echo ok $i - "Resizing doesn't work a 2nd time (no old metadata)"
- i=$((i + 1))
- -geli attach -pktmp.key ${md}a || echo -n "not "
- +geli attach -p -k $keyfile ${md}a || echo -n "not "
- echo ok $i - "Attaching ${md}a works ok"
- i=$((i + 1))
- @@ -118,32 +128,40 @@
- i=$((i + 1))
- geli detach ${md}a.eli
- +mdconfig -du$unit
- +md=$(mdconfig -s40m) || exit 1
- +unit=${md#md}
- # Verify that the man page example works, changing ada0 to $md,
- # 1g to 20m, 2g to 30m and keyfile to tmp.key, and adding -B none
- # to geli init.
- -gpart create -s GPT $md || echo -n "not "
- +gpart create -s GPT $md 1>/dev/null || echo -n "not "
- echo ok $i - "Installed a GPT on ${md}"
- i=$((i + 1))
- -gpart add -s 20m -t freebsd-ufs -i 1 $md || echo -n "not "
- +
- +gpart add -s 20m -t freebsd-ufs -i 1 $md 1>/dev/null || echo -n "not "
- echo ok $i - "Added a 20m partition in slot 1"
- i=$((i + 1))
- -geli init -B none -K tmp.key -P ${md}p1 || echo -n "not "
- +
- +geli init -B none -P -K ${keyfile} ${md}p1 || echo -n "not "
- echo ok $i - "Initialised geli on ${md}p1"
- i=$((i + 1))
- -gpart resize -s 30m -i 1 $md || echo -n "not "
- +
- +gpart resize -s 30m -i 1 $md 1>/dev/null || echo -n "not "
- echo ok $i - "Resized partition ${md}p1 to 30m"
- i=$((i + 1))
- +
- geli resize -s 20m ${md}p1 || echo -n "not "
- echo ok $i - "Resized geli on ${md}p1 to 30m"
- i=$((i + 1))
- -geli attach -k tmp.key -p ${md}p1 || echo -n "not "
- +
- +geli attach -p -k $keyfile ${md}p1 || echo -n "not "
- echo ok $i - "Attached ${md}p1.eli"
- i=$((i + 1))
- geli detach ${md}p1.eli
- mdconfig -du$unit
- -rm tmp.*
- +rm -f $keyfile $meta
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement