Re: [RFC PATCH 0/8] x86: Support Intel Key Locker

2020-12-17 Thread Bae, Chang Seok
> On Dec 18, 2020, at 04:10, Eric Biggers wrote: > > On Wed, Dec 16, 2020 at 09:41:38AM -0800, Chang S. Bae wrote: >> [1] Intel Architecture Instruction Set Extensions Programming Reference: >> >> https://software.intel.com/content/dam/develop/external/us/en/documents/architecture-instructi

Re: [RFC PATCH 4/8] x86/power: Restore Key Locker internal key from the ACPI S3/4 sleep states

2020-12-17 Thread Bae, Chang Seok
> On Dec 18, 2020, at 04:10, Eric Biggers wrote: > > On Wed, Dec 16, 2020 at 09:41:42AM -0800, Chang S. Bae wrote: >> When the system state switches to these sleep states, the internal key gets >> reset. Since this system transition is transparent to userspace, the >> internal key needs to be r

Re: [PATCH 3/5] crypto: blake2b - export helpers for optimized implementations

2020-12-17 Thread Eric Biggers
On Thu, Dec 17, 2020 at 06:15:40PM +0100, David Sterba wrote: > On Tue, Dec 15, 2020 at 03:47:06PM -0800, Eric Biggers wrote: > > From: Eric Biggers > > > > In preparation for adding architecture-specific implementations of > > BLAKE2b, create a header that contains common > > constants, structs

[PATCH v2 10/11] crypto: arm/blake2s - add ARM scalar optimized BLAKE2s

2020-12-17 Thread Eric Biggers
From: Eric Biggers Add an ARM scalar optimized implementation of BLAKE2s. NEON isn't very useful for BLAKE2s because the BLAKE2s block size is too small for NEON to help. Each NEON instruction would depend on the previous one, resulting in poor performance. With scalar instructions, on the oth

[PATCH v2 09/11] crypto: blake2s - share the "shash" API boilerplate code

2020-12-17 Thread Eric Biggers
From: Eric Biggers Move the boilerplate code for setkey(), init(), update(), and final() from blake2s_generic.ko into a new module blake2s_helpers.ko, and export it so that it can be used by other shash implementations of BLAKE2s. setkey() and init() are exported as-is, while update() and final(

[PATCH v2 04/11] crypto: blake2b - update file comment

2020-12-17 Thread Eric Biggers
From: Eric Biggers The file comment for blake2b_generic.c makes it sound like it's the reference implementation of BLAKE2b with only minor changes. But it's actually been changed a lot. Update the comment to make this clearer. Reviewed-by: David Sterba Signed-off-by: Eric Biggers --- crypto

[PATCH v2 00/11] crypto: arm32-optimized BLAKE2b and BLAKE2s

2020-12-17 Thread Eric Biggers
This patchset adds 32-bit ARM assembly language implementations of BLAKE2b and BLAKE2s. The BLAKE2b implementation is NEON-accelerated, while the BLAKE2s implementation uses scalar instructions since NEON doesn't work very well for it. The BLAKE2b implementation is faster and is expected to be us

[PATCH v2 05/11] crypto: arm/blake2b - add NEON-accelerated BLAKE2b

2020-12-17 Thread Eric Biggers
From: Eric Biggers Add a NEON-accelerated implementation of BLAKE2b. On Cortex-A7 (which these days is the most common ARM processor that doesn't have the ARMv8 Crypto Extensions), this is over twice as fast as SHA-256, and slightly faster than SHA-1. It is also almost three times as fast as th

[PATCH v2 11/11] wireguard: Kconfig: select CRYPTO_BLAKE2S_ARM

2020-12-17 Thread Eric Biggers
From: Eric Biggers When available, select the new implementation of BLAKE2s for 32-bit ARM. This is faster than the generic C implementation. Signed-off-by: Eric Biggers --- drivers/net/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index

[PATCH v2 08/11] crypto: blake2s - remove unneeded includes

2020-12-17 Thread Eric Biggers
From: Eric Biggers It doesn't make sense for the generic implementation of BLAKE2s to include and , as these are things that would only be useful in an architecture-specific implementation. Remove these unnecessary includes. Signed-off-by: Eric Biggers --- crypto/blake2s_generic.c | 2 -- 1

[PATCH v2 07/11] crypto: x86/blake2s - define shash_alg structs using macros

2020-12-17 Thread Eric Biggers
From: Eric Biggers The shash_alg structs for the four variants of BLAKE2s are identical except for the algorithm name, driver name, and digest size. So, avoid code duplication by using a macro to define these structs. Signed-off-by: Eric Biggers --- arch/x86/crypto/blake2s-glue.c | 84 +++

[PATCH v2 06/11] crypto: blake2s - define shash_alg structs using macros

2020-12-17 Thread Eric Biggers
From: Eric Biggers The shash_alg structs for the four variants of BLAKE2s are identical except for the algorithm name, driver name, and digest size. So, avoid code duplication by using a macro to define these structs. Signed-off-by: Eric Biggers --- crypto/blake2s_generic.c | 88 -

[PATCH v2 03/11] crypto: blake2b - export helpers for optimized implementations

2020-12-17 Thread Eric Biggers
From: Eric Biggers In preparation for adding optimized implementations of BLAKE2b (as well as possibly supporting BLAKE2b through the library API in the future), create headers and that contain common constants, structs, and helper functions for BLAKE2b. Furthermore, export helper functions th

[PATCH v2 02/11] crypto: blake2b - define shash_alg structs using macros

2020-12-17 Thread Eric Biggers
From: Eric Biggers The shash_alg structs for the four variants of BLAKE2b are identical except for the algorithm name, driver name, and digest size. So, avoid code duplication by using a macro to define these structs. Reviewed-by: David Sterba Signed-off-by: Eric Biggers --- crypto/blake2b_g

[PATCH v2 01/11] crypto: blake2b - rename constants for consistency with blake2s

2020-12-17 Thread Eric Biggers
From: Eric Biggers Rename some BLAKE2b-related constants to be consistent with the names used in the BLAKE2s implementation (see include/crypto/blake2s.h): BLAKE2B_*_DIGEST_SIZE => BLAKE2B_*_HASH_SIZE BLAKE2B_BLOCKBYTES => BLAKE2B_BLOCK_SIZE BLAKE2B_KEYBYTES =>

Re: [NEEDS-REVIEW] [RFC PATCH 7/8] crypto: x86/aes-kl - Support AES algorithm using Key Locker instructions

2020-12-17 Thread Dave Hansen
On 12/16/20 9:41 AM, Chang S. Bae wrote: > +config CRYPTO_AES_KL > + tristate "AES cipher algorithms (AES-KL)" > + depends on X86_KEYLOCKER > + select CRYPTO_AES_NI_INTEL > + help > + Use AES Key Locker instructions for AES algorithm. > + > + AES cipher algorithms (FIPS-

Re: [RFC PATCH 7/8] crypto: x86/aes-kl - Support AES algorithm using Key Locker instructions

2020-12-17 Thread Andy Lutomirski
On Wed, Dec 16, 2020 at 9:46 AM Chang S. Bae wrote: > > Key Locker (KL) is Intel's new security feature that protects the AES key > at the time of data transformation. New AES SIMD instructions -- as a > successor of Intel's AES-NI -- are provided to encode an AES key and > reference it for the AE

Re: [PATCH 0/2] Introduce PCI_FIXUP_IOMMU

2020-12-17 Thread Bjorn Helgaas
On Wed, Dec 16, 2020 at 07:24:30PM +0800, Zhou Wang wrote: > On 2020/6/23 23:04, Bjorn Helgaas wrote: > > On Fri, Jun 19, 2020 at 10:26:54AM +0800, Zhangfei Gao wrote: > >> Have studied _DSM method, two issues we met comparing using quirk. > >> > >> 1. Need change definition of either pci_host_brid

Re: [RFC PATCH 0/8] x86: Support Intel Key Locker

2020-12-17 Thread Dan Williams
On Thu, Dec 17, 2020 at 11:11 AM Eric Biggers wrote: > > On Wed, Dec 16, 2020 at 09:41:38AM -0800, Chang S. Bae wrote: > > [1] Intel Architecture Instruction Set Extensions Programming Reference: > > > > https://software.intel.com/content/dam/develop/external/us/en/documents/architecture-inst

Re: [RFC PATCH 0/8] x86: Support Intel Key Locker

2020-12-17 Thread Eric Biggers
On Wed, Dec 16, 2020 at 09:41:38AM -0800, Chang S. Bae wrote: > [1] Intel Architecture Instruction Set Extensions Programming Reference: > > https://software.intel.com/content/dam/develop/external/us/en/documents/architecture-instruction-set-$ > [2] Intel Key Locker Specification: > > htt

Re: [RFC PATCH 4/8] x86/power: Restore Key Locker internal key from the ACPI S3/4 sleep states

2020-12-17 Thread Eric Biggers
On Wed, Dec 16, 2020 at 09:41:42AM -0800, Chang S. Bae wrote: > When the system state switches to these sleep states, the internal key gets > reset. Since this system transition is transparent to userspace, the > internal key needs to be restored properly. > > Key Locker provides a mechanism to ba

[PATCH 1/2] crypto: arm64/aes-ce - really hide slower algos when faster ones are enabled

2020-12-17 Thread Ard Biesheuvel
Commit 69b6f2e817e5b ("crypto: arm64/aes-neon - limit exposed routines if faster driver is enabled") intended to hide modes from the plain NEON driver that are also implemented by the faster bit sliced NEON one if both are enabled. However, the defined() CPP function does not detect if the bit slic

[PATCH 2/2] crypto: arm64/aes-ctr - improve tail handling

2020-12-17 Thread Ard Biesheuvel
Counter mode is a stream cipher chaining mode that is typically used with inputs that are of arbitrarily length, and so a tail block which is smaller than a full AES block is rule rather than exception. The current ctr(aes) implementation for arm64 always makes a separate call into the assembler r

Re: [PATCH 2/5] crypto: blake2b - define shash_alg structs using macros

2020-12-17 Thread Eric Biggers
On Thu, Dec 17, 2020 at 06:15:17PM +0100, David Sterba wrote: > On Tue, Dec 15, 2020 at 03:47:05PM -0800, Eric Biggers wrote: > > From: Eric Biggers > > > > The shash_alg structs for the four variants of BLAKE2b are identical > > except for the algorithm name, driver name, and digest size. So, a

[RFC PATCH 6/6] crypto: keembay-ocs-ecc - Add Keem Bay OCS ECC Driver

2020-12-17 Thread Daniele Alessandrelli
From: Prabhjot Khurana The Intel Keem Bay SoC can provide hardware acceleration of Elliptic Curve Cryptography (ECC) by means of its Offload and Crypto Subsystem (OCS). Add the Keem Bay OCS ECC driver which leverages such hardware capabilities to provide hardware-acceleration of ECDH-256 and ECD

[RFC PATCH 5/6] dt-bindings: crypto: Add Keem Bay ECC bindings

2020-12-17 Thread Daniele Alessandrelli
From: Prabhjot Khurana Add Keem Bay Offload and Crypto Subsystem (OCS) Elliptic Curve Cryptography (ECC) device tree bindings. Signed-off-by: Prabhjot Khurana Signed-off-by: Daniele Alessandrelli --- .../crypto/intel,keembay-ocs-ecc.yaml | 47 +++ MAINTAINERS

[RFC PATCH 4/6] crypto: ecdh - Add Curve ID for NIST P-384

2020-12-17 Thread Daniele Alessandrelli
From: Prabhjot Khurana Reserve ECC curve id for NIST P-384 curve. This is done to prepare for future support of the P-384 curve by KPP device drivers. Signed-off-by: Prabhjot Khurana Signed-off-by: Daniele Alessandrelli --- include/crypto/ecdh.h | 1 + 1 file changed, 1 insertion(+) diff --

[RFC PATCH 3/6] crypto: ecc - Export additional helper functions

2020-12-17 Thread Daniele Alessandrelli
From: Daniele Alessandrelli Export the following additional ECC helper functions: - ecc_alloc_point() - ecc_free_point() - vli_num_bits() - ecc_point_is_zero() - ecc_swap_digits() This is done to allow future KPP device drivers to re-use existing code, thus simplifying their implementation. Fun

[RFC PATCH 2/6] crypto: ecc - Move ecc.h to include/crypto/internal

2020-12-17 Thread Daniele Alessandrelli
From: Daniele Alessandrelli Move ecc.h header file to 'include/crypto/internal' so that it can be easily imported from everywhere in the kernel tree. This change is done to allow crypto device drivers to re-use the symbols exported by 'crypto/ecc.c', thus avoiding code duplication. Signed-off-b

[RFC PATCH 0/6] Keem Bay OCS ECC crypto driver

2020-12-17 Thread Daniele Alessandrelli
Hi, I'm posting this patch series as RFC since there are a few open points on which I'd like to have the opinion of the crypto maintainers and the rest of kernel community. The patch series adds the Intel Keem Bay OCS ECC crypto driver, which enables hardware-accelerated ECDH on the Intel Keem Ba

[RFC PATCH 1/6] crypto: engine - Add KPP Support to Crypto Engine

2020-12-17 Thread Daniele Alessandrelli
From: Prabhjot Khurana Add KPP support to the crypto engine queue manager, so that it can be used to simplify the logic of KPP device drivers as done for other crypto drivers. Signed-off-by: Prabhjot Khurana Signed-off-by: Daniele Alessandrelli --- Documentation/crypto/crypto_engine.rst | 4

Re: [PATCH 4/5] crypto: blake2b - update file comment

2020-12-17 Thread David Sterba
On Tue, Dec 15, 2020 at 03:47:07PM -0800, Eric Biggers wrote: > From: Eric Biggers > > The file comment for blake2b_generic.c makes it sound like it's the > reference implementation of BLAKE2b with only minor changes. But it's > actually been changed a lot. Update the comment to make this clear

Re: [PATCH 2/5] crypto: blake2b - define shash_alg structs using macros

2020-12-17 Thread David Sterba
On Tue, Dec 15, 2020 at 03:47:05PM -0800, Eric Biggers wrote: > From: Eric Biggers > > The shash_alg structs for the four variants of BLAKE2b are identical > except for the algorithm name, driver name, and digest size. So, avoid > code duplication by using a macro to define these structs. > > S

Re: [PATCH 3/5] crypto: blake2b - export helpers for optimized implementations

2020-12-17 Thread David Sterba
On Tue, Dec 15, 2020 at 03:47:06PM -0800, Eric Biggers wrote: > From: Eric Biggers > > In preparation for adding architecture-specific implementations of > BLAKE2b, create a header that contains common > constants, structs, and helper functions for BLAKE2b. > > Furthermore, export the BLAKE2b g

Re: [PATCH 1/5] crypto: blake2b - rename constants for consistency with blake2s

2020-12-17 Thread David Sterba
On Tue, Dec 15, 2020 at 03:47:04PM -0800, Eric Biggers wrote: > From: Eric Biggers > > Rename some BLAKE2b-related constants to be consistent with the names > used in the BLAKE2s implementation (see include/crypto/blake2s.h): > > BLAKE2B_*_DIGEST_SIZE => BLAKE2B_*_HASH_SIZE > BLAKE2

[PATCH] crypto: keembay-ocs-aes - Add dependency on HAS_IOMEM

2020-12-17 Thread Daniele Alessandrelli
From: Daniele Alessandrelli Add dependency for CRYPTO_DEV_KEEMBAY_OCS_AES_SM4 on HAS_IOMEM to prevent build failures. Fixes: 88574332451380f4 ("crypto: keembay - Add support for Keem Bay OCS AES/SM4") Reported-by: kernel test robot Signed-off-by: Daniele Alessandrelli --- drivers/crypto/keem

Re: [PATCH 0/5] crypto: add NEON-optimized BLAKE2b

2020-12-17 Thread Jason A. Donenfeld
On Thu, Dec 17, 2020 at 4:54 AM Eric Biggers wrote: > > On Wed, Dec 16, 2020 at 11:32:44PM +0100, Jason A. Donenfeld wrote: > > Hi Eric, > > > > On Wed, Dec 16, 2020 at 9:48 PM Eric Biggers wrote: > > > By the way, if people are interested in having my ARM scalar > > > implementation of > > > BL

Re: [RFC PATCH 7/8] crypto: x86/aes-kl - Support AES algorithm using Key Locker instructions

2020-12-17 Thread Ard Biesheuvel
Hello Chang, On Wed, 16 Dec 2020 at 18:47, Chang S. Bae wrote: > > Key Locker (KL) is Intel's new security feature that protects the AES key > at the time of data transformation. New AES SIMD instructions -- as a > successor of Intel's AES-NI -- are provided to encode an AES key and > reference i