1. 05 Sep, 2019 22 commits
  2. 30 Aug, 2019 18 commits
    • Mao Wenan's avatar
      crypto: hisilicon - select CRYPTO_LIB_DES while compiling SEC driver · 1bbbbcfd
      Mao Wenan authored
      When CRYPTO_DEV_HISI_SEC=y, below compilation error is found after
      'commit 894b68d8 ("crypto: hisilicon/des - switch to new verification routines")':
      
      drivers/crypto/hisilicon/sec/sec_algs.o: In function `sec_alg_skcipher_setkey_des_cbc':
      sec_algs.c:(.text+0x11f0): undefined reference to `des_expand_key'
      drivers/crypto/hisilicon/sec/sec_algs.o: In function `sec_alg_skcipher_setkey_des_ecb':
      sec_algs.c:(.text+0x1390): undefined reference to `des_expand_key'
      make: *** [vmlinux] Error 1
      
      This because DES library has been moved to lib/crypto in this commit
      '04007b0e ("crypto: des - split off DES library from generic DES cipher driver")'.
      Fix this by selecting CRYPTO_LIB_DES in CRYPTO_DEV_HISI_SEC.
      
      Fixes: 04007b0e ("crypto: des - split off DES library from generic DES cipher driver")
      Fixes: 894b68d8 ("crypto: hisilicon/des - switch to new verification routines")
      Signed-off-by: default avatarMao Wenan <maowenan@huawei.com>
      Acked-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1bbbbcfd
    • Hans de Goede's avatar
      crypto: sha256 - Add missing MODULE_LICENSE() to lib/crypto/sha256.c · 9ecf5ad5
      Hans de Goede authored
      lib/crypto/sha256.c / lib/crypto/libsha256.o may end up being a module,
      so it needs a MODULE_LICENSE() line, add this.
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      9ecf5ad5
    • Ard Biesheuvel's avatar
      crypto: ccp - invoke fallback for XTS ciphertext stealing · c03a5093
      Ard Biesheuvel authored
      For correctness and compliance with the XTS-AES specification, we are
      adding support for ciphertext stealing to XTS implementations, even
      though no use cases are known that will be enabled by this.
      
      Since the ccp driver already has a fallback skcipher standby for
      dealing with input sizes other than [16, 512, 1024, 2048, 4096],
      just drop the check against the block size.
      
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Gary Hook <gary.hook@amd.com>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c03a5093
    • YueHaibing's avatar
      crypto: nx - remove unused variables 'nx_driver_string' and 'nx_driver_version' · 2be7f901
      YueHaibing authored
      drivers/crypto/nx/nx.h:12:19: warning:
       nx_driver_string defined but not used [-Wunused-const-variable=]
      drivers/crypto/nx/nx.h:13:19: warning:
       nx_driver_version defined but not used [-Wunused-const-variable=]
      
      They are never used, so just remove it.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2be7f901
    • YueHaibing's avatar
      crypto: atmel - Fix -Wunused-const-variable warning · 25e9960c
      YueHaibing authored
      drivers/crypto/atmel-i2c.h:68:3: warning:
       error_list defined but not used [-Wunused-const-variable=]
      
      error_list is only used in atmel-i2c.c,
      so just move the definition over there.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      25e9960c
    • YueHaibing's avatar
      crypto: aegis128 - Fix -Wunused-const-variable warning · f1d087b9
      YueHaibing authored
      crypto/aegis.h:27:32: warning:
       crypto_aegis_const defined but not used [-Wunused-const-variable=]
      
      crypto_aegis_const is only used in aegis128-core.c,
      just move the definition over there.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      f1d087b9
    • Andrey Smirnov's avatar
      crypto: caam - add clock entry for i.MX8MQ · 6796c02a
      Andrey Smirnov authored
      Add clock entry needed to support i.MX8MQ.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      6796c02a
    • Andrey Smirnov's avatar
      crypto: caam - always select job ring via RSR on i.MX8MQ · a6727055
      Andrey Smirnov authored
      Per feedback from NXP tech support the way to use register based
      service interface on i.MX8MQ is to follow the same set of steps
      outlined for the case when virtualization is enabled, regardless if it
      is. Current version of SRM for i.MX8MQ speaks of DECO DID_MS and DECO
      DID_LS registers, but apparently those are not implemented, so the
      case when SCFGR[VIRT_EN]=0 should be handled the same as the case when
      SCFGR[VIRT_EN]=1
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a6727055
    • Andrey Smirnov's avatar
      crypto: caam - select DMA address size at runtime · a1cf573e
      Andrey Smirnov authored
      i.MX8 mScale SoC still use 32-bit addresses in its CAAM implmentation,
      so we can't rely on sizeof(dma_addr_t) to detemine CAAM pointer
      size. Convert the code to query CTPR and MCFGR for that during driver
      probing.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      a1cf573e
    • Andrey Smirnov's avatar
      crypto: caam - don't hardcode inpentry size · dff36801
      Andrey Smirnov authored
      Using dma_addr_t for elements of JobR input ring is not appropriate on
      all 64-bit SoCs, some of which, like i.MX8MQ, use only 32-bit wide
      pointers there. Convert all of the code to use explicit helper
      function that can be later extended to support i.MX8MQ. No functional
      change intended.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      dff36801
    • Andrey Smirnov's avatar
      crypto: caam - drop explicit usage of struct jr_outentry · 6c5f898f
      Andrey Smirnov authored
      Using struct jr_outentry to specify the layout of JobR output ring is
      not appropriate for all 64-bit SoC, since some of them, like i.MX8MQ,
      use 32-bit pointers there which doesn't match 64-bit
      dma_addr_t. Convert existing code to use explicit helper functions to
      access any of the JobR output ring elements, so that the support for
      i.MX8MQ can be added later. No functional change intended.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      6c5f898f
    • Andrey Smirnov's avatar
      crypto: caam - move cpu_to_caam_dma() selection to runtime · e27d9629
      Andrey Smirnov authored
      Instead of selecting the implementation of
      cpu_to_caam_dma()/caam_dma_to_cpu() at build time using the
      preprocessor, convert the code to do that at run-time using IS_ENABLED
      macro. This is needed to add support for i.MX8MQ. No functional change
      intended.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e27d9629
    • Andrey Smirnov's avatar
      crypto: caam - make CAAM_PTR_SZ dynamic · 1a3daadc
      Andrey Smirnov authored
      In order to be able to configure CAAM pointer size at run-time, which
      needed to support i.MX8MQ, which is 64-bit SoC with 32-bit pointer
      size, convert CAAM_PTR_SZ to refer to a global variable of the same
      name ("caam_ptr_sz") and adjust the rest of the code accordingly. No
      functional change intended.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1a3daadc
    • Andrey Smirnov's avatar
      crypto: caam - share definition for MAX_SDLEN · 3a0944c5
      Andrey Smirnov authored
      Both qi.h and cammalg_qi2.h seem to define identical versions of
      MAX_SDLEN. Move it to desc_constr.h to avoid duplication.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      3a0944c5
    • Andrey Smirnov's avatar
      crypto: caam - drop 64-bit only wr/rd_reg64() · 6e05542f
      Andrey Smirnov authored
      Since 32-bit of both wr_reg64 and rd_reg64 now use 64-bit IO helpers,
      these functions should no longer be necessary. No functional change intended.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      6e05542f
    • Andrey Smirnov's avatar
      crypto: caam - use ioread64*_hi_lo in rd_reg64 · 393d2d0f
      Andrey Smirnov authored
      Following the same transformation logic as outlined in previous commit
      converting wr_reg64, convert rd_reg64 to use helpers from
      <linux/io-64-nonatomic-hi-lo.h> first. No functional change intended.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      393d2d0f
    • Andrey Smirnov's avatar
      crytpo: caam - make use of iowrite64*_hi_lo in wr_reg64 · 9f5db8b5
      Andrey Smirnov authored
      In order to be able to unify 64 and 32 bit implementations of
      wr_reg64, let's convert it to use helpers from
      <linux/io-64-nonatomic-hi-lo.h> first. Here are the steps of the
      transformation:
      
      1. Inline wr_reg32 helpers:
      
      	if (!caam_imx && caam_little_end) {
      		if (caam_little_end) {
      			iowrite32(data >> 32, (u32 __iomem *)(reg) + 1);
      			iowrite32(data, (u32 __iomem *)(reg));
      		} else {
      			iowrite32be(data >> 32, (u32 __iomem *)(reg) + 1);
      			iowrite32be(data, (u32 __iomem *)(reg));
      		}
      	} else {
      		if (caam_little_end) {
      			iowrite32(data >> 32, (u32 __iomem *)(reg));
      			iowrite32(data, (u32 __iomem *)(reg) + 1);
      		} else {
      			iowrite32be(data >> 32, (u32 __iomem *)(reg));
      			iowrite32be(data, (u32 __iomem *)(reg) + 1);
      		}
      	}
      
      2. Transfrom the conditionals such that the check for
      'caam_little_end' is at the top level:
      
      	if (caam_little_end) {
      		if (!caam_imx) {
      			iowrite32(data >> 32, (u32 __iomem *)(reg) + 1);
      			iowrite32(data, (u32 __iomem *)(reg));
      		} else {
      			iowrite32(data >> 32, (u32 __iomem *)(reg));
      			iowrite32(data, (u32 __iomem *)(reg) + 1);
      		}
      	} else {
      		iowrite32be(data >> 32, (u32 __iomem *)(reg));
      		iowrite32be(data, (u32 __iomem *)(reg) + 1);
      	}
      
      3. Invert the check for !caam_imx:
      
      	if (caam_little_end) {
      		if (caam_imx) {
      			iowrite32(data >> 32, (u32 __iomem *)(reg));
      			iowrite32(data, (u32 __iomem *)(reg) + 1);
      		} else {
      			iowrite32(data >> 32, (u32 __iomem *)(reg) + 1);
      			iowrite32(data, (u32 __iomem *)(reg));
      		}
      	} else {
      		iowrite32be(data >> 32, (u32 __iomem *)(reg));
      		iowrite32be(data, (u32 __iomem *)(reg) + 1);
      	}
      
      4. Make use of iowrite64* helpers from <linux/io-64-nonatomic-hi-lo.h>
      
      	if (caam_little_end) {
      		if (caam_imx) {
      			iowrite32(data >> 32, (u32 __iomem *)(reg));
      			iowrite32(data, (u32 __iomem *)(reg) + 1);
      		} else {
      			iowrite64(data, reg);
      		}
      	} else {
      		iowrite64be(data, reg);
      	}
      
      No functional change intended.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      9f5db8b5
    • Andrey Smirnov's avatar
      crypto: caam - request JR IRQ as the last step · d488dfd9
      Andrey Smirnov authored
      In order to avoid any risk of JR IRQ request being handled while some
      of the resources used for that are not yet allocated move the code
      requesting said IRQ to the endo of caam_jr_init().
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Spencer <christopher.spencer@sea.co.uk>
      Cc: Cory Tusar <cory.tusar@zii.aero>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Aymen Sghaier <aymen.sghaier@nxp.com>
      Cc: Leonard Crestez <leonard.crestez@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d488dfd9