crypto: aead - Add aead_alg_instance
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 28 May 2015 14:07:55 +0000 (22:07 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 3 Jun 2015 02:48:33 +0000 (10:48 +0800)
Now that type-safe init/exit functions exist, they often need
to access the underlying aead_instance.  So this patch adds the
helper aead_alg_instance to access aead_instance from a crypto_aead
object.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
include/crypto/internal/aead.h

index 4137330f01ab56ca0223a20258e532906468d217..f068d74da9f6381632538b7fa0e0a0573c73c4c6 100644 (file)
@@ -52,6 +52,11 @@ static inline struct aead_instance *aead_instance(struct crypto_instance *inst)
        return container_of(&inst->alg, struct aead_instance, alg.base);
 }
 
+static inline struct aead_instance *aead_alg_instance(struct crypto_aead *aead)
+{
+       return aead_instance(crypto_aead_alg_instance(aead));
+}
+
 static inline void *aead_instance_ctx(struct aead_instance *inst)
 {
        return crypto_instance_ctx(aead_crypto_instance(inst));