summaryrefslogtreecommitdiff
path: root/include/crypto/aead.h
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-28 17:07:53 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2015-06-03 05:48:33 +0300
commit5eb8ec6dc857d5027bc8cf7268a199107a583ae5 (patch)
tree10e5d26c2b95a199307219cd78838c5ab1fd251d /include/crypto/aead.h
parentaddfda2fc2ed2fcd7896ef689aa75a7d35a7579b (diff)
downloadlinux-5eb8ec6dc857d5027bc8cf7268a199107a583ae5.tar.xz
crypto: aead - Add type-safe init/exit functions
As it stands the only non-type safe functions left in the new AEAD interface are the cra_init/cra_exit functions. It means exposing the ugly __crypto_aead_cast to every AEAD implementor. This patch adds type-safe init/exit functions to AEAD. Existing algorithms are unaffected while new implementations can simply fill in these two instead of cra_init/cra_exit. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/aead.h')
-rw-r--r--include/crypto/aead.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/crypto/aead.h b/include/crypto/aead.h
index 1a273bc5656c..5cb0066be30b 100644
--- a/include/crypto/aead.h
+++ b/include/crypto/aead.h
@@ -109,6 +109,17 @@ struct aead_givcrypt_request {
* @decrypt: see struct ablkcipher_alg
* @geniv: see struct ablkcipher_alg
* @ivsize: see struct ablkcipher_alg
+ * @init: Initialize the cryptographic transformation object. This function
+ * is used to initialize the cryptographic transformation object.
+ * This function is called only once at the instantiation time, right
+ * after the transformation context was allocated. In case the
+ * cryptographic hardware has some special requirements which need to
+ * be handled by software, this function shall check for the precise
+ * requirement of the transformation and put any software fallbacks
+ * in place.
+ * @exit: Deinitialize the cryptographic transformation object. This is a
+ * counterpart to @init, used to remove various changes set in
+ * @init.
*
* All fields except @ivsize is mandatory and must be filled.
*/
@@ -118,6 +129,8 @@ struct aead_alg {
int (*setauthsize)(struct crypto_aead *tfm, unsigned int authsize);
int (*encrypt)(struct aead_request *req);
int (*decrypt)(struct aead_request *req);
+ int (*init)(struct crypto_aead *tfm);
+ void (*exit)(struct crypto_aead *tfm);
const char *geniv;