Commit 057a3016 authored by Eric Biggers's avatar Eric Biggers Committed by Leon Romanovsky

RDMA/irdma: Use crypto_shash_digest() in irdma_ieq_check_mpacrc()

Simplify irdma_ieq_check_mpacrc() by using crypto_shash_digest() instead
of an init+update+final sequence.  This should also improve performance.
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20231029045756.153943-1-ebiggers@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent 9aac6c05
...@@ -1393,17 +1393,12 @@ int irdma_ieq_check_mpacrc(struct shash_desc *desc, void *addr, u32 len, ...@@ -1393,17 +1393,12 @@ int irdma_ieq_check_mpacrc(struct shash_desc *desc, void *addr, u32 len,
u32 val) u32 val)
{ {
u32 crc = 0; u32 crc = 0;
int ret;
int ret_code = 0;
crypto_shash_init(desc); crypto_shash_digest(desc, addr, len, (u8 *)&crc);
ret = crypto_shash_update(desc, addr, len);
if (!ret)
crypto_shash_final(desc, (u8 *)&crc);
if (crc != val) if (crc != val)
ret_code = -EINVAL; return -EINVAL;
return ret_code; return 0;
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment