aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto/internal
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2014-05-21 08:56:12 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2014-05-21 08:56:12 -0400
commit75ecb231ff45b54afa9f4ec9137965c3c00868f4 (patch)
treeeb185e64a01a81de14fdc3e380f7273b09bf76a4 /include/crypto/internal
parent0118a552137506a68ac062981967d8b5147e6028 (diff)
crypto: hash - Add real ahash walk interface
Although the existing hash walk interface has already been used by a number of ahash crypto drivers, it turns out that none of them were really asynchronous. They were all essentially polling for completion. That's why nobody has noticed until now that the walk interface couldn't work with a real asynchronous driver since the memory is mapped using kmap_atomic. As we now have a use-case for a real ahash implementation on x86, this patch creates a minimal ahash walk interface. Basically it just calls kmap instead of kmap_atomic and does away with the crypto_yield call. Real ahash crypto drivers don't need to yield since by definition they won't be hogging the CPU. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal')
-rw-r--r--include/crypto/internal/hash.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 821eae8cbd8c..9b6f32a6cad1 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -55,15 +55,28 @@ extern const struct crypto_type crypto_ahash_type;
55int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err); 55int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
56int crypto_hash_walk_first(struct ahash_request *req, 56int crypto_hash_walk_first(struct ahash_request *req,
57 struct crypto_hash_walk *walk); 57 struct crypto_hash_walk *walk);
58int crypto_ahash_walk_first(struct ahash_request *req,
59 struct crypto_hash_walk *walk);
58int crypto_hash_walk_first_compat(struct hash_desc *hdesc, 60int crypto_hash_walk_first_compat(struct hash_desc *hdesc,
59 struct crypto_hash_walk *walk, 61 struct crypto_hash_walk *walk,
60 struct scatterlist *sg, unsigned int len); 62 struct scatterlist *sg, unsigned int len);
61 63
64static inline int crypto_ahash_walk_done(struct crypto_hash_walk *walk,
65 int err)
66{
67 return crypto_hash_walk_done(walk, err);
68}
69
62static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk) 70static inline int crypto_hash_walk_last(struct crypto_hash_walk *walk)
63{ 71{
64 return !(walk->entrylen | walk->total); 72 return !(walk->entrylen | walk->total);
65} 73}
66 74
75static inline int crypto_ahash_walk_last(struct crypto_hash_walk *walk)
76{
77 return crypto_hash_walk_last(walk);
78}
79
67int crypto_register_ahash(struct ahash_alg *alg); 80int crypto_register_ahash(struct ahash_alg *alg);
68int crypto_unregister_ahash(struct ahash_alg *alg); 81int crypto_unregister_ahash(struct ahash_alg *alg);
69int ahash_register_instance(struct crypto_template *tmpl, 82int ahash_register_instance(struct crypto_template *tmpl,