crash in ppc4xx-rng on canyonland

2016-03-25 Thread Christian Lamparter
[see patch]. I would like to move the trng into the crypto-ppc4xx, but given that this breaks some of the DTS out there I'm not sure. Regards, Christian --- >From 2159e200fcb68f88a94b1d5570d6000c100133a8 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Fri, 25 Mar 2016 19:00:05

Re: crash in ppc4xx-rng on canyonland

2016-04-08 Thread Christian Lamparter
On Tuesday, April 05, 2016 08:11:19 PM Herbert Xu wrote: > Christian Lamparter wrote: > > > > The crash is caused by a bad read in ppc4xx_rng_enable [0]. From what I > > can tell, the driver is mapping the crypto control registers. The > > problem is that they are

Re: crash in ppc4xx-rng on canyonland

2016-04-18 Thread Christian Lamparter
On Monday, April 18, 2016 05:59:39 PM Herbert Xu wrote: > Christian Lamparter wrote: > > > > I tried to move ppc4xx-rng into crypto4xx (see attachment - patch #1). > > The driver works as is. But I can't come up with a way to attach the > > crypto4xx driver t

[PATCH 04/12] crypto: crypto4xx: remove extern statement before function declaration

2017-08-25 Thread Christian Lamparter
class specifier extern." Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.h | 48 ++-- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/drivers/crypto/amcc/crypto4xx_core.h b/drivers/crypto/amcc/crypto4xx_core.

[PATCH 02/12] crypto: crypto4xx: remove unused definitions and write-only variables

2017-08-25 Thread Christian Lamparter
This patch removes several unused code and definitons (structs, variables, ...). Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 6 -- drivers/crypto/amcc/crypto4xx_core.c | 2 +- drivers/crypto/amcc/crypto4xx_core.h | 16 3 files changed, 1

[PATCH 01/12] crypto: crypto4xx: remove bad list_del

2017-08-25 Thread Christian Lamparter
alg entries are only added to the list, after the registration was successful. If the registration failed, it was never added to the list in the first place. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions

[PATCH 11/12] crypto: crypto4xx: fix crypto4xx_build_pdr, crypto4xx_build_sdr leak

2017-08-25 Thread Christian Lamparter
If one of the later memory allocations in rypto4xx_build_pdr() fails: dev->pdr (and/or) dev->pdr_uinfo wouldn't be freed. crypto4xx_build_sdr() has the same issue with dev->sdr. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 17 +

[PATCH 05/12] crypto: crypto4xx: remove double assignment of pd_uinfo->state

2017-08-25 Thread Christian Lamparter
crypto4xx_put_pd_to_pdr() already clears the flag. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c index 249d35ff3806..9e96af725b31 100644

[RFC PATCH 08/12] crypto: crypto4xx: enable AES RFC3686, ECB, CFB and OFB offloads

2017-08-25 Thread Christian Lamparter
The crypto engine supports more than just aes-cbc. This patch enables the remaining AES block cipher modes that pass the testmanager's test vectors. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 66 drivers/crypto/amcc/crypto4xx_c

[RFC PATCH 09/12] crypto: crypto4xx: refactor crypto4xx_copy_pkt_to_dst()

2017-08-25 Thread Christian Lamparter
d-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 126 +-- 1 file changed, 30 insertions(+), 96 deletions(-) diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c index 3c086cf7b052..f3f151820373 100644

[RFC PATCH 12/12] crypto: crypto4xx: pointer arithmetic overhaul

2017-08-25 Thread Christian Lamparter
This patch improves the readability of various functions, by replacing various void* pointers declarations with their respective structs *. This makes it possible to go for the eye-friendly array-indexing methods. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 26

[PATCH 07/12] crypto: crypto4xx: move and refactor dynamic_contents helpers

2017-08-25 Thread Christian Lamparter
dynamic_sa_contents union, instead of the crypto4xx_ctx. * rename get_dynamic_sa_offset_key_field to get_dynamic_sa_key_field. It returns the pointer to the key directly. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/Makefile | 2 +- drivers/crypto/amcc/crypto4xx_alg.c

[RFC PATCH 03/12] crypto: crypto4xx: set CRYPTO_ALG_KERN_DRIVER_ONLY flag

2017-08-25 Thread Christian Lamparter
The security offload function is performed by a cryptographic engine core attached to the 128-bit PLB (processor local bus) with builtin DMA and interrupt controllers. This, I think, satisfies the requirement for the CRYPTO_ALG_KERN_DRIVER_ONLY flag. Signed-off-by: Christian Lamparter

[RFC PATCH 10/12] crypto: crypto4xx: replace crypto4xx_dev's scatter_buffer_size with constant

2017-08-25 Thread Christian Lamparter
scatter_buffer_size is always set to PPC4XX_SD_BUFFER_SIZE. I don't think there's any point in keeping the variable around. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 7 +++ drivers/crypto/amcc/crypto4xx_core.h | 1 - 2 files changed, 3 insert

[PATCH 06/12] crypto: crypto4xx: fix dynamic_sa_ctl's sa_contents declaration

2017-08-25 Thread Christian Lamparter
The driver had a union dynamic_sa_contents in place that described the meaning of the bits in the sa_contents variable. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 4 ++-- drivers/crypto/amcc/crypto4xx_sa.c | 12 ++-- drivers/crypto/amcc/crypto4xx_sa.h

[PATCH] crypto4xx: add prng crypto support

2018-12-22 Thread Christian Lamparter
ned-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c| 87 + drivers/crypto/amcc/crypto4xx_core.h| 4 ++ drivers/crypto/amcc/crypto4xx_reg_def.h | 1 + 3 files changed, 92 insertions(+) diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/driv

[PATCH 1/4] crypto4xx: fix ctr-aes missing output IV

2019-04-22 Thread Christian Lamparter
ain). - don't load any bogus hash when we don't use any hash operation to begin with. Cc: sta...@vger.kernel.org Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/crypt

[PATCH 4/4] crypto4xx: get rid of redundant using_sd variable

2019-04-22 Thread Christian Lamparter
using_sd is used as a stand-in for sa_command_0.bf.scatter that we need to set anyway, so we might as well just prevent double-accounting. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 6 ++ drivers/crypto/amcc/crypto4xx_core.h | 1 - 2 files changed, 2

[PATCH 3/4] crypto4xx: use sync skcipher for fallback

2019-04-22 Thread Christian Lamparter
This replaces struct crypto_skcipher and the extra request size with struct crypto_sync_skcipher and SYNC_SKCIPHER_REQUEST_ON_STACK(), which uses a fixed stack size. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 12 ++-- drivers/crypto/amcc

[PATCH 2/4] crypto4xx: fix cfb and ofb "overran dst buffer" issues

2019-04-22 Thread Christian Lamparter
o kills redundant pd_uinfo->num_gd and pd_uinfo->num_sd setters since the value has already been set before. Cc: sta...@vger.kernel.org Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 31 +++- 1 file changed, 21 insertions(+), 10 deletio

Re: [PATCH 1/4] crypto4xx: fix ctr-aes missing output IV

2019-04-22 Thread Christian Lamparter
On 4/22/19, Sasha Levin wrote: > Hi, > > [This is an automated email] > > This commit has been processed because it contains a -stable tag. > The stable tag indicates that it's relevant for the following trees: all > > The bot has tested the following trees: v5.0.9, v4.19.36, v4.14.113, > v4.9.170

Re: [PATCH 2/4] crypto4xx: fix cfb and ofb "overran dst buffer" issues

2019-04-22 Thread Christian Lamparter
On 4/22/19, Sasha Levin wrote: > Hi, > > [This is an automated email] > > This commit has been processed because it contains a -stable tag. > The stable tag indicates that it's relevant for the following trees: all > > The bot has tested the following trees: v5.0.9, v4.19.36, v4.14.113, > v4.9.170

[PATCH] crypto: crypto4xx - fix AES CTR blocksize value

2019-05-17 Thread Christian Lamparter
g Fixes: 98e87e3d933b ("crypto: crypto4xx - add aes-ctr support") Fixes: f2a13e7cba9e ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads") Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 4 ++-- 1 file changed, 2 insertions(+)

[PATCH 1/2] crypto: crypto4xx - fix blocksize for cfb and ofb

2019-05-18 Thread Christian Lamparter
) doesn't match generic impl (1) skcipher: blocksize for cfb-aes-ppc4xx (16) doesn't match generic impl (1) Cc: Eric Biggers Cc: sta...@vger.kernel.org Fixes: f2a13e7cba9e ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads") Signed-off-by: Christian Lamparter ---

[PATCH 2/2] crypto: crypto4xx - block ciphers should only accept complete blocks

2019-05-18 Thread Christian Lamparter
;random: len=1011 klen=32"; expected_error=-22, cfg="random: may_sleep use_digest src_divs=[100.0%@alignmask+20] dst_divs=[3.12%@+3001, 96.88%@+4070]" Cc: Eric Biggers Cc: sta...@vger.kernel.org [4.19, 5.0 and 5.1] Signed-off-by: Christian Lamparter --- Note: This bug was pres

[RFC PATCH] crypto: skcipher - perform len fits into blocksize check at the top

2019-05-18 Thread Christian Lamparter
This patch adds early check to test the given data length is aligned with the supported ciphers blocksize, or abort with -EINVAL in case the supplied chunk size does not fit without padding into the blocksize for block ciphers. Signed-off-by: Christian Lamparter --- This will also work instead

Re: crypto: crypto4xx - properly set IV after de- and encrypt breaks kernel 4.4

2019-06-20 Thread Christian Lamparter
://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=e9a60ab1609a7d975922adad1bf9c46ac6954584 > > I do not have hardware to test if it is really working. I have a few APM821XX. But please note drivers without commit b66c685a482117d4e9ee987d252ca673689a5302 Author: Christia

Re: [PATCH] crypto: crypto4xx - Replace bitwise OR with logical OR in crypto4xx_build_pd

2020-11-12 Thread Christian Lamparter
CTL_HASH_FINAL : 0); pd->pd_ctl_len.w = 0x0040 | (assoclen + datalen); pd_uinfo->state = PD_ENTRY_INUSE | (is_busy ? PD_ENTRY_BUSY : 0); --- I'm mostly curious if clang will warn about it too. That said: Reviewed-by: Christian Lamparter Cheers, Christian Fixes: 4b5b79

Re: [PATCH 0/5] crypto: Implement cmac based on cbc skcipher

2020-08-22 Thread Christian Lamparter
On 2020-08-19 00:27, Herbert Xu wrote: On Wed, Aug 19, 2020 at 08:15:50AM +1000, Herbert Xu wrote: On Tue, Aug 18, 2020 at 07:17:35AM -0700, Ben Greear wrote: Is there any easy way to use your work to make shash fast for aesni? I basically just want it to perform as well as it used to with my

[RFC 13/13] crypto: crypto4xx: add aes-gcm support

2017-10-03 Thread Christian Lamparter
This patch adds aes-gcm support to crypto4xx. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 139 +++ drivers/crypto/amcc/crypto4xx_core.c | 22 ++ drivers/crypto/amcc/crypto4xx_core.h | 4 + 3 files changed, 165 insertions

[PATCH 05/13] crypto: crypto4xx: add backlog queue support

2017-10-03 Thread Christian Lamparter
dropped to 0 Kbits/s. This is because dm-crypt's callback would instantly queue the next request. In order to not starve ipsec, the driver reserves a small portion of the available crypto contexts for this purpose. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto

[PATCH 01/13] crypto: crypto4xx: wire up hmac_mc to hmac_muting

2017-10-03 Thread Christian Lamparter
The hmac_mc parameter of set_dynamic_sa_command_1() was defined but not used. On closer inspection it turns out, it was never wired up. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/amcc

[PATCH 10/13] crypto: crypto4xx: simplify sa and state context acquisition

2017-10-03 Thread Christian Lamparter
Thanks to the big overhaul of crypto4xx_build_pd(), the request-local sa_in, sa_out and state_record allocation can be simplified. There's no need to setup any dma coherent memory anymore and much of the support code can be removed. Signed-off-by: Christian Lamparter --- drivers/crypto

[PATCH 07/13] crypto: crypto4xx: overhaul crypto4xx_build_pd()

2017-10-03 Thread Christian Lamparter
nsafe sa handling. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 87 +++- drivers/crypto/amcc/crypto4xx_core.c | 128 --- drivers/crypto/amcc/crypto4xx_core.h | 12 ++-- 3 files changed, 103 insertions(+), 124 d

[RFC 12/13] crypto: crypto4xx: add aes-ccm support

2017-10-03 Thread Christian Lamparter
This patch adds aes-ccm support. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 185 +++ drivers/crypto/amcc/crypto4xx_core.c | 23 + drivers/crypto/amcc/crypto4xx_core.h | 8 ++ 3 files changed, 216 insertions(+) diff --git

[RFC 11/13] crypto: crypto4xx: prepare for AEAD support

2017-10-03 Thread Christian Lamparter
This patch enhances existing interfaces and functions to support AEAD ciphers in the next patches. Signed-off-by: Christian Lamparter --- drivers/crypto/Kconfig | 4 + drivers/crypto/amcc/crypto4xx_alg.c | 19 +-- drivers/crypto/amcc/crypto4xx_core.c | 217

[PATCH 08/13] crypto: crypto4xx: fix various warnings

2017-10-03 Thread Christian Lamparter
xx_return_pd' was not declared. Should it be static? crypto4xx_return_pd() is not used by anything. Therefore it is removed. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 16 +++- 1 file changed, 3 insertions(+), 13 deletions(-) di

[PATCH 06/13] crypto: crypto4xx: use the correct LE32 format for IV and key defs

2017-10-03 Thread Christian Lamparter
state record struct though. The hashes produced by GHASH and CBC (for CCM) will be in LE32. Whereas md5 and sha{1/,256,...} do not need any conversion. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 4 +-- drivers/crypto/amcc/crypto4xx_core.c

[PATCH 03/13] crypto: crypto4xx: fix type mismatch compiler error

2017-10-03 Thread Christian Lamparter
This patch fixes a type mismatch error that I accidentally introduced when I moved and refactored the dynamic_contents helpers. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_sa.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/amcc

[PATCH 09/13] crypto: crypto4xx: fix stalls under heavy load

2017-10-03 Thread Christian Lamparter
than a day without suffering any stalls under the continuous load. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c| 33 ++--- drivers/crypto/amcc/crypto4xx_reg_def.h | 3 +++ 2 files changed, 21 insertions(+), 15 deletions(-) diff

[PATCH 04/13] crypto: crypto4xx: increase context and scatter ring buffer elements

2017-10-03 Thread Christian Lamparter
PPC4XX_LAST_PD can be easily calculated from their respective PPC4XX_NUM_* constant. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.h | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/amcc/crypto4xx_core.h b/drivers/crypto/amcc

[PATCH 02/13] crypto: crypto4xx: fix off-by-one AES-OFB

2017-10-03 Thread Christian Lamparter
: crypto4xx priority : 300 refcnt : 1 selftest : passed internal : no type : ablkcipher async: yes blocksize: 16 min keysize : 16 max keysize : 32 ivsize : 16 geniv: Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 2

[PATCH v1 2/4] crypto: crypto4xx - support Revision B parts

2017-12-22 Thread Christian Lamparter
This patch adds support for the crypto4xx RevB cores found in the 460EX, 460SX and later cores (like the APM821xx). Without this patch, the crypto4xx driver will not be able to process any offloaded requests and simply hang indefinitely. Signed-off-by: Christian Lamparter --- drivers/crypto

[PATCH v1 1/4] crypto: crypto4xx - shuffle iomap in front of request_irq

2017-12-22 Thread Christian Lamparter
can be avoided. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 21 + 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c index c44954e274bc..50d5e64fbd

[PATCH v1 3/4] crypto: crypto4xx - fix missing irq devname

2017-12-22 Thread Christian Lamparter
crypto4xx_device's name variable is not set to anything. The common devname for request_irq seems to be the module name. This will fix the seemingly anonymous interrupt entry in /proc/interrupts for crypto4xx. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.

[PATCH v1 4/4] crypto: crypto4xx - kill MODULE_NAME

2017-12-22 Thread Christian Lamparter
KBUILD_MODNAME provides the same value. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_core.c | 2 +- drivers/crypto/amcc/crypto4xx_core.h | 2 -- drivers/crypto/amcc/crypto4xx_trng.c | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/crypto

[PATCH v1] crypto: crypto4xx - perform aead icv check in the driver

2017-12-23 Thread Christian Lamparter
: ccm(aes) |driver : ccm-aes-ppc4xx |module : crypto4xx |priority : 300 |refcnt : 1 |selftest : passed |internal : no |type : aead |async: yes |blocksize: 1 |ivsize : 16 |maxauthsize : 16 |geniv: Signed-off-by: Christian

[PATCH v1 7/7] crypto: crypto4xx - put temporary dst sg into request ctx

2018-04-19 Thread Christian Lamparter
;s request context. Fixes: a0aae821ba3d3 ("crypto: crypto4xx - prepare for AEAD support") Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 15 --- drivers/crypto/amcc/crypto4xx_core.c | 10 +- drivers/crypto/amcc/crypto4xx_core.h | 7 ++-

[PATCH v1 6/7] crypto: crypto4xx - extend aead fallback checks

2018-04-19 Thread Christian Lamparter
it is part of the cryptlen. Otherwise the hardware will think it has been misconfigured and will return: aead return err status = 0x98 For rtc4543(gcm(aes)), the hardware has a dedicated GMAC mode as part of the hash function set. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc

[PATCH v1 2/7] crypto: crypto4xx - convert to skcipher

2018-04-19 Thread Christian Lamparter
The ablkcipher APIs have been effectively deprecated since [1]. This patch converts the crypto4xx driver to the new skcipher APIs. [1] <https://www.spinics.net/lists/linux-crypto/msg18133.html> Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 60 --- d

[PATCH v1 1/7] crypto: crypto4xx - performance optimizations

2018-04-19 Thread Christian Lamparter
This patch provides a cheap 2MiB/s+ (~ 6%) performance improvement over the current code. This is because the compiler can now optimize several endian swap memcpy. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc/crypto4xx_alg.c | 32 +--- drivers/crypto/amcc

[PATCH v1 4/7] crypto: crypto4xx - add aes-ctr support

2018-04-19 Thread Christian Lamparter
. The aead's crypto4xx_setup_fallback() function is renamed to crypto4xx_aead_setup_fallback. Signed-off-by: Christian Lamparter --- drivers/crypto/Kconfig | 1 + drivers/crypto/amcc/crypto4xx_alg.c | 91 ++-- drivers/crypto/amcc/crypto4xx_core.c

[PATCH v1 3/7] crypto: crypto4xx - avoid VLA use

2018-04-19 Thread Christian Lamparter
This patch fixes some of the -Wvla warnings. crypto4xx_alg.c:83:19: warning: Variable length array is used. crypto4xx_alg.c:273:56: warning: Variable length array is used. crypto4xx_alg.c:380:32: warning: Variable length array is used. Signed-off-by: Christian Lamparter --- drivers/crypto/amcc

[PATCH v1 5/7] crypto: crypto4xx - properly set IV after de- and encrypt

2018-04-19 Thread Christian Lamparter
ver : cts(cbc-aes-ppc4xx) module : cts priority : 300 refcnt : 1 selftest : passed internal : no type : skcipher async: yes blocksize: 16 min keysize : 16 max keysize : 32 ivsize : 16 chunksize: 16 walksize : 16 Signed-off-by: Christian Lampar

Re: [PATCH v1 1/7] crypto: crypto4xx - performance optimizations

2018-04-28 Thread Christian Lamparter
On Samstag, 28. April 2018 10:25:51 CEST Herbert Xu wrote: > Christian Lamparter wrote: > > This patch provides a cheap 2MiB/s+ (~ 6%) performance > > improvement over the current code. This is because the > > compiler can now optimize several endian swap memcpy. > > &