On Wed, 12.02.14 23:55, David Härdeman (da...@hardeman.nu) wrote: > The command line key-size is in bits but the libcryptsetup API expects > bytes.
This doesn't apply anymore :-( Could you rebase please? > --- > src/cryptsetup/cryptsetup.c | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c > index f72cf9f..e7e8066 100644 > --- a/src/cryptsetup/cryptsetup.c > +++ b/src/cryptsetup/cryptsetup.c > @@ -414,7 +414,7 @@ static int attach_luks_or_plain(struct crypt_device *cd, > /* for CRYPT_PLAIN limit reads > * from keyfile to key length, and > * ignore keyfile-size */ > - opt_keyfile_size = opt_key_size / 8; > + opt_keyfile_size = opt_key_size; > > /* In contrast to what the name > * crypt_setup() might suggest this > @@ -577,7 +577,11 @@ int main(int argc, char *argv[]) { > else > until = 0; > > - opt_key_size = (opt_key_size > 0 ? opt_key_size : 256); > + if (opt_key_size % 8) { > + log_warning("Key size invalid (not a multiple of > 8)."); > + goto finish; > + } > + opt_key_size = (opt_key_size > 0 ? opt_key_size : 256) / 8; I'd really prefer if we devide here by 8 as early as we parse it, so that we never get confused by this. i.e. move this to parse_one_option()? Lennart -- Lennart Poettering, Red Hat _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel