summaryrefslogtreecommitdiffstats
path: root/include/crypto/internal
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-21 15:11:08 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2015-05-22 11:25:54 +0800
commit63293c61133447249d7e5b49d333f68825d30e43 (patch)
tree5525d14473d05acf8eb38b8f8e0b8f33acec399f /include/crypto/internal
parent56fcf73a29007aa7bec2e3fc5da2962f3f72d610 (diff)
downloadtalos-op-linux-63293c61133447249d7e5b49d333f68825d30e43.tar.gz
talos-op-linux-63293c61133447249d7e5b49d333f68825d30e43.zip
crypto: aead - Add support for new AEAD implementations
This patch adds the basic structure of the new AEAD type. Unlike the current version, there is no longer any concept of geniv. IV generation will still be carried out by wrappers but they will be normal AEAD algorithms that simply take the IPsec sequence number as the IV. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal')
-rw-r--r--include/crypto/internal/aead.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h
index 4614f795f8bc..6cd31519c4f6 100644
--- a/include/crypto/internal/aead.h
+++ b/include/crypto/internal/aead.h
@@ -19,6 +19,10 @@
struct rtattr;
+struct aead_instance {
+ struct aead_alg alg;
+};
+
struct crypto_aead_spawn {
struct crypto_spawn base;
};
@@ -33,7 +37,8 @@ static inline struct old_aead_alg *crypto_old_aead_alg(struct crypto_aead *tfm)
static inline struct aead_alg *crypto_aead_alg(struct crypto_aead *tfm)
{
- return &crypto_aead_tfm(tfm)->__crt_alg->cra_aead;
+ return container_of(crypto_aead_tfm(tfm)->__crt_alg,
+ struct aead_alg, base);
}
static inline void *crypto_aead_ctx(struct crypto_aead *tfm)
@@ -47,6 +52,22 @@ static inline struct crypto_instance *crypto_aead_alg_instance(
return crypto_tfm_alg_instance(&aead->base);
}
+static inline struct crypto_instance *aead_crypto_instance(
+ struct aead_instance *inst)
+{
+ return container_of(&inst->alg.base, struct crypto_instance, alg);
+}
+
+static inline struct aead_instance *aead_instance(struct crypto_instance *inst)
+{
+ return container_of(&inst->alg, struct aead_instance, alg.base);
+}
+
+static inline void *aead_instance_ctx(struct aead_instance *inst)
+{
+ return crypto_instance_ctx(aead_crypto_instance(inst));
+}
+
static inline void *aead_request_ctx(struct aead_request *req)
{
return req->__ctx;
@@ -84,6 +105,12 @@ static inline struct crypto_alg *crypto_aead_spawn_alg(
return spawn->base.alg;
}
+static inline struct aead_alg *crypto_spawn_aead_alg(
+ struct crypto_aead_spawn *spawn)
+{
+ return container_of(spawn->base.alg, struct aead_alg, base);
+}
+
static inline struct crypto_aead *crypto_spawn_aead(
struct crypto_aead_spawn *spawn)
{
@@ -121,8 +148,13 @@ static inline void crypto_aead_set_reqsize(struct crypto_aead *aead,
static inline unsigned int crypto_aead_maxauthsize(struct crypto_aead *aead)
{
- return crypto_old_aead_alg(aead)->maxauthsize;
+ return aead->maxauthsize;
}
+int crypto_register_aead(struct aead_alg *alg);
+int crypto_unregister_aead(struct aead_alg *alg);
+int aead_register_instance(struct crypto_template *tmpl,
+ struct aead_instance *inst);
+
#endif /* _CRYPTO_INTERNAL_AEAD_H */
OpenPOWER on IntegriCloud