]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blobdiff - fs/ubifs/auth.c
Merge tag 'powerpc-5.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc...
[mirror_ubuntu-hirsute-kernel.git] / fs / ubifs / auth.c
index b758004085c4758c0127c1d51c7fc172db8c7ac1..60f43b93d06e4b479fa2543f90619ffa841d0fe7 100644 (file)
@@ -76,7 +76,6 @@ static int ubifs_hash_calc_hmac(const struct ubifs_info *c, const u8 *hash,
 int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
                             struct shash_desc *inhash)
 {
-       SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm);
        struct ubifs_auth_node *auth = node;
        u8 *hash;
        int err;
@@ -85,12 +84,16 @@ int ubifs_prepare_auth_node(struct ubifs_info *c, void *node,
        if (!hash)
                return -ENOMEM;
 
-       hash_desc->tfm = c->hash_tfm;
-       ubifs_shash_copy_state(c, inhash, hash_desc);
+       {
+               SHASH_DESC_ON_STACK(hash_desc, c->hash_tfm);
 
-       err = crypto_shash_final(hash_desc, hash);
-       if (err)
-               goto out;
+               hash_desc->tfm = c->hash_tfm;
+               ubifs_shash_copy_state(c, inhash, hash_desc);
+
+               err = crypto_shash_final(hash_desc, hash);
+               if (err)
+                       goto out;
+       }
 
        err = ubifs_hash_calc_hmac(c, hash, auth->hmac);
        if (err)
@@ -142,24 +145,6 @@ struct shash_desc *__ubifs_hash_get_desc(const struct ubifs_info *c)
        return ubifs_get_desc(c, c->hash_tfm);
 }
 
-/**
- * __ubifs_shash_final - finalize shash
- * @c: UBIFS file-system description object
- * @desc: the descriptor
- * @out: the output hash
- *
- * Simple wrapper around crypto_shash_final(), safe to be called with
- * disabled authentication.
- */
-int __ubifs_shash_final(const struct ubifs_info *c, struct shash_desc *desc,
-                       u8 *out)
-{
-       if (ubifs_authenticated(c))
-               return crypto_shash_final(desc, out);
-
-       return 0;
-}
-
 /**
  * ubifs_bad_hash - Report hash mismatches
  * @c: UBIFS file-system description object