mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-13 20:00:08 +01:00
Do not ignore errors in crypto backend (LUKS AF).
git-svn-id: https://cryptsetup.googlecode.com/svn/trunk@453 36d66b0a-2a48-0410-832c-cd162a569da5
This commit is contained in:
@@ -62,7 +62,7 @@ static int hash_key(const char *src, size_t src_len,
|
|||||||
r = crypt_hash_write(hd, src, src_len);
|
r = crypt_hash_write(hd, src, src_len);
|
||||||
if (!r)
|
if (!r)
|
||||||
r = crypt_hash_final(hd, dst, dst_len);
|
r = crypt_hash_final(hd, dst, dst_len);
|
||||||
out:
|
|
||||||
crypt_hash_destroy(hd);
|
crypt_hash_destroy(hd);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,15 +42,22 @@ static int hash_buf(const char *src, char *dst, uint32_t iv,
|
|||||||
{
|
{
|
||||||
struct crypt_hash *hd = NULL;
|
struct crypt_hash *hd = NULL;
|
||||||
char *iv_char = (char *)&iv;
|
char *iv_char = (char *)&iv;
|
||||||
|
int r;
|
||||||
|
|
||||||
iv = htonl(iv);
|
iv = htonl(iv);
|
||||||
if (crypt_hash_init(&hd, hash_name))
|
if (crypt_hash_init(&hd, hash_name))
|
||||||
return 1;
|
return -EINVAL;
|
||||||
crypt_hash_write(hd, iv_char, sizeof(uint32_t));
|
|
||||||
crypt_hash_write(hd, src, len);
|
if ((r = crypt_hash_write(hd, iv_char, sizeof(uint32_t))))
|
||||||
crypt_hash_final(hd, dst, len);
|
goto out;
|
||||||
|
|
||||||
|
if ((r = crypt_hash_write(hd, src, len)))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
r = crypt_hash_final(hd, dst, len);
|
||||||
|
out:
|
||||||
crypt_hash_destroy(hd);
|
crypt_hash_destroy(hd);
|
||||||
return 0;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* diffuse: Information spreading over the whole dataset with
|
/* diffuse: Information spreading over the whole dataset with
|
||||||
|
|||||||
Reference in New Issue
Block a user