From: <mva...@re...> - 2011-12-13 15:04:26
|
From: Miroslav Vadkerti <mva...@re...> Signed-off-by: Miroslav Vadkerti <mva...@re...> --- audit/crypto/tests/tp_loop_device.bash | 11 +++++------ audit/crypto/tests/tp_luks_functions.bash | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/audit/crypto/tests/tp_loop_device.bash b/audit/crypto/tests/tp_loop_device.bash index 96c7e3f..37001f7 100644 --- a/audit/crypto/tests/tp_loop_device.bash +++ b/audit/crypto/tests/tp_loop_device.bash @@ -20,13 +20,15 @@ # Loop device helper functions # +# globals +[ -z $LOOPDEV ] && LOOPDEV=$(losetup -f) + # Create new loop device. The paramters are optional. If you intend to pass # only second paramater you need to supply the first too! -# $1 = loop device (default /dev/loop/0) +# $1 = loop device (default $LOOPDEV) # $2 = size in MB (default 100MB) function create_loop_device { # defaults - LOOPDEV="/dev/loop0" LOOPSIZE="100" # if parameters given @@ -46,11 +48,8 @@ function create_loop_device { # Umount, detach the loop device and remove the loop file. # The paramter is optional. -# $1 = loop device (default /dev/loop/0) +# $1 = loop device (default $LOOPDEV) function remove_loop_device { - # defaults - LOOPDEV="/dev/loop0" - # if parameter given [ "x$1" != "x" ] && LOOPDEV=$1 diff --git a/audit/crypto/tests/tp_luks_functions.bash b/audit/crypto/tests/tp_luks_functions.bash index a2a2829..21eb674 100644 --- a/audit/crypto/tests/tp_luks_functions.bash +++ b/audit/crypto/tests/tp_luks_functions.bash @@ -21,7 +21,7 @@ # # default loop device to use -LOOPDEV="/dev/loop0" +[ -z $LOOPDEV ] && LOOPDEV=$(losetup -f) # Create LUKS on $LOOPDEV with $LUKSPASS password # $1 - password to use @@ -50,7 +50,7 @@ function check_luks { # dump the LUKS device TMP=$(mktemp) - cryptsetup luksDump /dev/loop0 &> $TMP + cryptsetup luksDump $LOOPDEV &> $TMP # Check for correct parameters egrep "Cipher name.*aes" $TMP || exit_fail "Failed check on cipher name" -- 1.7.6.4 |