summaryrefslogtreecommitdiff
path: root/include/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-07-08 17:21:37 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2009-07-08 18:58:29 +0800
commit942969992d86330c9700e2cd9afe8a6bea42df78 (patch)
tree4183f307974076a606c97bf5b5c333aa4021562b /include/crypto
parent97eedce1a64a57648ac5e39f03825528c47ba72e (diff)
crypto: shash - Add spawn support
This patch adds the functions needed to create and use shash spawns, i.e., to use shash algorithms in a template. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/internal/hash.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h
index 44d3bcdce6e..6cc824b7933 100644
--- a/include/crypto/internal/hash.h
+++ b/include/crypto/internal/hash.h
@@ -38,6 +38,10 @@ struct shash_instance {
struct shash_alg alg;
};
+struct crypto_shash_spawn {
+ struct crypto_spawn base;
+};
+
extern const struct crypto_type crypto_ahash_type;
int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err);
@@ -52,6 +56,10 @@ int crypto_unregister_shash(struct shash_alg *alg);
void shash_free_instance(struct crypto_instance *inst);
+int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn,
+ struct shash_alg *alg,
+ struct crypto_instance *inst);
+
static inline void *crypto_ahash_ctx(struct crypto_ahash *tfm)
{
return crypto_tfm_ctx(&tfm->base);
@@ -106,5 +114,11 @@ static inline struct shash_instance *shash_alloc_instance(
sizeof(struct shash_alg) - sizeof(*alg));
}
+static inline struct crypto_shash *crypto_spawn_shash(
+ struct crypto_shash_spawn *spawn)
+{
+ return crypto_spawn_tfm2(&spawn->base);
+}
+
#endif /* _CRYPTO_INTERNAL_HASH_H */