mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-07 08:50:05 +01:00
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:
12
lib/setup.c
12
lib/setup.c
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user