~ubuntu-branches/debian/jessie/cryptsetup/jessie

« back to all changes in this revision

Viewing changes to tests/luks1-compat-test

  • Committer: Package Import Robot
  • Author(s): Jonas Meurer
  • Date: 2014-03-04 20:14:07 UTC
  • mfrom: (0.2.13)
  • Revision ID: package-import@ubuntu.com-20140304201407-8cn7znmyssyrgduu
Tags: 2:1.6.6-1
* new upsream version 1.6.6.
* add versioned dependency on cryptsetup-bin to cryptsetup. (closes: #747670)
* change versioned build-depends on automake to >= 1.12 to reflect upstream
  requirements. Thanks to Joel Johnson. (closes: #740688)
* build and link against libgcrypt20 (>= 1.6.1). Add note about whirlpool
  bug in older libgcrypt releases and how to deal with it to debian/NEWS.
* add systemd support to askpass. Thanks to David Härdeman for the patch.
  (closes: #742600, #755074)
* fix initramfs cryptroot hook to not include modules unconditionally. Thanks
  to Dmitrijs Ledkovs for bugreport and patch. (closes: #714104)
* fix decrypt_keyctl script to ask again in case of wrong passphrase. Thanks
  to Dmitriy Matrosov for bugreport and patch. (closes: #748368)
* incorporate changes from ubuntu package:
  - don't hardcode paths to udevadm and udevsettle.
  - restore terminal settings in askpass.c. (closes: #714942)
  - migrate upstart jobs to new names.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
# check luks1 images parsing
 
4
 
 
5
# NOTE: if image with whirlpool hash fails, check
 
6
# that you are not using old gcrypt with flawed whirlpool
 
7
# (see cryptsetup debug output)
 
8
 
 
9
CRYPTSETUP=../src/cryptsetup
 
10
TST_DIR=luks1-images
 
11
MAP=luks1tst
 
12
KEYFILE=keyfile1
 
13
 
 
14
function remove_mapping()
 
15
{
 
16
        [ -b /dev/mapper/$MAP ] && dmsetup remove $MAP
 
17
}
 
18
 
 
19
function fail()
 
20
{
 
21
        [ -n "$1" ] && echo "$1"
 
22
        echo " [FAILED]"
 
23
        remove_mapping
 
24
        exit 2
 
25
}
 
26
 
 
27
function skip()
 
28
{
 
29
        [ -n "$1" ] && echo "$1"
 
30
        echo "Test skipped."
 
31
        exit 0
 
32
}
 
33
 
 
34
function test_one()
 
35
{
 
36
        $CRYPTSETUP benchmark -c "$1" -s "$2" | grep -v "#" || skip
 
37
}
 
38
 
 
39
function test_required()
 
40
{
 
41
        which lsblk >/dev/null 2>&1 || skip "WARNING: lsblk tool required."
 
42
 
 
43
        echo "REQUIRED KDF TEST"
 
44
        $CRYPTSETUP benchmark -h whirlpool | grep "N/A" && skip
 
45
 
 
46
        echo "REQUIRED CIPHERS TEST"
 
47
        echo "#  Algorithm | Key |  Encryption |  Decryption"
 
48
 
 
49
        test_one aes-xts 256
 
50
        test_one twofish-xts 256
 
51
        test_one serpent-xts 256
 
52
        test_one aes-cbc 256
 
53
        test_one aes-lrw 256
 
54
}
 
55
 
 
56
export LANG=C
 
57
 
 
58
if [ $(id -u) != 0 ]; then
 
59
        echo "WARNING: You must be root to run activation part of test, test skipped."
 
60
        exit 0
 
61
fi
 
62
 
 
63
test_required
 
64
[ ! -d $TST_DIR ] && tar xjf luks1-images.tar.bz2
 
65
 
 
66
echo "ACTIVATION FS UUID CHECK"
 
67
for file in $(ls $TST_DIR/luks1_*) ; do
 
68
        echo -n " $file"
 
69
        $CRYPTSETUP luksOpen -d $TST_DIR/$KEYFILE $file $MAP 2>/dev/null
 
70
        ret=$?
 
71
        # ignore missing whirlpool (pwd failed is exit code 2)
 
72
        [ $ret -eq 1 ] && (echo $file | grep -q -e "whirlpool") && echo " [N/A]" && continue
 
73
        [ $ret -ne 0 ] && fail
 
74
        $CRYPTSETUP status $MAP >/dev/null || fail
 
75
        $CRYPTSETUP status /dev/mapper/$MAP >/dev/null || fail
 
76
        UUID=$(lsblk -n -o UUID /dev/mapper/$MAP)
 
77
        $CRYPTSETUP remove $MAP || fail
 
78
        [ "$UUID" != "DEAD-BABE" ] && fail "UUID check failed."
 
79
        echo " [OK]"
 
80
done