cryptroot: Retry mounting drives, if key does not work (you may add it).

This commit is contained in:
Ole Tange 2020-06-03 23:48:33 +02:00
parent e2274764c4
commit d990ce6bcb
2 changed files with 20 additions and 17 deletions

View file

@ -123,6 +123,13 @@ setup_mapping() {
fi
fi
get_crypt_type # set CRYPTTAB_TYPE to the type of crypt device
local count=0 maxtries="${CRYPTTAB_OPTION_tries:-3}" fstype vg rv
while [ $maxtries -le 0 ] || [ $count -lt $maxtries ]; do
if [ -z "${CRYPTTAB_OPTION_keyscript+x}" ] && [ "$CRYPTTAB_KEY" != "none" ]; then
# unlock via keyfile
unlock_mapping "$CRYPTTAB_KEY"
else
if [ -z "${CRYPTTAB_OPTION_keyscript+x}" ]; then
# Wait for USB to settle
/bin/sleep 3
@ -140,13 +147,6 @@ setup_mapping() {
echo "done."
fi
get_crypt_type # set CRYPTTAB_TYPE to the type of crypt device
local count=0 maxtries="${CRYPTTAB_OPTION_tries:-3}" fstype vg rv
while [ $maxtries -le 0 ] || [ $count -lt $maxtries ]; do
if [ -z "${CRYPTTAB_OPTION_keyscript+x}" ] && [ "$CRYPTTAB_KEY" != "none" ]; then
# unlock via keyfile
unlock_mapping "$CRYPTTAB_KEY"
else
if [ -s /tmp/cryptkeys.txt ]; then
local keyfound
keyfound=0

View file

@ -115,7 +115,10 @@ randdata() {
key=$(echo "$seed" | openssl sha256 -hex | cut -d' ' -f2)
iv=$(echo "$seed" | openssl sha512 -hex | cut -d' ' -f2)
fi
# single core = 743MiB/s
< /dev/zero openssl enc -aes-128-ctr -K $key -iv $iv 2>/dev/null
# single core = 184MiB/s
# openssl rand 2000000000
}
export -f randdata