aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto/internal
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-11 05:48:12 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2015-05-12 22:31:53 -0400
commit5d1d65f8bea6de3d9c2c60fdfdd2da02da5ea672 (patch)
tree0ae938f7c50e7a8227f2f93087edf843b44621e5 /include/crypto/internal
parent53033d4d36b0299ef02e28155913414ec1089aac (diff)
crypto: aead - Convert top level interface to new style
This patch converts the top-level aead interface to the new style. All user-level AEAD interface code have been moved into crypto/aead.h. The allocation/free functions have switched over to the new way of allocating tfms. This patch also removes the double indrection on setkey so the indirection now exists only at the alg level. Apart from these there are no user-visible changes. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal')
-rw-r--r--include/crypto/internal/aead.h38
1 files changed, 34 insertions, 4 deletions
diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h
index 750948cf4621..a2d104aa3430 100644
--- a/include/crypto/internal/aead.h
+++ b/include/crypto/internal/aead.h
@@ -23,8 +23,40 @@ struct crypto_aead_spawn {
23 struct crypto_spawn base; 23 struct crypto_spawn base;
24}; 24};
25 25
26extern const struct crypto_type crypto_aead_type;
26extern const struct crypto_type crypto_nivaead_type; 27extern const struct crypto_type crypto_nivaead_type;
27 28
29static inline struct aead_alg *crypto_aead_alg(struct crypto_aead *tfm)
30{
31 return &crypto_aead_tfm(tfm)->__crt_alg->cra_aead;
32}
33
34static inline void *crypto_aead_ctx(struct crypto_aead *tfm)
35{
36 return crypto_tfm_ctx(&tfm->base);
37}
38
39static inline struct crypto_instance *crypto_aead_alg_instance(
40 struct crypto_aead *aead)
41{
42 return crypto_tfm_alg_instance(&aead->base);
43}
44
45static inline void *aead_request_ctx(struct aead_request *req)
46{
47 return req->__ctx;
48}
49
50static inline void aead_request_complete(struct aead_request *req, int err)
51{
52 req->base.complete(&req->base, err);
53}
54
55static inline u32 aead_request_flags(struct aead_request *req)
56{
57 return req->base.flags;
58}
59
28static inline void crypto_set_aead_spawn( 60static inline void crypto_set_aead_spawn(
29 struct crypto_aead_spawn *spawn, struct crypto_instance *inst) 61 struct crypto_aead_spawn *spawn, struct crypto_instance *inst)
30{ 62{
@@ -50,9 +82,7 @@ static inline struct crypto_alg *crypto_aead_spawn_alg(
50static inline struct crypto_aead *crypto_spawn_aead( 82static inline struct crypto_aead *crypto_spawn_aead(
51 struct crypto_aead_spawn *spawn) 83 struct crypto_aead_spawn *spawn)
52{ 84{
53 return __crypto_aead_cast( 85 return crypto_spawn_tfm2(&spawn->base);
54 crypto_spawn_tfm(&spawn->base, CRYPTO_ALG_TYPE_AEAD,
55 CRYPTO_ALG_TYPE_MASK));
56} 86}
57 87
58struct crypto_instance *aead_geniv_alloc(struct crypto_template *tmpl, 88struct crypto_instance *aead_geniv_alloc(struct crypto_template *tmpl,
@@ -64,7 +94,7 @@ void aead_geniv_exit(struct crypto_tfm *tfm);
64 94
65static inline struct crypto_aead *aead_geniv_base(struct crypto_aead *geniv) 95static inline struct crypto_aead *aead_geniv_base(struct crypto_aead *geniv)
66{ 96{
67 return crypto_aead_crt(geniv)->base; 97 return geniv->child;
68} 98}
69 99
70static inline void *aead_givcrypt_reqctx(struct aead_givcrypt_request *req) 100static inline void *aead_givcrypt_reqctx(struct aead_givcrypt_request *req)