summaryrefslogtreecommitdiff
path: root/crypto/aead.c
diff options
context:
space:
mode:
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
commit2cf5158c21f212c738357bbd0fd97e0a00143ecc (patch)
tree1a5bab6afd5ff195ef738421a9b616a54511c44c /crypto/aead.c
parent23ee573fbc1c828642463c4784476f00693f87b9 (diff)
downloadlinux-crypto-2cf5158c21f212c738357bbd0fd97e0a00143ecc.tar.gz
linux-crypto-2cf5158c21f212c738357bbd0fd97e0a00143ecc.zip
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 'crypto/aead.c')
-rw-r--r--crypto/aead.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/aead.c b/crypto/aead.c
index 9b18a1e4..b155cbc3 100644
--- a/crypto/aead.c
+++ b/crypto/aead.c
@@ -346,9 +346,13 @@ static int aead_prepare_alg(struct aead_alg *alg)
{
struct crypto_alg *base = &alg->base;
- if (max(alg->maxauthsize, alg->ivsize) > PAGE_SIZE / 8)
+ if (max3(alg->maxauthsize, alg->ivsize, alg->chunksize) >
+ PAGE_SIZE / 8)
return -EINVAL;
+ if (!alg->chunksize)
+ alg->chunksize = base->cra_blocksize;
+
base->cra_type = &crypto_aead_type;
base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK;
base->cra_flags |= CRYPTO_ALG_TYPE_AEAD;