summaryrefslogtreecommitdiffstats
path: root/fs/ubifs
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2023-10-29 06:03:55 +0100
committerRichard Weinberger <richard@nod.at>2024-01-05 16:29:53 +0100
commit738fadaa549797c777650ac8d0d433fdc20152e3 (patch)
treea0ab2d7fe99c255694e776a6d432f81e9a026fc5 /fs/ubifs
parentLinux 6.7-rc7 (diff)
downloadlinux-738fadaa549797c777650ac8d0d433fdc20152e3.tar.xz
linux-738fadaa549797c777650ac8d0d433fdc20152e3.zip
ubifs: use crypto_shash_tfm_digest() in ubifs_hmac_wkm()
Simplify ubifs_hmac_wkm() by using crypto_shash_tfm_digest() instead of an alloc+init+update+final sequence. This should also improve performance. Signed-off-by: Eric Biggers <ebiggers@google.com> Tested-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs')
-rw-r--r--fs/ubifs/auth.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/fs/ubifs/auth.c b/fs/ubifs/auth.c
index 0d561ecb6869..5c414d896c9b 100644
--- a/fs/ubifs/auth.c
+++ b/fs/ubifs/auth.c
@@ -507,28 +507,13 @@ out:
*/
int ubifs_hmac_wkm(struct ubifs_info *c, u8 *hmac)
{
- SHASH_DESC_ON_STACK(shash, c->hmac_tfm);
- int err;
const char well_known_message[] = "UBIFS";
if (!ubifs_authenticated(c))
return 0;
- shash->tfm = c->hmac_tfm;
-
- err = crypto_shash_init(shash);
- if (err)
- return err;
-
- err = crypto_shash_update(shash, well_known_message,
- sizeof(well_known_message) - 1);
- if (err < 0)
- return err;
-
- err = crypto_shash_final(shash, hmac);
- if (err)
- return err;
- return 0;
+ return crypto_shash_tfm_digest(c->hmac_tfm, well_known_message,
+ sizeof(well_known_message) - 1, hmac);
}
/*