fix ykfde if file exists

This commit is contained in:
2023-11-22 15:54:19 +01:00
parent dba986fadc
commit 2591118a5d
3 changed files with 9 additions and 0 deletions

View File

@@ -26,6 +26,10 @@ if [ "$YKFDE_SLOT_CHECK" != 1 ]; then
fi
YKFDE_SALT="$(dd if=/dev/random bs=1 count=$YKFDE_SALT_LENGTH 2>/dev/null | rbtohex)"
if [ -f "$YKFDE_STORAGE" ]; then
YKFDE_SALT="$(head -1 $YKFDE_STORAGE)"
echo "$FILE exists."
fi
YKFDE_CHALLENGE="$(echo -n $YKFDE_SALT | openssl dgst -binary -sha512 | rbtohex)"
YKFDE_RESPONSE="$(ykchalresp -2 -x $YKFDE_CHALLENGE 2>/dev/null)"
YKFDE_K_LUKS="$(echo | pbkdf2-sha512 $(($YKFDE_KEY_LENGTH / 8)) $YKFDE_ITERATIONS $YKFDE_RESPONSE | rbtohex)"