Check if provided cipher and mode is usable before writing LUKS header to disk.

If user provided unusable cipher-mode string, LUKS header was written and
keyslot creation failed later.

Better check early (by creating fake dmcrypt device) if cipher is usable
and fail early (without writing LUKS header to device).

Fixes Issue#176
This commit is contained in:
Milan Broz
2013-11-10 22:05:55 +01:00
parent 09c229fe6c
commit ce23225e46
2 changed files with 28 additions and 1 deletions

View File

@@ -1842,7 +1842,7 @@ static void NonFIPSAlg(void)
struct crypt_device *cd;
struct crypt_params_luks1 params = {0};
char key[128] = "";
size_t key_size = 128;
size_t key_size = 128 / 8;
const char *cipher = "aes";
const char *cipher_mode = "cbc-essiv:sha256";
int ret;