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: <202203010936.rO3B1boq-lkp@intel.com>
Date:   Tue, 1 Mar 2022 09:15:49 +0800
From:   kernel test robot <lkp@...el.com>
To:     Corentin Labbe <clabbe@...libre.com>, heiko@...ech.de,
        herbert@...dor.apana.org.au, krzysztof.kozlowski@...onical.com,
        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 10/16] crypto: rockchip: rework by using crypto_engine

Hi Corentin,

I love your patch! Perhaps something to improve:

[auto build test WARNING on rockchip/for-next]
[also build test WARNING on herbert-cryptodev-2.6/master herbert-crypto-2.6/master v5.17-rc6 next-20220228]
[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/0day-ci/linux/commits/Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220301-035430
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next
config: arm64-randconfig-r006-20220228 (https://download.01.org/0day-ci/archive/20220301/202203010936.rO3B1boq-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
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/0day-ci/linux/commit/7e5f8e4a5f09473643937e0ecff342bf336793fb
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220301-035430
        git checkout 7e5f8e4a5f09473643937e0ecff342bf336793fb
        # 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:386:10: warning: format specifies type 'unsigned int' but the argument has type 'unsigned long' [-Wformat]
                           todo, rctx->mode & RK_CRYPTO_DEC);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:163:47: note: expanded from macro 'dev_dbg'
                   dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \
                                                       ~~~     ^~~~~~~~~~~
   include/linux/dev_printk.h:129:34: note: expanded from macro 'dev_printk'
                   _dev_printk(level, dev, fmt, ##__VA_ARGS__);            \
                                           ~~~    ^~~~~~~~~~~
   drivers/crypto/rockchip/rk3288_crypto_skcipher.c:474:24: warning: unused variable 'ctx' [-Wunused-variable]
           struct rk_cipher_ctx *ctx = crypto_skcipher_ctx(tfm);
                                 ^
   2 warnings generated.


vim +386 drivers/crypto/rockchip/rk3288_crypto_skcipher.c

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

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ