From: Harald Freudenberger <freude@linux.ibm.com>
To: herbert@gondor.apana.org.au, dengler@linux.ibm.com,
ifranzki@linux.ibm.com
Cc: linux-crypto@vger.kernel.org, linux-s390@vger.kernel.org,
fcallies@linux.ibm.com
Subject: [PATCH v11 1/6] crypto: ahash - make hash walk functions from ahash.c public
Date: Thu, 22 May 2025 10:57:50 +0200 [thread overview]
Message-ID: <20250522085755.40732-2-freude@linux.ibm.com> (raw)
In-Reply-To: <20250522085755.40732-1-freude@linux.ibm.com>
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 phash
these functions will be exploited and thus need to be
public within the kernel again.
Signed-off-by: Harald Freudenberger <freude@linux.ibm.com>
---
crypto/ahash.c | 26 +++++---------------------
include/crypto/internal/hash.h | 23 +++++++++++++++++++++++
2 files changed, 28 insertions(+), 21 deletions(-)
diff --git a/crypto/ahash.c b/crypto/ahash.c
index 9f57b925b116..3344c4fee526 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -29,19 +29,6 @@
#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;
-};
-
struct ahash_save_req_state {
struct list_head head;
struct ahash_request *req0;
@@ -92,8 +79,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;
@@ -113,8 +100,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;
@@ -140,11 +128,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
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 485e22cf517e..195d6aeeede3 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -12,6 +12,20 @@
#include <crypto/hash.h>
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);
@@ -43,6 +57,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);
--
2.43.0
next prev parent reply other threads:[~2025-05-22 8:58 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-22 8:57 [PATCH v11 0/6] New s390 specific protected key hmac Harald Freudenberger
2025-05-22 8:57 ` Harald Freudenberger [this message]
2025-05-23 14:58 ` [PATCH v11 1/6] crypto: ahash - make hash walk functions from ahash.c public Holger Dengler
2025-05-22 8:57 ` [PATCH v11 2/6] s390/crypto: Add protected key hmac subfunctions for KMAC Harald Freudenberger
2025-05-23 15:00 ` Holger Dengler
2025-05-22 8:57 ` [PATCH v11 3/6] s390/crypto: New s390 specific protected key hash phmac Harald Freudenberger
2025-05-23 14:52 ` Holger Dengler
2025-05-26 14:02 ` Harald Freudenberger
2025-05-22 8:57 ` [PATCH v11 4/6] crypto: api - Add crypto_tfm_alg_get_flags() helper inline function Harald Freudenberger
2025-05-23 15:02 ` Holger Dengler
2025-05-22 8:57 ` [PATCH v11 5/6] s390/crypto: Add selftest support for phmac Harald Freudenberger
2025-05-22 9:10 ` Herbert Xu
2025-05-26 13:58 ` Harald Freudenberger
2025-05-23 14:55 ` Holger Dengler
2025-05-26 14:06 ` Harald Freudenberger
2025-05-22 8:57 ` [PATCH v11 6/6] crypto: testmgr - Enable phmac selftest Harald Freudenberger
2025-05-23 15:03 ` Holger Dengler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250522085755.40732-2-freude@linux.ibm.com \
--to=freude@linux.ibm.com \
--cc=dengler@linux.ibm.com \
--cc=fcallies@linux.ibm.com \
--cc=herbert@gondor.apana.org.au \
--cc=ifranzki@linux.ibm.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.