]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
crypto: ahash - make hash walk functions from ahash.c public
authorHarald Freudenberger <freude@linux.ibm.com>
Tue, 17 Jun 2025 13:44:35 +0000 (15:44 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 26 Jun 2025 10:52:33 +0000 (18:52 +0800)
Make the hash walk functions
  crypto_hash_walk_done()
  crypto_hash_walk_first()
  crypto_hash_walk_last()
public again.
These functions had been removed from the header file
include/crypto/internal/hash.h with commit 7fa481734016
("crypto: ahash - make hash walk functions private to ahash.c")
as there was no crypto algorithm code using them.

With the upcoming crypto implementation for s390 phmac
these functions will be exploited and thus need to be
public within the kernel again.

Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
Acked-by: Holger Dengler <dengler@linux.ibm.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/ahash.c
include/crypto/internal/hash.h

index 7a51e0cf9322b7e55350bb26a5327ed4c57a6d77..00a5e36f710b0aa6e968786ee6f6c69bfa37f324 100644 (file)
 
 #define CRYPTO_ALG_TYPE_AHASH_MASK     0x0000000e
 
-struct crypto_hash_walk {
-       const char *data;
-
-       unsigned int offset;
-       unsigned int flags;
-
-       struct page *pg;
-       unsigned int entrylen;
-
-       unsigned int total;
-       struct scatterlist *sg;
-};
-
 static int ahash_def_finup(struct ahash_request *req);
 
 static inline bool crypto_ahash_block_only(struct crypto_ahash *tfm)
@@ -112,8 +99,8 @@ static int hash_walk_new_entry(struct crypto_hash_walk *walk)
        return hash_walk_next(walk);
 }
 
-static int crypto_hash_walk_first(struct ahash_request *req,
-                                 struct crypto_hash_walk *walk)
+int crypto_hash_walk_first(struct ahash_request *req,
+                          struct crypto_hash_walk *walk)
 {
        walk->total = req->nbytes;
        walk->entrylen = 0;
@@ -133,8 +120,9 @@ static int crypto_hash_walk_first(struct ahash_request *req,
 
        return hash_walk_new_entry(walk);
 }
+EXPORT_SYMBOL_GPL(crypto_hash_walk_first);
 
-static int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
+int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
 {
        if ((walk->flags & CRYPTO_AHASH_REQ_VIRT))
                return err;
@@ -160,11 +148,7 @@ static int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
 
        return hash_walk_new_entry(walk);
 }
-
-static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
-{
-       return !(walk->entrylen | walk->total);
-}
+EXPORT_SYMBOL_GPL(crypto_hash_walk_done);
 
 /*
  * For an ahash tfm that is using an shash algorithm (instead of an ahash
index f052afa6e7b0c33e5be3df95c825f96d0ad44d4a..2456d6ea73f0a8f7621ec9b22ed30f7d8af9d4a0 100644 (file)
                 __##name##_req, (req))
 
 struct ahash_request;
+struct scatterlist;
+
+struct crypto_hash_walk {
+       const char *data;
+
+       unsigned int offset;
+       unsigned int flags;
+
+       struct page *pg;
+       unsigned int entrylen;
+
+       unsigned int total;
+       struct scatterlist *sg;
+};
 
 struct ahash_instance {
        void (*free)(struct ahash_instance *inst);
@@ -61,6 +75,15 @@ struct crypto_shash_spawn {
        struct crypto_spawn base;
 };
 
+int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
+int crypto_hash_walk_first(struct ahash_request *req,
+                          struct crypto_hash_walk *walk);
+
+static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
+{
+       return !(walk->entrylen | walk->total);
+}
+
 int crypto_register_ahash(struct ahash_alg *alg);
 void crypto_unregister_ahash(struct ahash_alg *alg);
 int crypto_register_ahashes(struct ahash_alg *algs, int count);