Skip to content

Commit 2f8839e

Browse files
hfreudeherbertx
authored andcommitted
crypto: ahash - make hash walk functions from ahash.c public
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 7fa4817 ("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>
1 parent fa13f1d commit 2f8839e

File tree

2 files changed

+28
-21
lines changed

2 files changed

+28
-21
lines changed

crypto/ahash.c

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,6 @@
2929

3030
#define CRYPTO_ALG_TYPE_AHASH_MASK 0x0000000e
3131

32-
struct crypto_hash_walk {
33-
const char *data;
34-
35-
unsigned int offset;
36-
unsigned int flags;
37-
38-
struct page *pg;
39-
unsigned int entrylen;
40-
41-
unsigned int total;
42-
struct scatterlist *sg;
43-
};
44-
4532
static int ahash_def_finup(struct ahash_request *req);
4633

4734
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)
11299
return hash_walk_next(walk);
113100
}
114101

115-
static int crypto_hash_walk_first(struct ahash_request *req,
116-
struct crypto_hash_walk *walk)
102+
int crypto_hash_walk_first(struct ahash_request *req,
103+
struct crypto_hash_walk *walk)
117104
{
118105
walk->total = req->nbytes;
119106
walk->entrylen = 0;
@@ -133,8 +120,9 @@ static int crypto_hash_walk_first(struct ahash_request *req,
133120

134121
return hash_walk_new_entry(walk);
135122
}
123+
EXPORT_SYMBOL_GPL(crypto_hash_walk_first);
136124

137-
static int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
125+
int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
138126
{
139127
if ((walk->flags & CRYPTO_AHASH_REQ_VIRT))
140128
return err;
@@ -160,11 +148,7 @@ static int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
160148

161149
return hash_walk_new_entry(walk);
162150
}
163-
164-
static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
165-
{
166-
return !(walk->entrylen | walk->total);
167-
}
151+
EXPORT_SYMBOL_GPL(crypto_hash_walk_done);
168152

169153
/*
170154
* For an ahash tfm that is using an shash algorithm (instead of an ahash

include/crypto/internal/hash.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,20 @@
3030
__##name##_req, (req))
3131

3232
struct ahash_request;
33+
struct scatterlist;
34+
35+
struct crypto_hash_walk {
36+
const char *data;
37+
38+
unsigned int offset;
39+
unsigned int flags;
40+
41+
struct page *pg;
42+
unsigned int entrylen;
43+
44+
unsigned int total;
45+
struct scatterlist *sg;
46+
};
3347

3448
struct ahash_instance {
3549
void (*free)(struct ahash_instance *inst);
@@ -61,6 +75,15 @@ struct crypto_shash_spawn {
6175
struct crypto_spawn base;
6276
};
6377

78+
int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
79+
int crypto_hash_walk_first(struct ahash_request *req,
80+
struct crypto_hash_walk *walk);
81+
82+
static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
83+
{
84+
return !(walk->entrylen | walk->total);
85+
}
86+
6487
int crypto_register_ahash(struct ahash_alg *alg);
6588
void crypto_unregister_ahash(struct ahash_alg *alg);
6689
int crypto_register_ahashes(struct ahash_alg *algs, int count);

0 commit comments

Comments
 (0)