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:
committed by
Mike Snitzer
parent
a951104333
commit
6d0ee3b680
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user