diff --git a/ChangeLog b/ChangeLog index 5799f5fb..34dedf5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2009-08-17 Milan Broz - * Fix PBKDF2 speed calculation for large passhrases + * Fix PBKDF2 speed calculation for large passhrases. + * Allow using passphrase provided in options struct for LuksOpen. 2009-07-30 Milan Broz * Fix errors when compiled with LUKS_DEBUG. diff --git a/lib/setup.c b/lib/setup.c index 601ddf21..12769cff 100644 --- a/lib/setup.c +++ b/lib/setup.c @@ -555,7 +555,12 @@ static int __crypt_luks_open(int arg, struct setup_backend *backend, struct cryp start: mk=NULL; - if(get_key(prompt, &password, &passwordLen, 0, options->key_file, options->passphrase_fd, options->timeout, options->flags)) + if(options->passphrase) { + passwordLen = strlen(options->passphrase); + password = safe_alloc(passwordLen + 1); + strncpy(password, options->passphrase, passwordLen + 1); + tries = 0; + } else if(get_key(prompt, &password, &passwordLen, 0, options->key_file, options->passphrase_fd, options->timeout, options->flags)) tries--; else tries = 0;