lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202204021634.IhyHrjoT-lkp@intel.com>
Date:   Sat, 2 Apr 2022 16:22:56 +0800
From:   kernel test robot <lkp@...el.com>
To:     Corentin Labbe <clabbe@...libre.com>, heiko@...ech.de,
        herbert@...dor.apana.org.au, krzk+dt@...nel.org, robh+dt@...nel.org
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-rockchip@...ts.infradead.org,
        Corentin Labbe <clabbe@...libre.com>
Subject: Re: [PATCH v4 10/33] crypto: rockchip: rework by using crypto_engine

Hi Corentin,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20220331]
[also build test WARNING on v5.17]
[cannot apply to rockchip/for-next herbert-cryptodev-2.6/master herbert-crypto-2.6/master v5.17 v5.17-rc8 v5.17-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220402-042221
base:    fdcbcd1348f4ef713668bae1b0fa9774e1811205
config: arm64-buildonly-randconfig-r001-20220402 (https://download.01.org/0day-ci/archive/20220402/202204021634.IhyHrjoT-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c4a1b07d0979e7ff20d7d541af666d822d66b566)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/be381eb03ba20a6e06f0e880a9929d14a1e13064
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220402-042221
        git checkout be381eb03ba20a6e06f0e880a9929d14a1e13064
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/crypto/rockchip/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

   drivers/crypto/rockchip/rk3288_crypto_skcipher.c:21:46: error: use of undeclared identifier 'tfm'
           unsigned int bs = crypto_skcipher_blocksize(tfm);
                                                       ^
>> drivers/crypto/rockchip/rk3288_crypto_skcipher.c:328:6: warning: variable 'n' set but not used [-Wunused-but-set-variable]
           int n = 0;
               ^
   1 warning and 1 error generated.


vim +/n +328 drivers/crypto/rockchip/rk3288_crypto_skcipher.c

   319	
   320	static int rk_cipher_run(struct crypto_engine *engine, void *async_req)
   321	{
   322		struct skcipher_request *areq = container_of(async_req, struct skcipher_request, base);
   323		struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq);
   324		struct rk_cipher_ctx *ctx = crypto_skcipher_ctx(tfm);
   325		struct rk_cipher_rctx *rctx = skcipher_request_ctx(areq);
   326		struct scatterlist *sgs, *sgd;
   327		int err = 0;
 > 328		int n = 0;
   329		int ivsize = crypto_skcipher_ivsize(tfm);
   330		int offset;
   331		u8 iv[AES_BLOCK_SIZE];
   332		u8 biv[AES_BLOCK_SIZE];
   333		u8 *ivtouse = areq->iv;
   334		unsigned int len = areq->cryptlen;
   335		unsigned int todo;
   336	
   337		ivsize = crypto_skcipher_ivsize(tfm);
   338		if (areq->iv && crypto_skcipher_ivsize(tfm) > 0) {
   339			if (rctx->mode & RK_CRYPTO_DEC) {
   340				offset = areq->cryptlen - ivsize;
   341				scatterwalk_map_and_copy(rctx->backup_iv, areq->src,
   342							 offset, ivsize, 0);
   343			}
   344		}
   345	
   346		sgs = areq->src;
   347		sgd = areq->dst;
   348	
   349		while (sgs && sgd && len) {
   350			if (!sgs->length) {
   351				sgs = sg_next(sgs);
   352				sgd = sg_next(sgd);
   353				continue;
   354			}
   355			if (rctx->mode & RK_CRYPTO_DEC) {
   356				/* we backup last block of source to be used as IV at next step */
   357				offset = sgs->length - ivsize;
   358				scatterwalk_map_and_copy(biv, sgs, offset, ivsize, 0);
   359			}
   360			if (sgs == sgd) {
   361				err = dma_map_sg(ctx->dev->dev, sgs, 1, DMA_BIDIRECTIONAL);
   362				if (err <= 0) {
   363					err = -EINVAL;
   364					goto theend_iv;
   365				}
   366			} else {
   367				err = dma_map_sg(ctx->dev->dev, sgs, 1, DMA_TO_DEVICE);
   368				if (err <= 0) {
   369					err = -EINVAL;
   370					goto theend_iv;
   371				}
   372				err = dma_map_sg(ctx->dev->dev, sgd, 1, DMA_FROM_DEVICE);
   373				if (err <= 0) {
   374					err = -EINVAL;
   375					goto theend_sgs;
   376				}
   377			}
   378			err = 0;
   379			rk_ablk_hw_init(ctx->dev, areq);
   380			if (ivsize) {
   381				if (ivsize == DES_BLOCK_SIZE)
   382					memcpy_toio(ctx->dev->reg + RK_CRYPTO_TDES_IV_0, ivtouse, ivsize);
   383				else
   384					memcpy_toio(ctx->dev->reg + RK_CRYPTO_AES_IV_0, ivtouse, ivsize);
   385			}
   386			reinit_completion(&ctx->dev->complete);
   387			ctx->dev->status = 0;
   388	
   389			todo = min(sg_dma_len(sgs), len);
   390			len -= todo;
   391			crypto_dma_start(ctx->dev, sgs, sgd, todo / 4);
   392			wait_for_completion_interruptible_timeout(&ctx->dev->complete,
   393								  msecs_to_jiffies(2000));
   394			if (!ctx->dev->status) {
   395				dev_err(ctx->dev->dev, "DMA timeout\n");
   396				err = -EFAULT;
   397				goto theend;
   398			}
   399			if (sgs == sgd) {
   400				dma_unmap_sg(ctx->dev->dev, sgs, 1, DMA_BIDIRECTIONAL);
   401			} else {
   402				dma_unmap_sg(ctx->dev->dev, sgs, 1, DMA_TO_DEVICE);
   403				dma_unmap_sg(ctx->dev->dev, sgd, 1, DMA_FROM_DEVICE);
   404			}
   405			if (rctx->mode & RK_CRYPTO_DEC) {
   406				memcpy(iv, biv, ivsize);
   407				ivtouse = iv;
   408			} else {
   409				offset = sgd->length - ivsize;
   410				scatterwalk_map_and_copy(iv, sgd, offset, ivsize, 0);
   411				ivtouse = iv;
   412			}
   413			sgs = sg_next(sgs);
   414			sgd = sg_next(sgd);
   415			n++;
   416		}
   417	
   418		if (areq->iv && ivsize > 0) {
   419			offset = areq->cryptlen - ivsize;
   420			if (rctx->mode & RK_CRYPTO_DEC) {
   421				memcpy(areq->iv, rctx->backup_iv, ivsize);
   422				memzero_explicit(rctx->backup_iv, ivsize);
   423			} else {
   424				scatterwalk_map_and_copy(areq->iv, areq->dst, offset,
   425							 ivsize, 0);
   426			}
   427		}
   428	
   429	theend:
   430		local_bh_disable();
   431		crypto_finalize_skcipher_request(engine, areq, err);
   432		local_bh_enable();
   433		return 0;
   434	
   435	theend_sgs:
   436		if (sgs == sgd) {
   437			dma_unmap_sg(ctx->dev->dev, sgs, 1, DMA_BIDIRECTIONAL);
   438		} else {
   439			dma_unmap_sg(ctx->dev->dev, sgs, 1, DMA_TO_DEVICE);
   440			dma_unmap_sg(ctx->dev->dev, sgd, 1, DMA_FROM_DEVICE);
   441		}
   442	theend_iv:
   443		return err;
   444	}
   445	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ