[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200807162010.18979-15-andrei.botila@oss.nxp.com>
Date: Fri, 7 Aug 2020 19:20:02 +0300
From: Andrei Botila <andrei.botila@....nxp.com>
To: Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>
Cc: linux-crypto@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
linux-s390@...r.kernel.org, x86@...nel.org,
linux-arm-kernel@...s.com, Andrei Botila <andrei.botila@....com>,
Srikanth Jampala <jsrikanth@...vell.com>,
Nagadheeraj Rottela <rnagadheeraj@...vell.com>
Subject: [PATCH 14/22] crypto: cavium/nitrox - add check for xts input length equal to zero
From: Andrei Botila <andrei.botila@....com>
Standardize the way input lengths equal to 0 are handled in all skcipher
algorithms. All the algorithms return 0 for input lengths equal to zero.
Cc: Srikanth Jampala <jsrikanth@...vell.com>
Cc: Nagadheeraj Rottela <rnagadheeraj@...vell.com>
Signed-off-by: Andrei Botila <andrei.botila@....com>
---
drivers/crypto/cavium/nitrox/nitrox_skcipher.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/crypto/cavium/nitrox/nitrox_skcipher.c b/drivers/crypto/cavium/nitrox/nitrox_skcipher.c
index a553ac65f324..d76589ebe354 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_skcipher.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_skcipher.c
@@ -249,10 +249,16 @@ static int nitrox_skcipher_crypt(struct skcipher_request *skreq, bool enc)
struct crypto_skcipher *cipher = crypto_skcipher_reqtfm(skreq);
struct nitrox_crypto_ctx *nctx = crypto_skcipher_ctx(cipher);
struct nitrox_kcrypt_request *nkreq = skcipher_request_ctx(skreq);
+ struct crypto_tfm *tfm = crypto_skcipher_tfm(cipher);
int ivsize = crypto_skcipher_ivsize(cipher);
struct se_crypto_request *creq;
+ const char *name;
int ret;
+ name = crypto_tfm_alg_name(tfm);
+ if (!skreq->cryptlen && flexi_cipher_type(name) == CIPHER_AES_XTS)
+ return 0;
+
creq = &nkreq->creq;
creq->flags = skreq->base.flags;
creq->gfp = (skreq->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) ?
--
2.17.1
Powered by blists - more mailing lists