summaryrefslogtreecommitdiffstats
path: root/drivers/crypto
Commit message (Collapse)AuthorAgeFilesLines
...
* crypto: caam - fix writing to JQCR_MS when using service interfaceMarcin Niestroj2018-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pick commit 9f587fa29f7e8ed6b8885cff51a51ace3ad85152 from Linux upstream. crypto: caam - fix writing to JQCR_MS when using service interface Most significant part of JQCR (Job Queue Control Register) contains bits that control endianness: ILE - Immediate Little Endian, DWS - Double Word Swap. The bits are automatically set by the Job Queue Controller HW. Unfortunately these bits are cleared in SW when submitting descriptors via the register-based service interface. >From LS1021A: JQCR_MS = 08080100 - before writing: ILE | DWS | SRC (JR0) JQCR_MS = 30000100 - after writing: WHL | FOUR | SRC (JR0) This would cause problems on little endian caam for descriptors containing immediata data or double-word pointers. Currently there is no problem since the only descriptors ran through this interface are the ones that (un)instantiate RNG. Signed-off-by: Horia Geant? <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: caam - fix warning in APPEND_MATH_IMM_u64Marcin Niestroj2018-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | Pick commit c1f2cd21ed5335bfcf5dd1d3a05a2a83bae14c3a from Linux upstream. crypto: caam - fix warning in APPEND_MATH_IMM_u64 An implicit truncation is done when using a variable of 64 bits in MATH command: warning: large integer implicitly truncated to unsigned type [-Woverflow] Silence the compiler by feeding it with an explicit truncated value. Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com> Signed-off-by: Horia Geant? <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: caam - fix RNG init descriptor ret. code checkingMarcin Niestroj2018-09-041-2/+3
| | | | | | | | | | | | | | | | | Pick commit 62743a4145bb9c3fe090a48e10ddc0ebae85bfbf from Linux upstream. crypto: caam - fix RNG init descriptor ret. code checking When successful, the descriptor that performs RNG initialization is allowed to return a status code of 7000_0000h, since last command in the descriptor is a JUMP HALT. Signed-off-by: Horia Geant? <horia.geanta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: caam: use dma_alloc_coherent instead of dma_allocOleksij Rempel2017-07-121-3/+1
| | | | | | | | | | dma_alloc return non-coherent memory, but the driver does no cache maintenance on the buffer, causing memory corruption. Fix this by requesting coherent memory for the DMA transfer. Fixes: ef4144b4ab63 (crypto: caam - fix RNG buffer cache alignment) Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* crypto: caam - fix RNG buffer cache alignmentOleksij Rempel2017-03-301-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this is alternate version of linux fix: --------------------------------------------------------------------- | commit 412c98c1bef65fe7589f1300e93735d96130307c | Author: Steve Cornelius <steve.cornelius@freescale.com> | Date: Mon Jun 15 16:52:59 2015 -0700 | | crypto: caam - fix RNG buffer cache alignment | | The hwrng output buffers (2) are cast inside of a a struct (caam_rng_ctx) | allocated in one DMA-tagged region. While the kernel's heap allocator | should place the overall struct on a cacheline aligned boundary, the 2 | buffers contained within may not necessarily align. Consenquently, the | ends of unaligned buffers may not fully flush, and if so, stale data will be | left behind, resulting in small repeating patterns. | | This fix aligns the buffers inside the struct. | | Note that not all of the data inside caam_rng_ctx necessarily needs to | be DMA-tagged, only the buffers themselves require this. However, a fix | would incur the expense of error-handling bloat in the case of allocation | failure. | | Cc: stable@vger.kernel.org | Signed-off-by: Steve Cornelius <steve.cornelius@freescale.com> | Signed-off-by: Victoria Milhoan <vicki.milhoan@freescale.com> | Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> --------------------------------------------------------------------- instead we will use just dma_alloc() Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* caamrng: port to hwrng frameworkOleksij Rempel2017-03-302-28/+13
| | | | | Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* crypto: add i.MX6 CAAM supportSteffen Trumtrar2016-02-1215-0/+4636
Add the i.MX6 crypto core CAAM with support for the random number generator. The core itself works with jobrings in which descriptors can be queued/dequeued for processing. Depending on descriptor type the CAAM unit then either produces random numbers or decrypts/encrypts data. The code is based on the Linux v4.1 driver of the same name without all the crypto/hashing components. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>