diff options
author | Eric Biggers <ebiggers@google.com> | 2020-05-01 22:31:18 -0700 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2020-05-08 15:32:15 +1000 |
commit | f80df3851246ce5b9b7dd9625f3438e0f39383f1 (patch) | |
tree | 127df489a32f5d5179e33211550f5046978e8294 /fs/ubifs/auth.c | |
parent | ea794db2646a3660647dd2f2c8f6f2770acc3596 (diff) | |
download | linux-f80df3851246ce5b9b7dd9625f3438e0f39383f1.tar.bz2 |
ubifs: use crypto_shash_tfm_digest()
Instead of manually allocating a 'struct shash_desc' on the stack and
calling crypto_shash_digest(), switch to using the new helper function
crypto_shash_tfm_digest() which does this for us.
Cc: linux-mtd@lists.infradead.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'fs/ubifs/auth.c')
-rw-r--r-- | fs/ubifs/auth.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/fs/ubifs/auth.c b/fs/ubifs/auth.c index 8cdbd53d780c..1e374baafc52 100644 --- a/fs/ubifs/auth.c +++ b/fs/ubifs/auth.c @@ -31,15 +31,9 @@ int __ubifs_node_calc_hash(const struct ubifs_info *c, const void *node, u8 *hash) { const struct ubifs_ch *ch = node; - SHASH_DESC_ON_STACK(shash, c->hash_tfm); - int err; - - shash->tfm = c->hash_tfm; - err = crypto_shash_digest(shash, node, le32_to_cpu(ch->len), hash); - if (err < 0) - return err; - return 0; + return crypto_shash_tfm_digest(c->hash_tfm, node, le32_to_cpu(ch->len), + hash); } /** @@ -53,15 +47,7 @@ int __ubifs_node_calc_hash(const struct ubifs_info *c, const void *node, static int ubifs_hash_calc_hmac(const struct ubifs_info *c, const u8 *hash, u8 *hmac) { - SHASH_DESC_ON_STACK(shash, c->hmac_tfm); - int err; - - shash->tfm = c->hmac_tfm; - - err = crypto_shash_digest(shash, hash, c->hash_len, hmac); - if (err < 0) - return err; - return 0; + return crypto_shash_tfm_digest(c->hmac_tfm, hash, c->hash_len, hmac); } /** |