Add utils_crypt file and test for supported modes presentation.

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@348 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
Milan Broz
2010-10-26 14:34:47 +00:00
parent 3b50005d2f
commit bb8e085378
10 changed files with 172 additions and 37 deletions

View File

@@ -348,11 +348,11 @@ static int _action_luksFormat_useMK()
.data_alignment = opt_align_payload,
};
if (sscanf(opt_cipher ?: DEFAULT_CIPHER(LUKS1),
"%" MAX_CIPHER_LEN_STR "[^-]-%" MAX_CIPHER_LEN_STR "s",
cipher, cipher_mode) != 2) {
r = crypt_parse_name_and_mode(opt_cipher ?: DEFAULT_CIPHER(LUKS1),
cipher, cipher_mode);
if (r < 0) {
log_err("No known cipher specification pattern detected.\n");
return -EINVAL;
return r;
}
keysize = (opt_key_size ?: DEFAULT_LUKS1_KEYBITS) / 8;