Re: [PATCH v3 3/4] crypto: amlogic: Add crypto accelerator for amlogic GXL

2019-10-17 Thread Neil Armstrong
On 17/10/2019 07:06, Corentin Labbe wrote: > This patch adds support for the amlogic GXL cryptographic offloader present > on GXL SoCs. > > This driver supports AES cipher in CBC/ECB mode. > > Signed-off-by: Corentin Labbe > --- > drivers/crypto/Kconfig | 2 + > drivers/c

Re: [RFT PATCH 0/3] crypto: s390 - convert to skcipher API

2019-10-17 Thread Heiko Carstens
On Wed, Oct 16, 2019 at 11:35:07PM +1100, Herbert Xu wrote: > > > Eric Biggers (3): > > > crypto: s390/aes - convert to skcipher API > > > crypto: s390/paes - convert to skcipher API > > > crypto: s390/des - convert to skcipher API > > > > > > arch/s390/crypto/aes_s390.c | 609

Re: [PATCH -next 01/13] hwrng: atmel - use devm_platform_ioremap_resource() to simplify code

2019-10-17 Thread Ludovic Desroches
On Wed, Oct 16, 2019 at 06:46:09PM +0800, YueHaibing wrote: > External E-Mail > > > Use devm_platform_ioremap_resource() to simplify the code a bit. > This is detected by coccinelle. > > Signed-off-by: YueHaibing Acked-by: Ludovic Desroches Thanks > --- > drivers/char/hw_random/atmel-rng.c

Re: [PATCH v5 2/2] crypto: add test vectors for blake2b

2019-10-17 Thread Ard Biesheuvel
On Mon, 14 Oct 2019 at 11:17, David Sterba wrote: > > Test vectors for blake2b with various digest sizes. As the algorithm is > the same up to the digest calculation, the key and input data length is > distributed in a way that tests all combinanions of the two over the > digest sizes. > > Based o

Re: [PATCH 05/25] crypto: omap - switch to skcipher API

2019-10-17 Thread Tero Kristo
On 15/10/2019 20:28, Tony Lindgren wrote: * Ard Biesheuvel [191014 12:20]: Commit 7a7ffe65c8c5 ("crypto: skcipher - Add top-level skcipher interface") dated 20 august 2015 introduced the new skcipher API which is supposed to replace both blkcipher and ablkcipher. While all consumers of the API

Re: [PATCH 05/25] crypto: omap - switch to skcipher API

2019-10-17 Thread Ard Biesheuvel
On Thu, 17 Oct 2019 at 12:25, Tero Kristo wrote: > > On 15/10/2019 20:28, Tony Lindgren wrote: > > * Ard Biesheuvel [191014 12:20]: > >> Commit 7a7ffe65c8c5 ("crypto: skcipher - Add top-level skcipher interface") > >> dated 20 august 2015 introduced the new skcipher API which is supposed to > >>

Re: [PATCH 05/25] crypto: omap - switch to skcipher API

2019-10-17 Thread Tero Kristo
On 17/10/2019 13:45, Ard Biesheuvel wrote: On Thu, 17 Oct 2019 at 12:25, Tero Kristo wrote: On 15/10/2019 20:28, Tony Lindgren wrote: * Ard Biesheuvel [191014 12:20]: Commit 7a7ffe65c8c5 ("crypto: skcipher - Add top-level skcipher interface") dated 20 august 2015 introduced the new skcipher

Re: [PATCH 05/25] crypto: omap - switch to skcipher API

2019-10-17 Thread Ard Biesheuvel
On Thu, 17 Oct 2019 at 13:25, Tero Kristo wrote: > > On 17/10/2019 13:45, Ard Biesheuvel wrote: > > On Thu, 17 Oct 2019 at 12:25, Tero Kristo wrote: > >> > >> On 15/10/2019 20:28, Tony Lindgren wrote: > >>> * Ard Biesheuvel [191014 12:20]: > Commit 7a7ffe65c8c5 ("crypto: skcipher - Add top-

Re: [PATCH 05/25] crypto: omap - switch to skcipher API

2019-10-17 Thread Tero Kristo
On 17/10/2019 14:56, Ard Biesheuvel wrote: On Thu, 17 Oct 2019 at 13:25, Tero Kristo wrote: On 17/10/2019 13:45, Ard Biesheuvel wrote: On Thu, 17 Oct 2019 at 12:25, Tero Kristo wrote: On 15/10/2019 20:28, Tony Lindgren wrote: * Ard Biesheuvel [191014 12:20]: Commit 7a7ffe65c8c5 ("crypto

[PATCH 00/10] crypto: omap fixes towards 5.5

2019-10-17 Thread Tero Kristo
Hi, This series fixes a number of bugs with omap crypto implementation. These have become evident with the changes to the cryptomanager, where it adds some new test cases and modifies some existing, namely the split update tests. Also, while fixing the cryptomanager induced bugs, some other surfac

[PATCH 02/10] crypto: omap-sham: remove the sysfs group during driver removal

2019-10-17 Thread Tero Kristo
The driver removal should also cleanup the created sysfs group. If not, the driver fails the subsequent probe as the files exist already. Signed-off-by: Tero Kristo --- drivers/crypto/omap-sham.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/om

[PATCH 06/10] crypto: omap-sham: fix buffer handling for split test cases

2019-10-17 Thread Tero Kristo
Current buffer handling logic fails in a case where the buffer contains existing data from previous update which is divisible by block size. This results in a block size of data to be left missing from the sg list going out to the hw accelerator, ending up in stalling the crypto accelerator driver

[PATCH 03/10] crypto: omap-aes: remove the sysfs group during driver removal

2019-10-17 Thread Tero Kristo
The driver removal should also cleanup the created sysfs group. If not, the driver fails the subsequent probe as the files exist already. Also, drop a completely unnecessary pointer assignment from the removal function at the same time. Signed-off-by: Tero Kristo --- drivers/crypto/omap-aes.c |

[PATCH 07/10] crypto: omap-aes-gcm: fix corner case with only auth data

2019-10-17 Thread Tero Kristo
Fix a corner case where only authdata is generated, without any provided assocdata / cryptdata. Passing the empty scatterlists to OMAP AES core driver in this case would confuse it, failing to map DMAs. Signed-off-by: Tero Kristo --- drivers/crypto/omap-aes-gcm.c | 22 ++ 1 f

[PATCH 04/10] crypto: omap-des: add IV output handling

2019-10-17 Thread Tero Kristo
Currently omap-des driver does not copy end result IV out at all. This is evident with the additional checks done at the crypto test manager. Fix by copying out the IV values from HW. Signed-off-by: Tero Kristo --- drivers/crypto/omap-des.c | 6 ++ 1 file changed, 6 insertions(+) diff --git

[PATCH 05/10] crypto: omap-aes: add IV output handling

2019-10-17 Thread Tero Kristo
Currently omap-aes driver does not copy end result IV out at all. This is evident with the additional checks done at the crypto test manager. Fix by copying out the IV values from HW. Signed-off-by: Tero Kristo --- drivers/crypto/omap-aes.c | 12 1 file changed, 12 insertions(+) di

[PATCH 08/10] crypto: omap-sham: fix split update cases with cryptomgr tests

2019-10-17 Thread Tero Kristo
The updated crypto manager finds a couple of new bugs from the omap-sham driver. Basically the split update cases fail to calculate the amount of data to be sent properly, leading into failed results and hangs with the hw accelerator. To fix these, the buffer handling needs to be fixed, but we do

[PATCH 10/10] crypto: omap-aes: fixup aligned data cleanup

2019-10-17 Thread Tero Kristo
Aligned data cleanup is using wrong pointers in the cleanup calls. Most of the time these are right, but can cause mysterious problems in some cases. Fix to use the same pointers that were used with the align call. Signed-off-by: Tero Kristo --- drivers/crypto/omap-aes.c | 4 ++-- 1 file changed

[PATCH 09/10] crypto: add timeout to crypto_wait_req

2019-10-17 Thread Tero Kristo
Currently crypto_wait_req waits indefinitely for an async crypto request to complete. This is bad as it can cause for example the crypto test manager to hang without any notification as to why it has happened. Instead of waiting indefinitely, add a 1 second timeout to the call, and provide a warnin

[PATCH 01/10] crypto: omap-sham: split up data to multiple sg elements with huge data

2019-10-17 Thread Tero Kristo
When using huge data amount, allocating free pages fails as the kernel isn't able to process get_free_page requests larger than MAX_ORDER. Also, the DMA subsystem has an inherent limitation that data size larger than some 2MB can't be handled properly. In these cases, split up the data instead to s

Re: [PATCH] KEYS: asym_tpm: Switch to get_random_bytes()

2019-10-17 Thread Sumit Garg
On Thu, 17 Oct 2019 at 00:40, James Bottomley wrote: > > On Wed, 2019-10-16 at 19:25 +0300, Jarkko Sakkinen wrote: > > On Wed, Oct 16, 2019 at 08:34:12AM -0400, James Bottomley wrote: > > > reversible ciphers are generally frowned upon in random number > > > generation, that's why the krng uses ch

Re: [PATCH] KEYS: asym_tpm: Switch to get_random_bytes()

2019-10-17 Thread James Bottomley
On Thu, 2019-10-17 at 18:22 +0530, Sumit Garg wrote: > On Thu, 17 Oct 2019 at 00:40, James Bottomley > wrote: > > > > On Wed, 2019-10-16 at 19:25 +0300, Jarkko Sakkinen wrote: > > > On Wed, Oct 16, 2019 at 08:34:12AM -0400, James Bottomley wrote: > > > > reversible ciphers are generally frowned u

RE: [PATCH 3/3] crypto: inside-secure - Remove #ifdef checks

2019-10-17 Thread Pascal Van Leeuwen
Hi Arnd, Sorry for not responding earlier, but I've been very busy lately. So I'm looking at this now for the first time. > -Original Message- > From: Arnd Bergmann > Sent: Monday, September 30, 2019 2:15 PM > To: Antoine Tenart ; Herbert Xu > ; > David S. Miller ; Bjorn Helgaas > Cc:

Re: [PATCH] crypto: fix comparison of unsigned expression warnings

2019-10-17 Thread Gilad Ben-Yossef
On Mon, Sep 30, 2019 at 11:52 AM Tian Tao wrote: > > This patch fixes the following warnings: > drivers/crypto/ccree/cc_aead.c:630:5-12: WARNING: Unsigned expression > compared with zero: seq_len > 0 Thank you very much for the patch. Please accept my apologies that it took me some time to respon

Re: [PATCH 3/3] crypto: inside-secure - Remove #ifdef checks

2019-10-17 Thread Arnd Bergmann
On Thu, Oct 17, 2019 at 3:26 PM Pascal Van Leeuwen wrote: > > /* Register PCI driver */ > > - pcireg_rc = pci_register_driver(&safexcel_pci_driver); > > -#endif > > + ret = pci_register_driver(&safexcel_pci_driver); > > > > -#if IS_ENABLED(CONFIG_OF) > > /* Register platform d

Re: [RFT PATCH 2/3] crypto: s390/paes - convert to skcipher API

2019-10-17 Thread Harald Freudenberger
On 16.10.19 19:05, Eric Biggers wrote: > On Tue, Oct 15, 2019 at 01:31:39PM +0200, Harald Freudenberger wrote: >> On 12.10.19 22:18, Eric Biggers wrote: >>> From: Eric Biggers >>> >>> Convert the glue code for the S390 CPACF protected key implementations >>> of AES-ECB, AES-CBC, AES-XTS, and AES-C

RE: [PATCH 3/3] crypto: inside-secure - Remove #ifdef checks

2019-10-17 Thread Pascal Van Leeuwen
> -Original Message- > From: Arnd Bergmann > Sent: Thursday, October 17, 2019 3:48 PM > To: Pascal Van Leeuwen > Cc: Antoine Tenart ; Herbert Xu > ; > David S. Miller ; Bjorn Helgaas ; > Pascal van Leeuwen > ; Kelsey Skunberg ; linux- > cry...@vger.kernel.org; linux-ker...@vger.kernel.o

Re: [PATCH 07/25] crypto: s5p - switch to skcipher API

2019-10-17 Thread Kamil Konieczny
Hi, On 14.10.2019 14:18, Ard Biesheuvel wrote: > Commit 7a7ffe65c8c5 ("crypto: skcipher - Add top-level skcipher interface") > dated 20 august 2015 introduced the new skcipher API which is supposed to > replace both blkcipher and ablkcipher. While all consumers of the API have > been converted lon

Re: [PATCH 07/25] crypto: s5p - switch to skcipher API

2019-10-17 Thread Ard Biesheuvel
On Thu, 17 Oct 2019 at 17:18, Kamil Konieczny wrote: > > Hi, > > On 14.10.2019 14:18, Ard Biesheuvel wrote: > > Commit 7a7ffe65c8c5 ("crypto: skcipher - Add top-level skcipher interface") > > dated 20 august 2015 introduced the new skcipher API which is supposed to > > replace both blkcipher and a

RE: [PATCH -next] crypto: inside-secure - Fix randbuild error

2019-10-17 Thread Pascal Van Leeuwen
> -Original Message- > From: linux-crypto-ow...@vger.kernel.org > On Behalf Of > Pascal Van Leeuwen > Sent: Tuesday, October 8, 2019 9:57 AM > To: Ard Biesheuvel > Cc: YueHaibing ; herb...@gondor.apana.org.au; > da...@davemloft.net; > pascalv...@gmail.com; antoine.ten...@bootlin.com; >

RE: [PATCH -next] crypto: inside-secure: fix build error for safexcel_hash.c

2019-10-17 Thread Pascal Van Leeuwen
> -Original Message- > From: linux-crypto-ow...@vger.kernel.org > On Behalf Of > Randy Dunlap > Sent: Wednesday, October 9, 2019 5:50 PM > To: LKML ; Linux Crypto Mailing List cry...@vger.kernel.org> > Cc: Antoine Tenart ; Herbert Xu > ; David Miller > Subject: [PATCH -next] crypto: ins

[PATCH] crypto: inside-secure - Fix build error with CONFIG_CRYPTO_SM3=m

2019-10-17 Thread Pascal van Leeuwen
Always take the zero length hash value for SM3 from the local constant to avoid a reported build error when SM3 is configured to be a module. Signed-off-by: Pascal van Leeuwen --- drivers/crypto/inside-secure/safexcel_hash.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --g

[PATCH] crypto: inside-secure - Made locally used safexcel_pci_remove() static

2019-10-17 Thread Pascal van Leeuwen
safexcel_pci_remove() is only used locally in the module and not exported, so added a static function specifier. This fixes a sparse issue reported by Ben Dooks. Signed-off-by: Pascal van Leeuwen --- drivers/crypto/inside-secure/safexcel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) d

RE: [PATCH] crypto: inside-secure - fix unexported warnings

2019-10-17 Thread Pascal Van Leeuwen
> -Original Message- > From: linux-crypto-ow...@vger.kernel.org > On Behalf Of Ben > Dooks (Codethink) > Sent: Wednesday, October 16, 2019 1:45 PM > To: linux-ker...@lists.codethink.co.uk > Cc: Ben Dooks (Codethink) ; Antoine Tenart > ; Herbert Xu ; David > S. Miller > ; linux-crypto@v

RE: [PATCH] crypto: inside-secure - fix type of buffer in eip197_write_firmware

2019-10-17 Thread Pascal Van Leeuwen
> -Original Message- > From: linux-crypto-ow...@vger.kernel.org > On Behalf Of Ben > Dooks (Codethink) > Sent: Wednesday, October 16, 2019 1:50 PM > To: linux-ker...@lists.codethink.co.uk > Cc: Ben Dooks (Codethink) ; Antoine Tenart > ; Herbert Xu ; David > S. Miller > ; linux-crypto@vge

Re: [PATCH] KEYS: asym_tpm: Switch to get_random_bytes()

2019-10-17 Thread Jarkko Sakkinen
On Wed, Oct 16, 2019 at 03:10:29PM -0400, James Bottomley wrote: > On Wed, 2019-10-16 at 19:25 +0300, Jarkko Sakkinen wrote: > > On Wed, Oct 16, 2019 at 08:34:12AM -0400, James Bottomley wrote: > > > reversible ciphers are generally frowned upon in random number > > > generation, that's why the krn

[PATCH v4 07/35] crypto: arm/chacha - import Eric Biggers's scalar accelerated ChaCha code

2019-10-17 Thread Ard Biesheuvel
Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/chacha-scalar-core.S | 461 1 file changed, 461 insertions(+) diff --git a/arch/arm/crypto/chacha-scalar-core.S b/arch/arm/crypto/chacha-scalar-core.S new file mode 100644 index ..2140319b64a0 --- /dev/null +++ b

[PATCH v4 06/35] crypto: arm64/chacha - expose arm64 ChaCha routine as library function

2019-10-17 Thread Ard Biesheuvel
Expose the accelerated NEON ChaCha routine directly as a symbol export so that users of the ChaCha library API can use it directly. Given that calls into the library API will always go through the routines in this module if it is enabled, switch to static keys to select the optimal implementation

[PATCH v4 04/35] crypto: x86/chacha - expose SIMD ChaCha routine as library function

2019-10-17 Thread Ard Biesheuvel
Wire the existing x86 SIMD ChaCha code into the new ChaCha library interface, so that users of the library interface will get the accelerated version when available. Given that calls into the library API will always go through the routines in this module if it is enabled, switch to static keys to

[PATCH v4 02/35] crypto: chacha - move existing library code into lib/crypto

2019-10-17 Thread Ard Biesheuvel
Currently, our generic ChaCha implementation consists of a permute function in lib/chacha.c that operates on the 64-byte ChaCha state directly [and which is always included into the core kernel since it is used by the /dev/random driver], and the crypto API plumbing to expose it as a skcipher. In

[PATCH v4 05/35] crypto: arm64/chacha - depend on generic chacha library instead of crypto driver

2019-10-17 Thread Ard Biesheuvel
Depend on the generic ChaCha library routines instead of pulling in the generic ChaCha skcipher driver, which is more than we need, and makes managing the dependencies between the generic library, generic driver, accelerated library and driver more complicated. While at it, drop the logic to prefe

[PATCH v4 09/35] crypto: arm/chacha - expose ARM ChaCha routine as library function

2019-10-17 Thread Ard Biesheuvel
Expose the accelerated NEON ChaCha routine directly as a symbol export so that users of the ChaCha library API can use it directly. Given that calls into the library API will always go through the routines in this module if it is enabled, switch to static keys to select the optimal implementation

[PATCH v4 11/35] crypto: mips/chacha - wire up accelerated 32r2 code from Zinc

2019-10-17 Thread Ard Biesheuvel
This integrates the accelerated MIPS 32r2 implementation of ChaCha into both the API and library interfaces of the kernel crypto stack. The significance of this is that, in addition to becoming available as an accelerated library implementation, it can also be used by existing crypto API code such

[PATCH v4 01/35] crypto: tidy up lib/crypto Kconfig and Makefile

2019-10-17 Thread Ard Biesheuvel
In preparation of introducing a set of crypto library interfaces, tidy up the Makefile and split off the Kconfig symbols into a separate file. Signed-off-by: Ard Biesheuvel --- crypto/Kconfig | 13 + lib/crypto/Kconfig | 15 +++ lib/crypto/Makefile | 16

[PATCH v4 00/35] crypto: crypto API library interfaces for WireGuard

2019-10-17 Thread Ard Biesheuvel
This series implements the crypto library abstractions that are needed to incorporate WireGuard into the mainline kernel. Changes since v3: - Unify the way the generic vs arch libraries are organized between ChaCha20 and Poly1305 on the one hand and Curve25519 and Blake2s on the other. All are

[PATCH v4 23/35] crypto: testmgr - add test cases for Blake2s

2019-10-17 Thread Ard Biesheuvel
As suggested by Eric for the Blake2b implementation contributed by David, introduce a set of test vectors for Blake2s covering different digest and key sizes. blake2s-128 blake2s-160 blake2s-224 blake2s-256 --- len=0 | klen=0

[PATCH v4 10/35] crypto: mips/chacha - import 32r2 ChaCha code from Zinc

2019-10-17 Thread Ard Biesheuvel
From: "Jason A. Donenfeld" This imports the accelerated MIPS 32r2 ChaCha20 implementation from the Zinc patch set. Co-developed-by: René van Dorst Signed-off-by: René van Dorst Signed-off-by: Jason A. Donenfeld Signed-off-by: Ard Biesheuvel --- arch/mips/crypto/chacha-core.S | 424 +

[PATCH v4 03/35] crypto: x86/chacha - depend on generic chacha library instead of crypto driver

2019-10-17 Thread Ard Biesheuvel
In preparation of extending the x86 ChaCha driver to also expose the ChaCha library interface, drop the dependency on the chacha_generic crypto driver as a non-SIMD fallback, and depend on the generic ChaCha library directly. This way, we only pull in the code we actually need, without registering

[PATCH v4 24/35] crypto: blake2s - implement generic shash driver

2019-10-17 Thread Ard Biesheuvel
Wire up our newly added Blake2s implementation via the shash API. Signed-off-by: Ard Biesheuvel --- crypto/Kconfig| 4 + crypto/Makefile | 1 + crypto/blake2s-generic.c | 171 include/crypto/internal/blake2s.h | 5 + 4 fil

[PATCH v4 15/35] crypto: poly1305 - expose init/update/final library interface

2019-10-17 Thread Ard Biesheuvel
Expose the existing generic Poly1305 code via a init/update/final library interface so that callers are not required to go through the crypto API's shash abstraction to access it. At the same time, make some preparations so that the library implementation can be superseded by an accelerated arch-sp

[PATCH v4 12/35] crypto: chacha - unexport chacha_generic routines

2019-10-17 Thread Ard Biesheuvel
Now that all users of generic ChaCha code have moved to the core library, there is no longer a need for the generic ChaCha skcpiher driver to export parts of it implementation for reuse by other drivers. So drop the exports, and make the symbols static. Signed-off-by: Ard Biesheuvel --- crypto/c

[PATCH v4 16/35] crypto: x86/poly1305 - depend on generic library not generic shash

2019-10-17 Thread Ard Biesheuvel
Remove the dependency on the generic Poly1305 driver. Instead, depend on the generic library so that we only reuse code without pulling in the generic skcipher implementation as well. While at it, remove the logic that prefers the non-SIMD path for short inputs - this is no longer necessary after

[PATCH v4 13/35] crypto: poly1305 - move core routines into a separate library

2019-10-17 Thread Ard Biesheuvel
Move the core Poly1305 routines shared between the generic Poly1305 shash driver and the Adiantum and NHPoly1305 drivers into a separate library so that using just this pieces does not pull in the crypto API pieces of the generic Poly1305 routine. In a subsequent patch, we will augment this generi

[PATCH v4 17/35] crypto: x86/poly1305 - expose existing driver as poly1305 library

2019-10-17 Thread Ard Biesheuvel
Implement the arch init/update/final Poly1305 library routines in the accelerated SIMD driver for x86 so they are accessible to users of the Poly1305 library interface as well. Signed-off-by: Ard Biesheuvel --- arch/x86/crypto/poly1305_glue.c | 57 ++-- crypto/Kconfig

[PATCH v4 18/35] crypto: arm64/poly1305 - incorporate OpenSSL/CRYPTOGAMS NEON implementation

2019-10-17 Thread Ard Biesheuvel
This is a straight import of the OpenSSL/CRYPTOGAMS Poly1305 implementation for NEON authored by Andy Polyakov, and contributed by him to the OpenSSL project. The file 'poly1305-armv8.pl' is taken straight from this upstream GitHub repository [0] at commit ec55a08dc0244ce570c4fc7cade330c60798952f,

[PATCH v4 14/35] crypto: x86/poly1305 - unify Poly1305 state struct with generic code

2019-10-17 Thread Ard Biesheuvel
In preparation of exposing a Poly1305 library interface directly from the accelerated x86 driver, align the state descriptor of the x86 code with the one used by the generic driver. This is needed to make the library interface unified between all implementations. Signed-off-by: Ard Biesheuvel ---

[PATCH v4 08/35] crypto: arm/chacha - remove dependency on generic ChaCha driver

2019-10-17 Thread Ard Biesheuvel
Instead of falling back to the generic ChaCha skcipher driver for non-SIMD cases, use a fast scalar implementation for ARM authored by Eric Biggers. This removes the module dependency on chacha-generic altogether, which also simplifies things when we expose the ChaCha library interface from this mo

[PATCH v4 25/35] crypto: BLAKE2s - x86_64 SIMD implementation

2019-10-17 Thread Ard Biesheuvel
From: "Jason A. Donenfeld" These implementations from Samuel Neves support AVX and AVX-512VL. Originally this used AVX-512F, but Skylake thermal throttling made AVX-512VL more attractive and possible to do with negligable difference. Signed-off-by: Jason A. Donenfeld Signed-off-by: Samuel Neves

[PATCH v4 26/35] crypto: Curve25519 - generic C library implementations

2019-10-17 Thread Ard Biesheuvel
From: "Jason A. Donenfeld" This contains two formally verified C implementations of the Curve25519 scalar multiplication function, one for 32-bit systems, and one for 64-bit systems whose compiler supports efficient 128-bit integer types. Not only are these implementations formally verified, but

[PATCH v4 29/35] crypto: curve25519 - implement generic KPP driver

2019-10-17 Thread Ard Biesheuvel
Expose the generic Curve25519 library via the crypto API KPP interface. Signed-off-by: Ard Biesheuvel --- crypto/Kconfig | 5 ++ crypto/Makefile | 1 + crypto/curve25519-generic.c | 93 3 files changed, 99 insertions(+) diff --git a/crypto/Kconfig

[PATCH v4 27/35] crypto: testmgr - implement testing for KPP failures

2019-10-17 Thread Ard Biesheuvel
The Curve25519 drivers we will be implementing will perform validation of the inputs, and in order to ensure that these checks work as expected, we need to be able to test for expected errors. So implement this in the KPP test routines in the testmgr framework. Signed-off-by: Ard Biesheuvel ---

[PATCH v4 30/35] crypto: lib/curve25519 - work around Clang stack spilling issue

2019-10-17 Thread Ard Biesheuvel
Arnd reports that the 32-bit generic library code for Curve25119 ends up using an excessive amount of stack space when built with Clang: lib/crypto/curve25519-fiat32.c:756:6: error: stack frame size of 1384 bytes in function 'curve25519_generic' [-Werror,-Wframe-larger-than=] Let's

[PATCH v4 28/35] crypto: curve25519 - add kpp selftest

2019-10-17 Thread Ard Biesheuvel
In preparation of introducing KPP implementations of Curve25519, import the set of test cases proposed by the Zinc patch set, but converted to the KPP format. Signed-off-by: Ard Biesheuvel --- crypto/testmgr.c |6 + crypto/testmgr.h | 1603 2 files changed, 1609 insertio

[PATCH v4 22/35] crypto: BLAKE2s - generic C library implementation and selftest

2019-10-17 Thread Ard Biesheuvel
From: "Jason A. Donenfeld" The C implementation was originally based on Samuel Neves' public domain reference implementation but has since been heavily modified for the kernel. We're able to do compile-time optimizations by moving some scaffolding around the final function into the header file.

[PATCH v4 19/35] crypto: arm/poly1305 - incorporate OpenSSL/CRYPTOGAMS NEON implementation

2019-10-17 Thread Ard Biesheuvel
This is a straight import of the OpenSSL/CRYPTOGAMS Poly1305 implementation for NEON authored by Andy Polyakov, and contributed by him to the OpenSSL project. The file 'poly1305-armv4.pl' is taken straight from this upstream GitHub repository [0] at commit ec55a08dc0244ce570c4fc7cade330c60798952f,

[PATCH v4 20/35] crypto: mips/poly1305 - incorporate OpenSSL/CRYPTOGAMS optimized implementation

2019-10-17 Thread Ard Biesheuvel
This is a straight import of the OpenSSL/CRYPTOGAMS Poly1305 implementation for MIPS authored by Andy Polyakov, a prior 64-bit only version of which has been contributed by him to the OpenSSL project. The file 'poly1305-mips.pl' is taken straight from this upstream GitHub repository [0] at commit d

[PATCH v4 21/35] int128: move __uint128_t compiler test to Kconfig

2019-10-17 Thread Ard Biesheuvel
In order to use 128-bit integer arithmetic in C code, the architecture needs to have declared support for it by setting ARCH_SUPPORTS_INT128, and it requires a version of the toolchain that supports this at build time. This is why all existing tests for ARCH_SUPPORTS_INT128 also test whether __SIZE

[PATCH v4 33/35] crypto: arm/Curve25519 - wire up NEON implementation

2019-10-17 Thread Ard Biesheuvel
From: "Jason A. Donenfeld" This ports the SUPERCOP implementation for usage in kernel space. In addition to the usual header, macro, and style changes required for kernel space, it makes a few small changes to the code: - The stack alignment is relaxed to 16 bytes. - Superfluous mov statemen

[PATCH v4 31/35] crypto: Curve25519 - x86_64 library and KPP implementations

2019-10-17 Thread Ard Biesheuvel
From: "Jason A. Donenfeld" This implementation is the fastest available x86_64 implementation, and unlike Sandy2x, it doesn't requie use of the floating point registers at all. Instead it makes use of BMI2 and ADX, available on recent microarchitectures. The implementation was written by Armando

[PATCH v4 32/35] crypto: arm - import Bernstein and Schwabe's Curve25519 ARM implementation

2019-10-17 Thread Ard Biesheuvel
From: "Jason A. Donenfeld" This comes from Dan Bernstein and Peter Schwabe's public domain NEON code, and is included here in raw form so that subsequent commits that fix these up for the kernel can see how it has changed. This code does have some entirely cosmetic formatting differences, adding

[PATCH v4 35/35] crypto: lib/chacha20poly1305 - reimplement crypt_from_sg() routine

2019-10-17 Thread Ard Biesheuvel
Reimplement the library routines to perform chacha20poly1305 en/decryption on scatterlists, without [ab]using the [deprecated] blkcipher interface, which is rather heavyweight and does things we don't really need. Instead, we use the sg_miter API in a novel and clever way, to iterate over the scat

RE: [PATCH] crypto: inside-secure - fix type of buffer in eip197_write_firmware

2019-10-17 Thread Pascal Van Leeuwen
> -Original Message- > From: Pascal Van Leeuwen > Sent: Thursday, October 17, 2019 7:14 PM > To: 'Ben Dooks (Codethink)' ; linux- > ker...@lists.codethink.co.uk > Cc: Antoine Tenart ; Herbert Xu > ; David S. Miller ; linux- > cry...@vger.kernel.org; linux-ker...@vger.kernel.org > Subject: R

[PATCH] crypto: ccp - Retry SEV INIT command in case of integrity check failure.

2019-10-17 Thread Kalra, Ashish
From: Ashish Kalra SEV INIT command loads the SEV related persistent data from NVS and initializes the platform context. The firmware validates the persistent state. If validation fails, the firmware will reset the persisent state and return an integrity check failure status. At this point, a su

[PATCH] crypto: hash - initializing memory buffer for keys

2019-10-17 Thread Kangjie Lu
"ctx" is uninitialized. To avoid undefined behaviors or memory disclosures, we better initialize it. Signed-off-by: Kangjie Lu --- crypto/algif_hash.c | 1 + 1 file changed, 1 insertion(+) diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c index 178f4cd75ef1..129a124e5056 100644 --- a/crypt

Re: [PATCH v4 2/3] dt-bindings: rng: add bindings for MediaTek ARMv8 SoCs

2019-10-17 Thread Neal Liu
On Wed, 2019-10-02 at 21:47 +0800, Neal Liu wrote: > Dear Rob, > > Just a gentle ping. > > Neal > > On Wed, 2019-09-18 at 09:44 +0800, Neal Liu wrote: > > On Tue, 2019-07-23 at 22:35 +0800, Rob Herring wrote: > > > On Mon, Jul 22, 2019 at 8:21 PM Neal Liu wrote: > > > > > > > > > > Please don'

Re: [PATCH] crypto: hash - initializing memory buffer for keys

2019-10-17 Thread Herbert Xu
On Fri, Oct 18, 2019 at 12:04:56AM -0500, Kangjie Lu wrote: > "ctx" is uninitialized. To avoid undefined behaviors or memory > disclosures, we better initialize it. > > Signed-off-by: Kangjie Lu Please be more specific about what undefined behaviours you're referring to. Cheers, -- Email: Herb