From: Milan Broz Date: Fri, 25 Mar 2011 16:10:56 +0000 (+0000) Subject: Print error if hash is not supported. X-Git-Tag: upstream/1.6~472 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6371786093da4b8991abb2ffb61054d2972d0e44;p=platform%2Fupstream%2Fcryptsetup.git Print error if hash is not supported. git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@485 36d66b0a-2a48-0410-832c-cd162a569da5 --- diff --git a/lib/loopaes/loopaes.c b/lib/loopaes/loopaes.c index 846002c..36d8164 100644 --- a/lib/loopaes/loopaes.c +++ b/lib/loopaes/loopaes.c @@ -67,7 +67,8 @@ static int hash_key(const char *src, size_t src_len, return r; } -static int hash_keys(struct volume_key **vk, +static int hash_keys(struct crypt_device *cd, + struct volume_key **vk, const char **input_keys, unsigned int keys_count, unsigned int key_len_output) @@ -80,8 +81,11 @@ static int hash_keys(struct volume_key **vk, tweak = get_tweak(keys_count); key_len_input = strlen(input_keys[0]); - if (!keys_count || !key_len_output || !hash_name || !key_len_input) + if (!keys_count || !key_len_output || !hash_name || !key_len_input) { + log_err(cd, _("Key processing error (using hash %s).\n"), + hash_name ?: "[none]"); return -EINVAL; + } *vk = crypt_alloc_volume_key(key_len_output * keys_count, NULL); if (!*vk) @@ -170,7 +174,7 @@ int LOOPAES_parse_keyfile(struct crypt_device *cd, } *keys_count = key_index; - return hash_keys(vk, keys, key_index, crypt_get_volume_key_size(cd)); + return hash_keys(cd, vk, keys, key_index, crypt_get_volume_key_size(cd)); } int LOOPAES_activate(struct crypt_device *cd,