diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2019-09-10 11:42:05 +1000 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-10-05 01:04:31 +1000 |
commit | 5b0fe9552336338acb52756daf65dd7a4eeca73f (patch) | |
tree | 7d2d1d608bf78d1944add60e1b77deadadde903e /include/crypto/internal | |
parent | 7a627db9cafdb173e255ec8bf67fd5ba91ae0664 (diff) | |
download | linux-stable-5b0fe9552336338acb52756daf65dd7a4eeca73f.tar.gz linux-stable-5b0fe9552336338acb52756daf65dd7a4eeca73f.tar.bz2 linux-stable-5b0fe9552336338acb52756daf65dd7a4eeca73f.zip |
crypto: algif_skcipher - Use chunksize instead of blocksize
When algif_skcipher does a partial operation it always process data
that is a multiple of blocksize. However, for algorithms such as
CTR this is wrong because even though it can process any number of
bytes overall, the partial block must come at the very end and not
in the middle.
This is exactly what chunksize is meant to describe so this patch
changes blocksize to chunksize.
Fixes: 8ff590903d5f ("crypto: algif_skcipher - User-space...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto/internal')
-rw-r--r-- | include/crypto/internal/skcipher.h | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/include/crypto/internal/skcipher.h b/include/crypto/internal/skcipher.h index 734b6f7081b8..3175dfeaed2c 100644 --- a/include/crypto/internal/skcipher.h +++ b/include/crypto/internal/skcipher.h @@ -205,19 +205,6 @@ static inline unsigned int crypto_skcipher_alg_max_keysize( return alg->max_keysize; } -static inline unsigned int crypto_skcipher_alg_chunksize( - struct skcipher_alg *alg) -{ - if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == - CRYPTO_ALG_TYPE_BLKCIPHER) - return alg->base.cra_blocksize; - - if (alg->base.cra_ablkcipher.encrypt) - return alg->base.cra_blocksize; - - return alg->chunksize; -} - static inline unsigned int crypto_skcipher_alg_walksize( struct skcipher_alg *alg) { @@ -232,23 +219,6 @@ static inline unsigned int crypto_skcipher_alg_walksize( } /** - * crypto_skcipher_chunksize() - obtain chunk size - * @tfm: cipher handle - * - * The block size is set to one for ciphers such as CTR. 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_skcipher_chunksize( - struct crypto_skcipher *tfm) -{ - return crypto_skcipher_alg_chunksize(crypto_skcipher_alg(tfm)); -} - -/** * crypto_skcipher_walksize() - obtain walk size * @tfm: cipher handle * |