path: root/include/crypto/internal
diff options
authorHerbert Xu <herbert@gondor.apana.org.au>2016-07-12 13:17:33 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2016-07-18 17:35:38 +0800
commit7a530aa9cf3f282b6b123b9296dfce80ed8f068e (patch)
tree79da5ff76d31f64f052f684663d69c331b85d98b /include/crypto/internal
parenta0129733a3f5eaa973c1ea76848d905b851548f1 (diff)
crypto: aead - Add chunk size
This patch adds a chunk size parameter to aead algorithms, just like the chunk size for skcipher algorithms. However, unlike skcipher we do not currently export this to AEAD users. It is only meant to be used by AEAD implementors for now. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal')
1 files changed, 21 insertions, 0 deletions
diff --git a/include/crypto/internal/aead.h b/include/crypto/internal/aead.h
index da3864991d4c..6ad8e31d3868 100644
--- a/include/crypto/internal/aead.h
+++ b/include/crypto/internal/aead.h
@@ -159,6 +159,27 @@ static inline struct aead_request *aead_get_backlog(struct aead_queue *queue)
return req ? container_of(req, struct aead_request, base) : NULL;
+static inline unsigned int crypto_aead_alg_chunksize(struct aead_alg *alg)
+ return alg->chunksize;
+ * crypto_aead_chunksize() - obtain chunk size
+ * @tfm: cipher handle
+ *
+ * The block size is set to one for ciphers such as CCM. However,
+ * you still need to provide incremental updates in multiples of
+ * the underlying block size as the IV does not have sub-block
+ * granularity. This is known in this API as the chunk size.
+ *
+ * Return: chunk size in bytes
+ */
+static inline unsigned int crypto_aead_chunksize(struct crypto_aead *tfm)
+ return crypto_aead_alg_chunksize(crypto_aead_alg(tfm));
int crypto_register_aead(struct aead_alg *alg);
void crypto_unregister_aead(struct aead_alg *alg);
int crypto_register_aeads(struct aead_alg *algs, int count);