crypto: aead - Add support for new AEAD implementations
[deliverable/linux.git] / include / crypto / aead.h
index aebf57dfb903110b0ebf0c6689a29b67af9dab4e..177e6f46e2bbcdd765c4b749330ac3bf1d31d2c0 100644 (file)
@@ -17,8 +17,6 @@
 #include <linux/kernel.h>
 #include <linux/slab.h>
 
-#define aead_alg old_aead_alg
-
 /**
  * DOC: Authenticated Encryption With Associated Data (AEAD) Cipher API
  *
@@ -92,7 +90,48 @@ struct aead_givcrypt_request {
        struct aead_request areq;
 };
 
+/**
+ * struct aead_alg - AEAD cipher definition
+ * @maxauthsize: Set the maximum authentication tag size supported by the
+ *              transformation. A transformation may support smaller tag sizes.
+ *              As the authentication tag is a message digest to ensure the
+ *              integrity of the encrypted data, a consumer typically wants the
+ *              largest authentication tag possible as defined by this
+ *              variable.
+ * @setauthsize: Set authentication size for the AEAD transformation. This
+ *              function is used to specify the consumer requested size of the
+ *              authentication tag to be either generated by the transformation
+ *              during encryption or the size of the authentication tag to be
+ *              supplied during the decryption operation. This function is also
+ *              responsible for checking the authentication tag size for
+ *              validity.
+ * @setkey: see struct ablkcipher_alg
+ * @encrypt: see struct ablkcipher_alg
+ * @decrypt: see struct ablkcipher_alg
+ * @geniv: see struct ablkcipher_alg
+ * @ivsize: see struct ablkcipher_alg
+ *
+ * All fields except @ivsize is mandatory and must be filled.
+ */
+struct aead_alg {
+       int (*setkey)(struct crypto_aead *tfm, const u8 *key,
+                     unsigned int keylen);
+       int (*setauthsize)(struct crypto_aead *tfm, unsigned int authsize);
+       int (*encrypt)(struct aead_request *req);
+       int (*decrypt)(struct aead_request *req);
+
+       const char *geniv;
+
+       unsigned int ivsize;
+       unsigned int maxauthsize;
+
+       struct crypto_alg base;
+};
+
 struct crypto_aead {
+       int (*setkey)(struct crypto_aead *tfm, const u8 *key,
+                     unsigned int keylen);
+       int (*setauthsize)(struct crypto_aead *tfm, unsigned int authsize);
        int (*encrypt)(struct aead_request *req);
        int (*decrypt)(struct aead_request *req);
        int (*givencrypt)(struct aead_givcrypt_request *req);
@@ -102,6 +141,7 @@ struct crypto_aead {
 
        unsigned int ivsize;
        unsigned int authsize;
+       unsigned int maxauthsize;
        unsigned int reqsize;
 
        struct crypto_tfm base;
This page took 0.02603 seconds and 5 git commands to generate.