summaryrefslogtreecommitdiff
path: root/cryptfs.bin.in
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-02-03 14:06:09 +0100
committerErich Eckner <git@eckner.net>2020-02-03 14:06:09 +0100
commit03fae403a0c2b772d604a799f42cfb94730c644a (patch)
tree8a9b59bb5ff31590f86ade79348e225da981e3da /cryptfs.bin.in
parent0bb9186f74426784b95732337e9caa9846343113 (diff)
downloadcryptfs-daemon-03fae403a0c2b772d604a799f42cfb94730c644a.tar.xz
cryptfs.bin: handle integrity target, too
Diffstat (limited to 'cryptfs.bin.in')
-rw-r--r--cryptfs.bin.in43
1 files changed, 38 insertions, 5 deletions
diff --git a/cryptfs.bin.in b/cryptfs.bin.in
index a7a6ee1..cf4366f 100644
--- a/cryptfs.bin.in
+++ b/cryptfs.bin.in
@@ -284,6 +284,31 @@ do_crypt_open() {
fi
}
+do_integrity_close() {
+ if is_unlocked "$1"; then
+ while ! integritysetup close "$1"; do
+ sleep 1
+ done
+ fi
+}
+
+do_integrity_open() {
+ local name
+ local raw
+ name="$1"
+ raw="$2"
+ if ! is_unlocked "${name}"; then
+ max_tries=10
+ while ! integritysetup open "${raw}" "${name}"; do
+ sleep 1
+ max_tries=$((max_tries-1))
+ if [ ${max_tries} -le 0 ]; then
+ exit 1
+ fi
+ done
+ fi
+}
+
do_mdadm_stop() {
device="$1"
if mdadm --detail "${device}" | \
@@ -317,13 +342,21 @@ printf '%s\n' "${crypttab}" | \
if [ -n "${raid_device}" ]; then
printf '1 do_mdadm_stop %s\n' "${raid_device}"
fi
- printf '2 do_crypt_close %s\n' "${name}"
+ if [ -n "${key}" ]; then
+ printf '3 do_crypt_close %s\n' "${name}"
+ else
+ printf '2 do_integrity_close %s\n' "${name}"
+ fi
else
- printf '0 do_mount %s\n' "${key_mount}"
- printf '1 do_crypt_open %s\n' "${name} ${raw} ${key} ${key_slot_option}"
- printf '2 do_unmount -l %s\n' "${key_mount}"
+ if [ -n "${key}" ]; then
+ printf '0 do_mount %s\n' "${key_mount}"
+ printf '1 do_crypt_open %s\n' "${name} ${raw} ${key} ${key_slot_option}"
+ printf '2 do_unmount -l %s\n' "${key_mount}"
+ else
+ printf '3 do_integrity_open %s\n' "${name} ${raw}"
+ fi
if [ -n "${mount_order}" ]; then
- printf '3 do_mount %s\n' "${mount_order}"
+ printf '4 do_mount %s\n' "${mount_order}"
fi
fi
done | \