summaryrefslogtreecommitdiff
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2023-10-29 07:57:56 +0300
committerLeon Romanovsky <leon@kernel.org>2023-11-13 11:46:04 +0300
commit057a30168175048be9e9b30f0cafd26f5043eb07 (patch)
tree1b178aa811c143bf60889b4cf2cbd8b1a38bcf80 /drivers/infiniband
parent9aac6c05a56289be7bb2ad4b6c34486dfa2d31eb (diff)
downloadlinux-057a30168175048be9e9b30f0cafd26f5043eb07.tar.xz
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: Eric Biggers <ebiggers@google.com> Link: https://lore.kernel.org/r/20231029045756.153943-1-ebiggers@kernel.org Signed-off-by: Leon Romanovsky <leon@kernel.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/hw/irdma/utils.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/irdma/utils.c b/drivers/infiniband/hw/irdma/utils.c
index 916bfe2a91eb..0422787592d8 100644
--- a/drivers/infiniband/hw/irdma/utils.c
+++ b/drivers/infiniband/hw/irdma/utils.c
@@ -1393,17 +1393,12 @@ int irdma_ieq_check_mpacrc(struct shash_desc *desc, void *addr, u32 len,
u32 val)
{
u32 crc = 0;
- int ret;
- int ret_code = 0;
- crypto_shash_init(desc);
- ret = crypto_shash_update(desc, addr, len);
- if (!ret)
- crypto_shash_final(desc, (u8 *)&crc);
+ crypto_shash_digest(desc, addr, len, (u8 *)&crc);
if (crc != val)
- ret_code = -EINVAL;
+ return -EINVAL;
- return ret_code;
+ return 0;
}
/**