linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Botila <andrei.botila@oss.nxp.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>
Cc: linux-crypto@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-s390@vger.kernel.org, x86@kernel.org,
	linux-arm-kernel@axis.com, Andrei Botila <andrei.botila@nxp.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	Arnaud Ebalard <arno@natisbad.org>,
	Srujana Challa <schalla@marvell.com>
Subject: [PATCH 20/22] crypto: octeontx - add check for xts input length equal to zero
Date: Fri,  7 Aug 2020 19:20:08 +0300	[thread overview]
Message-ID: <20200807162010.18979-21-andrei.botila@oss.nxp.com> (raw)
In-Reply-To: <20200807162010.18979-1-andrei.botila@oss.nxp.com>

From: Andrei Botila <andrei.botila@nxp.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: Boris Brezillon <bbrezillon@kernel.org>
Cc: Arnaud Ebalard <arno@natisbad.org>
Cc: Srujana Challa <schalla@marvell.com>
Signed-off-by: Andrei Botila <andrei.botila@nxp.com>
---
 drivers/crypto/marvell/octeontx/otx_cptvf_algs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
index 90bb31329d4b..ec13bc3f1766 100644
--- a/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
+++ b/drivers/crypto/marvell/octeontx/otx_cptvf_algs.c
@@ -340,11 +340,16 @@ static inline int cpt_enc_dec(struct skcipher_request *req, u32 enc)
 {
 	struct crypto_skcipher *stfm = crypto_skcipher_reqtfm(req);
 	struct otx_cpt_req_ctx *rctx = skcipher_request_ctx(req);
+	struct crypto_tfm *tfm = crypto_skcipher_tfm(stfm);
+	struct otx_cpt_enc_ctx *ctx = crypto_tfm_ctx(tfm);
 	struct otx_cpt_req_info *req_info = &rctx->cpt_req;
 	u32 enc_iv_len = crypto_skcipher_ivsize(stfm);
 	struct pci_dev *pdev;
 	int status, cpu_num;
 
+	if (!req->cryptlen && ctx->cipher_type == OTX_CPT_AES_XTS)
+		return 0;
+
 	/* Validate that request doesn't exceed maximum CPT supported size */
 	if (req->cryptlen > OTX_CPT_MAX_REQ_SIZE)
 		return -E2BIG;
-- 
2.17.1


  parent reply	other threads:[~2020-08-07 16:22 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-07 16:19 [PATCH 00/22] crypto: add check for xts input length equal to zero Andrei Botila
2020-08-07 16:19 ` [PATCH 01/22] crypto: arm/aes-ce - " Andrei Botila
2020-08-07 16:19 ` [PATCH 02/22] crypto: arm/aes-neonbs " Andrei Botila
2020-08-07 16:19 ` [PATCH 03/22] crypto: arm64/aes " Andrei Botila
2020-08-07 16:19 ` [PATCH 04/22] crypto: arm64/aes-neonbs " Andrei Botila
2020-08-07 16:19 ` [PATCH 05/22] crypto: powerpc/aes-spe " Andrei Botila
2020-08-07 16:19 ` [PATCH 06/22] crypto: s390/aes " Andrei Botila
2020-08-07 16:19 ` [PATCH 07/22] crypto: s390/paes " Andrei Botila
2020-08-07 16:19 ` [PATCH 08/22] crypto: x86/glue_helper " Andrei Botila
2020-08-07 16:19 ` [PATCH 09/22] crypto: xts - add check for block " Andrei Botila
2020-08-07 16:19 ` [PATCH 10/22] crypto: atmel-aes - add check for xts input " Andrei Botila
2020-08-07 18:06   ` kernel test robot
2020-08-07 16:19 ` [PATCH 11/22] crypto: artpec6 " Andrei Botila
2020-08-07 16:20 ` [PATCH 12/22] crypto: bcm " Andrei Botila
2020-08-07 16:20 ` [PATCH 13/22] crypto: cavium/cpt " Andrei Botila
2020-08-07 16:20 ` [PATCH 14/22] crypto: cavium/nitrox " Andrei Botila
2020-08-07 16:20 ` [PATCH 15/22] crypto: ccp " Andrei Botila
2020-08-07 16:20 ` [PATCH 16/22] crypto: ccree " Andrei Botila
2020-08-08 12:10   ` Gilad Ben-Yossef
2020-08-07 16:20 ` [PATCH 17/22] crypto: chelsio " Andrei Botila
2020-08-07 16:20 ` [PATCH 18/22] crypto: hisilicon/sec " Andrei Botila
2020-08-07 16:20 ` [PATCH 19/22] crypto: inside-secure " Andrei Botila
2020-08-10 10:20   ` Van Leeuwen, Pascal
2020-08-10 13:45     ` Herbert Xu
2020-08-10 14:33       ` Horia Geantă
2020-08-10 17:03         ` Eric Biggers
2020-08-11 15:28           ` Horia Geantă
2020-08-12  0:36             ` Herbert Xu
2020-08-10 21:37         ` Van Leeuwen, Pascal
2020-08-07 16:20 ` Andrei Botila [this message]
2020-08-07 16:20 ` [PATCH 21/22] crypto: qce " Andrei Botila
2020-08-07 17:59   ` Stanimir Varbanov
2020-08-07 16:20 ` [PATCH 22/22] crypto: vmx " Andrei Botila

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200807162010.18979-21-andrei.botila@oss.nxp.com \
    --to=andrei.botila@oss.nxp.com \
    --cc=andrei.botila@nxp.com \
    --cc=arno@natisbad.org \
    --cc=bbrezillon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@axis.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=schalla@marvell.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).