mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
dm crypt: use crypto_shash_digest() in crypt_iv_tcw_whitening()
Simplify crypt_iv_tcw_whitening() by using crypto_shash_digest() instead of an init+update+final sequence. This should also improve performance. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Mike Snitzer <snitzer@kernel.org>
This commit is contained in:
parent
a951104333
commit
6d0ee3b680
1 changed files with 1 additions and 7 deletions
|
@ -652,13 +652,7 @@ static int crypt_iv_tcw_whitening(struct crypt_config *cc,
|
|||
/* calculate crc32 for every 32bit part and xor it */
|
||||
desc->tfm = tcw->crc32_tfm;
|
||||
for (i = 0; i < 4; i++) {
|
||||
r = crypto_shash_init(desc);
|
||||
if (r)
|
||||
goto out;
|
||||
r = crypto_shash_update(desc, &buf[i * 4], 4);
|
||||
if (r)
|
||||
goto out;
|
||||
r = crypto_shash_final(desc, &buf[i * 4]);
|
||||
r = crypto_shash_digest(desc, &buf[i * 4], 4, &buf[i * 4]);
|
||||
if (r)
|
||||
goto out;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue