diff options
author | Milan Broz <gmazyland@gmail.com> | 2023-06-26 13:25:59 +0200 |
---|---|---|
committer | Milan Broz <gmazyland@gmail.com> | 2023-06-26 13:25:59 +0200 |
commit | 1f01eea60e38ac92aa05e4b95372d54b7b9095df (patch) | |
tree | dc309b52e438ce19abf4b74df17a044e6e4725a9 | |
parent | 10847d7100060d1d8434754f16ad33e1ee6ac245 (diff) | |
download | cryptsetup-1f01eea60e38ac92aa05e4b95372d54b7b9095df.tar.gz |
Fix reencryption to fail properly for unknown cipher.
crypt_get_cipher and crypt_get_cipher mode can return NULL,
check it in advance.
-rw-r--r-- | src/utils_reencrypt.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils_reencrypt.c b/src/utils_reencrypt.c index a78557cb..8ffceb36 100644 --- a/src/utils_reencrypt.c +++ b/src/utils_reencrypt.c @@ -419,6 +419,12 @@ static bool luks2_reencrypt_eligible(struct crypt_device *cd) return false; } + /* Check that cipher is in compatible format */ + if (!crypt_get_cipher(cd)) { + log_err(_("No known cipher specification pattern detected in LUKS2 header.")); + return false; + } + return true; } |