Clean up plain password hashing, do not ignore error in crypto backend.

(New backend can fail there).

git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@451 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
Milan Broz
2011-03-13 23:50:49 +00:00
parent e1cc40df7e
commit 25512d89ae
4 changed files with 66 additions and 45 deletions

View File

@@ -124,6 +124,7 @@ static char *process_key(struct crypt_device *cd, const char *hash_name,
const char *pass, size_t passLen)
{
char *key;
int r;
if (!key_size)
return NULL;
@@ -145,9 +146,14 @@ static char *process_key(struct crypt_device *cd, const char *hash_name,
/* key is coming from tty, fd or binary stdin */
if (hash_name) {
if (crypt_plain_hash(cd, hash_name, key, key_size, pass, passLen) < 0) {
log_err(cd, _("Key processing error (using hash algorithm %s).\n"),
hash_name);
r = crypt_plain_hash(cd, hash_name, key, key_size, pass, passLen);
if (r < 0) {
if (r == -ENOENT)
log_err(cd, _("Hash algorithm %s not supported.\n"),
hash_name);
else
log_err(cd, _("Key processing error (using hash %s).\n"),
hash_name);
crypt_safe_free(key);
return NULL;
}