1. 25 Oct, 2019 22 commits
    • Ben Dooks (Codethink)'s avatar
      crypto: atmel - fix data types for __be{32,64} · 49c4cd80
      Ben Dooks (Codethink) authored
      The driver uses a couple of buffers that seem to
      be __be32 or __be64 fields, but declares them as
      u32. This means there are a number of warnings
      from sparse due to casting to/from __beXXX.
      
      Fix these by changing the types of the buffer
      and the associated variables.
      
      drivers/crypto/atmel-aes.c:1023:15: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1023:15: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1023:15: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1023:15: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1023:15: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1023:15: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1059:28: warning: incorrect type in assignment (different base types)
      drivers/crypto/atmel-aes.c:1059:28:    expected unsigned int
      drivers/crypto/atmel-aes.c:1059:28:    got restricted __be32 [usertype]
      drivers/crypto/atmel-aes.c:1550:28: warning: incorrect type in assignment (different base types)
      drivers/crypto/atmel-aes.c:1550:28:    expected unsigned int
      drivers/crypto/atmel-aes.c:1550:28:    got restricted __be32 [usertype]
      drivers/crypto/atmel-aes.c:1561:39: warning: incorrect type in assignment (different base types)
      drivers/crypto/atmel-aes.c:1561:39:    expected unsigned long long [usertype]
      drivers/crypto/atmel-aes.c:1561:39:    got restricted __be64 [usertype]
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:17: warning: cast to restricted __be32
      drivers/crypto/atmel-aes.c:1599:15: warning: incorrect type in assignment (different base types)
      drivers/crypto/atmel-aes.c:1599:15:    expected unsigned int [usertype]
      drivers/crypto/atmel-aes.c:1599:15:    got restricted __be32 [usertype]
      drivers/crypto/atmel-aes.c:1692:17: warning: incorrect type in assignment (different base types)
      drivers/crypto/atmel-aes.c:1692:17:    expected unsigned long long [usertype]
      drivers/crypto/atmel-aes.c:1692:17:    got restricted __be64 [usertype]
      drivers/crypto/atmel-aes.c:1693:17: warning: incorrect type in assignment (different base types)
      drivers/crypto/atmel-aes.c:1693:17:    expected unsigned long long [usertype]
      drivers/crypto/atmel-aes.c:1693:17:    got restricted __be64 [usertype]
      drivers/crypto/atmel-aes.c:1888:63: warning: incorrect type in initializer (different base types)
      drivers/crypto/atmel-aes.c:1888:63:    expected unsigned int
      drivers/crypto/atmel-aes.c:1888:63:    got restricted __le32 [usertype]
      Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      49c4cd80
    • YueHaibing's avatar
      hwrng: xgene - use devm_platform_ioremap_resource() to simplify code · 4c747d4d
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      4c747d4d
    • YueHaibing's avatar
      hwrng: tx4939 - use devm_platform_ioremap_resource() to simplify code · 6cd4e070
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      6cd4e070
    • YueHaibing's avatar
      hwrng: st - use devm_platform_ioremap_resource() to simplify code · bd74b0f5
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: default avatarPatrice Chotard <patrice.chotard@st.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      bd74b0f5
    • YueHaibing's avatar
      hwrng: pic32 - use devm_platform_ioremap_resource() to simplify code · 64b7bf13
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      64b7bf13
    • YueHaibing's avatar
      hwrng: pasemi - use devm_platform_ioremap_resource() to simplify code · 5b18f9ac
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      5b18f9ac
    • YueHaibing's avatar
      hwrng: omap - use devm_platform_ioremap_resource() to simplify code · c7c16c58
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c7c16c58
    • YueHaibing's avatar
      hwrng: npcm - use devm_platform_ioremap_resource() to simplify code · fc963e02
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      fc963e02
    • YueHaibing's avatar
      hwrng: meson - use devm_platform_ioremap_resource() to simplify code · ba147576
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Reviewed-by: default avatarKevin Hilman <khilman@baylibre.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      ba147576
    • YueHaibing's avatar
      hwrng: ks-sa - use devm_platform_ioremap_resource() to simplify code · 871d030d
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      871d030d
    • YueHaibing's avatar
      hwrng: hisi - use devm_platform_ioremap_resource() to simplify code · 10304c76
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      10304c76
    • YueHaibing's avatar
      hwrng: exynos - use devm_platform_ioremap_resource() to simplify code · 3e3c97c6
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Acked-by: default avatarŁukasz Stelmach <l.stelmach@samsung.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      3e3c97c6
    • YueHaibing's avatar
      hwrng: bcm2835 - use devm_platform_ioremap_resource() to simplify code · 3e46bd34
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      3e46bd34
    • YueHaibing's avatar
      hwrng: atmel - use devm_platform_ioremap_resource() to simplify code · bc49534d
      YueHaibing authored
      Use devm_platform_ioremap_resource() to simplify the code a bit.
      This is detected by coccinelle.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Acked-by: default avatarLudovic Desroches <ludovic.desroches@microchip.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      bc49534d
    • Ben Dooks's avatar
      hwrng: ka-sa - fix __iomem on registers · d1569349
      Ben Dooks authored
      Add __ioemm attribute to reg_rng to fix the following
      sparse warnings:
      
      drivers/char/hw_random/ks-sa-rng.c:102:9: warning: incorrect type in argument 2 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:102:9:    expected void volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:102:9:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:104:9: warning: incorrect type in argument 2 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:104:9:    expected void volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:104:9:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:113:9: warning: incorrect type in argument 2 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:113:9:    expected void volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:113:9:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:116:9: warning: incorrect type in argument 2 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:116:9:    expected void volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:116:9:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:119:17: warning: incorrect type in argument 1 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:119:17:    expected void const volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:119:17:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:121:9: warning: incorrect type in argument 2 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:121:9:    expected void volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:121:9:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:132:9: warning: incorrect type in argument 2 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:132:9:    expected void volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:132:9:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:143:19: warning: incorrect type in argument 1 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:143:19:    expected void const volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:143:19:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:144:19: warning: incorrect type in argument 1 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:144:19:    expected void const volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:144:19:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:146:9: warning: incorrect type in argument 2 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:146:9:    expected void volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:146:9:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:160:25: warning: incorrect type in argument 1 (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:160:25:    expected void const volatile [noderef] <asn:2> *addr
      drivers/char/hw_random/ks-sa-rng.c:160:25:    got unsigned int *
      drivers/char/hw_random/ks-sa-rng.c:194:28: warning: incorrect type in assignment (different address spaces)
      drivers/char/hw_random/ks-sa-rng.c:194:28:    expected struct trng_regs *reg_rng
      drivers/char/hw_random/ks-sa-rng.c:194:28:    got void [noderef] <asn:2> *
      Signed-off-by: default avatarBen Dooks <ben.dooks@codethink.co.uk>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d1569349
    • Ard Biesheuvel's avatar
      crypto: powerpc/spe-xts - implement support for ciphertext stealing · d0be0720
      Ard Biesheuvel authored
      Add the logic to deal with input sizes that are not a round multiple
      of the AES block size, as described by the XTS spec. This brings the
      SPE implementation in line with other kernel drivers that have been
      updated recently to take this into account.
      
      Cc: Eric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      d0be0720
    • Eric Biggers's avatar
      crypto: powerpc - convert SPE AES algorithms to skcipher API · 7f725f41
      Eric Biggers authored
      Convert the glue code for the PowerPC SPE implementations of AES-ECB,
      AES-CBC, AES-CTR, and AES-XTS from the deprecated "blkcipher" API to the
      "skcipher" API.  This is needed in order for the blkcipher API to be
      removed.
      
      Tested with:
      
      	export ARCH=powerpc CROSS_COMPILE=powerpc-linux-gnu-
      	make mpc85xx_defconfig
      	cat >> .config << EOF
      	# CONFIG_MODULES is not set
      	# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
      	CONFIG_DEBUG_KERNEL=y
      	CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
      	CONFIG_CRYPTO_AES=y
      	CONFIG_CRYPTO_CBC=y
      	CONFIG_CRYPTO_CTR=y
      	CONFIG_CRYPTO_ECB=y
      	CONFIG_CRYPTO_XTS=y
      	CONFIG_CRYPTO_AES_PPC_SPE=y
      	EOF
      	make olddefconfig
      	make -j32
      	qemu-system-ppc -M mpc8544ds -cpu e500 -nographic \
      		-kernel arch/powerpc/boot/zImage \
      		-append cryptomgr.fuzz_iterations=1000
      
      Note that xts-ppc-spe still fails the comparison tests due to the lack
      of ciphertext stealing support.  This is not addressed by this patch.
      
      This patch also cleans up the code by making ->encrypt() and ->decrypt()
      call a common function for each of ECB, CBC, and XTS, and by using a
      clearer way to compute the length to process at each step.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      7f725f41
    • Eric Biggers's avatar
      crypto: powerpc - don't set ivsize for AES-ECB · 8255e65d
      Eric Biggers authored
      Set the ivsize for the "ecb-ppc-spe" algorithm to 0, since ECB mode
      doesn't take an IV.
      
      This fixes a failure in the extra crypto self-tests:
      
      	alg: skcipher: ivsize for ecb-ppc-spe (16) doesn't match generic impl (0)
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      8255e65d
    • Eric Biggers's avatar
      crypto: powerpc - don't unnecessarily use atomic scatterwalk · 0d6ecb2e
      Eric Biggers authored
      The PowerPC SPE implementations of AES modes only disable preemption
      during the actual encryption/decryption, not during the scatterwalk
      functions.  It's therefore unnecessary to request an atomic scatterwalk.
      So don't do so.
      Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0d6ecb2e
    • Ard Biesheuvel's avatar
      crypto: aegis128 - duplicate init() and final() hooks in SIMD code · 52828263
      Ard Biesheuvel authored
      In order to speed up aegis128 processing even more, duplicate the init()
      and final() routines as SIMD versions in their entirety. This results
      in a 2x speedup on ARM Cortex-A57 for ~1500 byte packets (using AES
      instructions).
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      52828263
    • Ard Biesheuvel's avatar
      crypto: aegis128 - avoid function pointers for parameterization · 2698bce1
      Ard Biesheuvel authored
      Instead of passing around an ops structure with function pointers,
      which forces indirect calls to be used, refactor the code slightly
      so we can use ordinary function calls. At the same time, switch to
      a static key to decide whether or not the SIMD code path may be used.
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2698bce1
    • Sumit Garg's avatar
      hwrng: omap - Fix RNG wait loop timeout · be867f98
      Sumit Garg authored
      Existing RNG data read timeout is 200us but it doesn't cover EIP76 RNG
      data rate which takes approx. 700us to produce 16 bytes of output data
      as per testing results. So configure the timeout as 1000us to also take
      account of lack of udelay()'s reliability.
      
      Fixes: 38321242 ("hwrng: omap - Add device variant for SafeXcel IP-76 found in Armada 8K")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarSumit Garg <sumit.garg@linaro.org>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      be867f98
  2. 23 Oct, 2019 18 commits