diff options
Diffstat (limited to 'include/crypto/skcipher.h')
-rw-r--r-- | include/crypto/skcipher.h | 60 |
1 files changed, 15 insertions, 45 deletions
diff --git a/include/crypto/skcipher.h b/include/crypto/skcipher.h index ce7fa0973580..26be16cc46e3 100644 --- a/include/crypto/skcipher.h +++ b/include/crypto/skcipher.h @@ -288,20 +288,23 @@ static inline unsigned int crypto_sync_skcipher_ivsize( return crypto_skcipher_ivsize(&tfm->base); } -static inline unsigned int crypto_skcipher_alg_chunksize( - struct skcipher_alg *alg) +/** + * crypto_skcipher_blocksize() - obtain block size of cipher + * @tfm: cipher handle + * + * The block size for the skcipher referenced with the cipher handle is + * returned. The caller may use that information to allocate appropriate + * memory for the data returned by the encryption or decryption operation + * + * Return: block size of cipher + */ +static inline unsigned int crypto_skcipher_blocksize( + struct crypto_skcipher *tfm) { - 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; + return crypto_tfm_alg_blocksize(crypto_skcipher_tfm(tfm)); } -static inline unsigned int crypto_skcipher_alg_walksize( +static inline unsigned int crypto_skcipher_alg_chunksize( struct skcipher_alg *alg) { if ((alg->base.cra_flags & CRYPTO_ALG_TYPE_MASK) == @@ -311,7 +314,7 @@ static inline unsigned int crypto_skcipher_alg_walksize( if (alg->base.cra_ablkcipher.encrypt) return alg->base.cra_blocksize; - return alg->walksize; + return alg->chunksize; } /** @@ -331,39 +334,6 @@ static inline unsigned int crypto_skcipher_chunksize( return crypto_skcipher_alg_chunksize(crypto_skcipher_alg(tfm)); } -/** - * crypto_skcipher_walksize() - obtain walk size - * @tfm: cipher handle - * - * In some cases, algorithms can only perform optimally when operating on - * multiple blocks in parallel. This is reflected by the walksize, which - * must be a multiple of the chunksize (or equal if the concern does not - * apply) - * - * Return: walk size in bytes - */ -static inline unsigned int crypto_skcipher_walksize( - struct crypto_skcipher *tfm) -{ - return crypto_skcipher_alg_walksize(crypto_skcipher_alg(tfm)); -} - -/** - * crypto_skcipher_blocksize() - obtain block size of cipher - * @tfm: cipher handle - * - * The block size for the skcipher referenced with the cipher handle is - * returned. The caller may use that information to allocate appropriate - * memory for the data returned by the encryption or decryption operation - * - * Return: block size of cipher - */ -static inline unsigned int crypto_skcipher_blocksize( - struct crypto_skcipher *tfm) -{ - return crypto_tfm_alg_blocksize(crypto_skcipher_tfm(tfm)); -} - static inline unsigned int crypto_sync_skcipher_blocksize( struct crypto_sync_skcipher *tfm) { |