diff options
author | Eric Biggers <ebiggers@google.com> | 2017-01-10 16:47:49 -0800 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2017-02-10 20:08:30 +0000 |
commit | c8bb10b1eec8156fe3efd1543b6431c32434ba28 (patch) | |
tree | f3c3ad9c230d76feb1adb1b01e2b2f89e1472368 /include/crypto/internal/hash.h | |
parent | 93867d9bc5c10fca7d6e75b57a8a4b8171a8dfe8 (diff) |
ANDROID: crypto: shash - Add crypto_grab_shash() and crypto_spawn_shash_alg()
Analogous to crypto_grab_skcipher() and crypto_spawn_skcipher_alg(),
these are useful for algorithms that need to use a shash sub-algorithm,
possibly in addition to other sub-algorithms.
Bug: 32975945
Signed-off-by: Eric Biggers <ebiggers@google.com>
Change-Id: I44e5a519d73f5f839e3b6ecbf8c66e36ec569557
Diffstat (limited to 'include/crypto/internal/hash.h')
-rw-r--r-- | include/crypto/internal/hash.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/crypto/internal/hash.h b/include/crypto/internal/hash.h index 3b4af1d7c7e9..476d99d0edb7 100644 --- a/include/crypto/internal/hash.h +++ b/include/crypto/internal/hash.h @@ -102,6 +102,8 @@ int shash_register_instance(struct crypto_template *tmpl, struct shash_instance *inst); void shash_free_instance(struct crypto_instance *inst); +int crypto_grab_shash(struct crypto_shash_spawn *spawn, + const char *name, u32 type, u32 mask); int crypto_init_shash_spawn(struct crypto_shash_spawn *spawn, struct shash_alg *alg, struct crypto_instance *inst); @@ -111,6 +113,12 @@ static inline void crypto_drop_shash(struct crypto_shash_spawn *spawn) crypto_drop_spawn(&spawn->base); } +static inline struct shash_alg *crypto_spawn_shash_alg( + struct crypto_shash_spawn *spawn) +{ + return container_of(spawn->base.alg, struct shash_alg, base); +} + struct shash_alg *shash_attr_alg(struct rtattr *rta, u32 type, u32 mask); int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc); |