1. 30 Mar, 2020 6 commits
    • Andrey Smirnov's avatar
      crypto: caam - check if RNG job failed · 32107e43
      Andrey Smirnov authored
      We shouldn't stay silent if RNG job fails. Add appropriate code to
      check for that case and propagate error code up appropriately.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-imx@nxp.com
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      32107e43
    • Andrey Smirnov's avatar
      crypto: caam - simplify RNG implementation · 2c5e88dc
      Andrey Smirnov authored
      Rework CAAM RNG implementation as follows:
      
      - Make use of the fact that HWRNG supports partial reads and will
      handle such cases gracefully by removing recursion in caam_read()
      
      - Convert blocking caam_read() codepath to do a single blocking job
      read directly into requested buffer, bypassing any intermediary
      buffers
      
      - Convert async caam_read() codepath into a simple single
      reader/single writer FIFO use-case, thus simplifying concurrency
      handling and delegating buffer read/write position management to KFIFO
      subsystem.
      
      - Leverage the same low level RNG data extraction code for both async
      and blocking caam_read() scenarios, get rid of the shared job
      descriptor and make non-shared one as a simple as possible (just
      HEADER + ALGORITHM OPERATION + FIFO STORE)
      
      - Split private context from DMA related memory, so that the former
      could be allocated without GFP_DMA.
      
      NOTE: On its face value this commit decreased throughput numbers
      reported by
      
        dd if=/dev/hwrng of=/dev/null bs=1 count=100K [iflag=nonblock]
      
      by about 15%, however commits that enable prediction resistance and
      limit JR total size impact the performance so much and move the
      bottleneck such as to make this regression irrelevant.
      
      NOTE: On the bright side, this commit reduces RNG in kernel DMA buffer
      memory usage from 2 x RN_BUF_SIZE (~256K) to 32K.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-imx@nxp.com
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2c5e88dc
    • Andrey Smirnov's avatar
      crypto: caam - drop global context pointer and init_done · 1517f63c
      Andrey Smirnov authored
      Leverage devres to get rid of code storing global context as well as
      init_done flag.
      
      Original code also has a circular deallocation dependency where
      unregister_algs() -> caam_rng_exit() -> caam_jr_free() chain would
      only happen if all of JRs were freed. Fix this by moving
      caam_rng_exit() outside of unregister_algs() and doing it specifically
      for JR that instantiated HWRNG.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-imx@nxp.com
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1517f63c
    • Andrey Smirnov's avatar
      crypto: caam - use struct hwrng's .init for initialization · 8483c831
      Andrey Smirnov authored
      Make caamrng code a bit more symmetric by moving initialization code
      to .init hook of struct hwrng.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
      Cc: linux-crypto@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-imx@nxp.com
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      8483c831
    • Andrey Smirnov's avatar
      crypto: caam - allocate RNG instantiation descriptor with GFP_DMA · f0ac02c7
      Andrey Smirnov authored
      Be consistent with the rest of the codebase and use GFP_DMA when
      allocating memory for a CAAM JR descriptor.
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Reviewed-by: default avatarHoria Geantă <horia.geanta@nxp.com>
      Cc: Chris Healy <cphealy@gmail.com>
      Cc: Lucas Stach <l.stach@pengutronix.de>
      Cc: Horia Geantă <horia.geanta@nxp.com>
      Cc: Herbert Xu <herbert@gondor.apana.org.au>
      Cc: Iuliana Prodan <iuliana.prodan@nxp.com>
      Cc: linux-imx@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>
      f0ac02c7
    • YueHaibing's avatar
      crypto: ccree - remove duplicated include from cc_aead.c · 4ccff767
      YueHaibing authored
      Remove duplicated include.
      Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      4ccff767
  2. 20 Mar, 2020 12 commits
  3. 12 Mar, 2020 22 commits