diff options
author | Eric Biggers <ebiggers@google.com> | 2023-10-28 21:59:23 -0700 |
---|---|---|
committer | Mike Snitzer <snitzer@kernel.org> | 2023-10-31 11:06:21 -0400 |
commit | 6d0ee3b68092ef556703d7827ead3d1b7d275399 (patch) | |
tree | fee1f4e5ac9acf6e323912d9284bccd314f9c55b /drivers | |
parent | a951104333bd25bb6e5d0f5bee9cbf155b66fac1 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm-crypt.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 8a03b3590733..4b5c54d0c51a 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -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; } |