[PATCH] Crypto: fixed a comment coding style issue

2019-06-22 Thread Aditya Parekh
Fixed a coding style issue. Signed-off-by: Aditya Parekh --- crypto/fcrypt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/fcrypt.c b/crypto/fcrypt.c index 4e8704405a3b..3828266af0b8 100644 --- a/crypto/fcrypt.c +++ b/crypto/fcrypt.c @@ -306,7 +306,8 @@ static int

Re: [PATCH v4 1/1] net: fastopen: robustness and endianness fixes for SipHash

2019-06-22 Thread David Miller
From: Ard Biesheuvel Date: Wed, 19 Jun 2019 23:46:28 +0200 > Some changes to the TCP fastopen code to make it more robust > against future changes in the choice of key/cookie size, etc. > > - Instead of keeping the SipHash key in an untyped u8[] buffer > and casting it to the right type upon u

[PATCH v2 11/26] crypto: arm/aes-neonbs - switch to library version of key expansion routine

2019-06-22 Thread Ard Biesheuvel
Switch to the new AES library that also provides an implementation of the AES key expansion routine. This removes the dependency on the generic AES cipher, allowing it to be omitted entirely in the future. Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/Kconfig | 2 +- arch/arm/crypt

[PATCH v2 21/26] crypto: arm/aes-neonbs - provide a synchronous version of ctr(aes)

2019-06-22 Thread Ard Biesheuvel
AES in CTR mode is used by modes such as GCM and CCM, which are often used in contexts where only synchronous ciphers are permitted. So provide a synchronous version of ctr(aes) based on the existing code. This requires a non-SIMD fallback to deal with invocations occurring from a context where SIM

[PATCH v2 10/26] crypto: arm64/ghash - switch to AES library

2019-06-22 Thread Ard Biesheuvel
The GHASH code uses the generic AES key expansion routines, and calls directly into the scalar table based AES cipher for arm64 from the fallback path, and since this implementation is known to be non-time invariant, doing so from a time invariant SIMD cipher is a bit nasty. So let's switch to the

[PATCH v2 04/26] crypto: aes - create AES library based on the fixed time AES code

2019-06-22 Thread Ard Biesheuvel
Take the existing small footprint and mostly time invariant C code and turn it into a AES library that can be used for non-performance critical, casual use of AES, and as a fallback for, e.g., SIMD code that needs a secondary path that can be taken in contexts where the SIMD unit is off limits (e.g

[PATCH v2 17/26] crypto: aes - move sync ctr(aes) to AES library and generic helper

2019-06-22 Thread Ard Biesheuvel
In preparation of duplicating the sync ctr(aes) functionality to modules under arch/arm, move the helper function from a inline .h file to the AES library, which is already depended upon by the drivers that use this fallback. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/aes-ctr-fallback.h

[PATCH v2 23/26] bluetooth: switch to AES library

2019-06-22 Thread Ard Biesheuvel
The bluetooth code uses a bare AES cipher for the encryption operations. Given that it carries out a set_key() operation right before every encryption operation, this is clearly not a hot path, and so the use of the cipher interface (which provides the best implementation available on the system) i

[PATCH v2 07/26] crypto: padlock/aes - switch to library version of key expansion routine

2019-06-22 Thread Ard Biesheuvel
Switch to the new AES library that also provides an implementation of the AES key expansion routine. This removes the dependency on the generic AES cipher, allowing it to be omitted entirely in the future. Signed-off-by: Ard Biesheuvel --- drivers/crypto/Kconfig | 2 +- drivers/crypto/padl

[PATCH v2 16/26] crypto: ctr - add helper for performing a CTR encryption walk

2019-06-22 Thread Ard Biesheuvel
Add a static inline helper modeled after crypto_cbc_encrypt_walk() that can be reused for SIMD algorithms that need to implement a non-SIMD fallback for performing CTR encryption. Signed-off-by: Ard Biesheuvel --- include/crypto/ctr.h | 53 1 file changed, 53 insertions(+)

[PATCH v2 02/26] crypto: aes - rename local routines to prevent future clashes

2019-06-22 Thread Ard Biesheuvel
Rename some local AES encrypt/decrypt routines so they don't clash with the names we are about to introduce for the routines exposed by the generic AES library. Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/aes-cipher-glue.c | 8 arch/arm64/crypto/aes-cipher-glue.c | 8 a

[PATCH v2 15/26] crypto: generic/aes - drop key expansion routine in favor of library version

2019-06-22 Thread Ard Biesheuvel
Drop aes-generic's version of crypto_aes_expand_key(), and switch to the key expansion routine provided by the AES library. AES key expansion is not performance critical, and it is better to have a single version shared by all AES implementations. Signed-off-by: Ard Biesheuvel --- crypto/Kconfig

[PATCH v2 20/26] crypto: arm/aes-ce - provide a synchronous version of ctr(aes)

2019-06-22 Thread Ard Biesheuvel
AES in CTR mode is used by modes such as GCM and CCM, which are often used in contexts where only synchronous ciphers are permitted. So provide a synchronous version of ctr(aes) based on the existing code. This requires a non-SIMD fallback to deal with invocations occurring from a context where SIM

[PATCH v2 26/26] crypto: chelsio/aes - replace AES cipher calls with library calls

2019-06-22 Thread Ard Biesheuvel
Replace a couple of occurrences where the "aes-generic" cipher is instantiated explicitly and only used for encryption of a single block. Use AES library calls instead. Signed-off-by: Ard Biesheuvel --- drivers/crypto/chelsio/Kconfig | 1 + drivers/crypto/chelsio/chcr_algo.c | 46

[PATCH v2 00/26]crypto: AES cleanup

2019-06-22 Thread Ard Biesheuvel
This started out as an attempt to provide synchronous SIMD based GCM on 32-bit ARM, but along the way, I ended up changing and cleaning up so many things that it is more of a general AES cleanup now rather than anything else. Changes since v1/RFC: - rename x86 AES-NI and padlock routines as well,

[PATCH v2 05/26] crypto: x86/aes-ni - switch to generic for fallback and key routines

2019-06-22 Thread Ard Biesheuvel
The AES-NI code contains fallbacks for invocations that occur from a context where the SIMD unit is unavailable, which really only occurs when running in softirq context that was entered from a hard IRQ that was taken while running kernel code that was already using the FPU. That means performance

[PATCH v2 13/26] crypto: arm64/aes-neonbs - switch to library version of key expansion routine

2019-06-22 Thread Ard Biesheuvel
Switch to the new AES library that also provides an implementation of the AES key expansion routine. This removes the dependency on the generic AES cipher, allowing it to be omitted entirely in the future. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/Kconfig | 1 + arch/arm64/cr

[PATCH v2 25/26] crypto: ccp - move to AES library for CMAC key derivation

2019-06-22 Thread Ard Biesheuvel
Use the AES library instead of the cipher interface to perform the single block of AES processing involved in updating the key of the cmac(aes) hash. Signed-off-by: Ard Biesheuvel --- drivers/crypto/ccp/Kconfig | 1 + drivers/crypto/ccp/ccp-crypto-aes-cmac.c | 25 -

[PATCH v2 24/26] crypto: amcc/aes - switch to AES library for GCM key derivation

2019-06-22 Thread Ard Biesheuvel
The AMCC code for GCM key derivation allocates a AES cipher to perform a single block encryption. So let's switch to the new and more lightweight AES library instead. Signed-off-by: Ard Biesheuvel --- drivers/crypto/Kconfig | 2 +- drivers/crypto/amcc/crypto4xx_alg.c | 24 +++--

[PATCH v2 03/26] crypto: aes/fixed-time - align key schedule with other implementations

2019-06-22 Thread Ard Biesheuvel
The fixed time AES code mangles the key schedule so that xoring the first round key with values at fixed offsets across the Sbox produces the correct value. This primes the D-cache with the entire Sbox before any data dependent lookups are done, making it more difficult to infer key bits from timin

[PATCH v2 09/26] crypto: safexcel/aes - switch to library version of key expansion routine

2019-06-22 Thread Ard Biesheuvel
Switch to the new AES library that also provides an implementation of the AES key expansion routine. This removes the dependency on the generic AES cipher, allowing it to be omitted entirely in the future. Signed-off-by: Ard Biesheuvel --- drivers/crypto/Kconfig | 2 +- d

[PATCH v2 14/26] crypto: arm64/aes-ce - switch to library version of key expansion routine

2019-06-22 Thread Ard Biesheuvel
Switch to the new AES library that also provides an implementation of the AES key expansion routine. This removes the dependency on the generic AES cipher, allowing it to be omitted entirely in the future. While at it, remove some references to the table based arm64 version of AES and replace them

[PATCH v2 18/26] crypto: arm64/aes-ce-cipher - use AES library as fallback

2019-06-22 Thread Ard Biesheuvel
Instead of calling into the table based scalar AES code in situations where the SIMD unit may not be used, use the generic AES code, which is more appropriate since it is less likely to be susceptible to timing attacks. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/Kconfig | 2 +-

[PATCH v2 19/26] crypto: aes/arm - use native endiannes for key schedule

2019-06-22 Thread Ard Biesheuvel
Align ARM's hw instruction based AES implementation with other versions that keep the key schedule in native endianness. This will allow us to merge the various implementations going forward. Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/aes-ce-core.S | 20 ++-- arch/arm/cryp

[PATCH v2 12/26] crypto: arm64/aes-ccm - switch to AES library

2019-06-22 Thread Ard Biesheuvel
The CCM code calls directly into the scalar table based AES cipher for arm64 from the fallback path, and since this implementation is known to be non-time invariant, doing so from a time invariant SIMD cipher is a bit nasty. So let's switch to the AES library - this makes the code more robust, and

[PATCH v2 22/26] crypto: arm/ghash - provide a synchronous version

2019-06-22 Thread Ard Biesheuvel
GHASH is used by the GCM mode, which is often used in contexts where only synchronous ciphers are permitted. So provide a synchronous version of GHASH based on the existing code. This requires a non-SIMD fallback to deal with invocations occurring from a context where SIMD instructions may not be u

[PATCH v2 06/26] crypto: x86/aes - drop scalar assembler implementations

2019-06-22 Thread Ard Biesheuvel
The AES assembler code for x86 isn't actually faster than code generated by the compiler from aes_generic.c, and considering the disproportionate maintenance burden of assembler code on x86, it is better just to drop it entirely. Modern x86 systems will use AES-NI anyway, and given that the modules

[PATCH v2 08/26] crypto: cesa/aes - switch to library version of key expansion routine

2019-06-22 Thread Ard Biesheuvel
Switch to the new AES library that also provides an implementation of the AES key expansion routine. This removes the dependency on the generic AES cipher, allowing it to be omitted entirely in the future. Signed-off-by: Ard Biesheuvel --- drivers/crypto/Kconfig | 2 +- drivers/crypto/m

[PATCH v2 01/26] crypto: arm/aes-ce - cosmetic/whitespace cleanup

2019-06-22 Thread Ard Biesheuvel
Rearrange the aes_algs[] array for legibility. Signed-off-by: Ard Biesheuvel --- arch/arm/crypto/aes-ce-glue.c | 116 ++-- 1 file changed, 56 insertions(+), 60 deletions(-) diff --git a/arch/arm/crypto/aes-ce-glue.c b/arch/arm/crypto/aes-ce-glue.c index 5affb8482379..04ba6690367

Re: [RFC PATCH 01/30] crypto: des/3des_ede - add new helpers to verify key length

2019-06-22 Thread Ard Biesheuvel
On Sat, 22 Jun 2019 at 07:06, Herbert Xu wrote: > > On Sat, Jun 22, 2019 at 02:30:43AM +0200, Ard Biesheuvel wrote: > > The recently added helper routines to perform key strength validation > > of 3ede_keys is slightly inadequate, since it doesn't check the key > > length, and it comes in two vers