[pkg-cryptsetup-devel] Hello and bug 610366
Rodolfo kix Garcia
kix at kix.es
Wed Feb 9 23:24:18 UTC 2011
Hello,
my name is Rodolfo (AKA kix) and I am new in the mail list. I would like
to help with the bugs, but I do not have much time.
About the bug 610366,... the problem seems to be in the function
_action_luksAddKey_useMK, because the first and second ifs returns a
value to "r", and this value must be "0" to continue. But in the fourth
"if" (_readk_mk(opt...), if the "if" fails, then the program flow goes
to the out label and "r" continues with the value "0" from the second
"if", therefore, the returns in the out section returns 0. This is the code:
static int _action_luksAddKey_useMK()
{
int r = -EINVAL, keysize = 0;
char *key = NULL;
struct crypt_device *cd = NULL;
if ((r = crypt_init(&cd, action_argv[0])))
goto out;
if ((r = crypt_load(cd, CRYPT_LUKS1, NULL)))
goto out;
keysize = crypt_get_volume_key_size(cd);
crypt_set_password_verify(cd, 1);
crypt_set_timeout(cd, opt_timeout);
if (opt_iteration_time)
crypt_set_iterarion_time(cd, opt_iteration_time);
if (_read_mk(opt_master_key_file, &key, keysize) < 0)
goto out;
r = crypt_keyslot_add_by_volume_key(cd, opt_key_slot, key,
keysize, NULL, 0);
out:
crypt_free(cd);
if (key) {
memset(key, 0, keysize);
free(key);
}
return r;
}
The patch should be:
osaka:~/cryptsetup-1.1.3/src$ diff -c3 cryptsetup.orig.c cryptsetup.c
*** cryptsetup.orig.c 2011-02-10 00:04:33.000000000 +0100
--- cryptsetup.c 2011-02-10 00:04:43.000000000 +0100
***************
*** 483,489 ****
--- 483,492 ----
crypt_set_iterarion_time(cd, opt_iteration_time);
if (_read_mk(opt_master_key_file, &key, keysize) < 0)
+ {
+ r = -EINVAL;
goto out;
+ }
r = crypt_keyslot_add_by_volume_key(cd, opt_key_slot, key,
keysize, NULL, 0);
out:
osaka:~/cryptsetup-1.1.3/src$
Sorry, but I have some problems to reproduce the bug. Can anyone check it?
Thanks a lot.
Best Regards.
--
||// //\\// Rodolfo "kix" Garcia
||\\// //\\ http://www.kix.es/
More information about the pkg-cryptsetup-devel
mailing list