Re: [RFC v1 PATCH 3/3] driver: update all the code that use soc_device_match

2021-04-20 Thread Arnd Bergmann
On Tue, Apr 20, 2021 at 1:44 AM Dominique MARTINET wrote: > Arnd Bergmann wrote on Mon, Apr 19, 2021 at 02:16:36PM +0200: > > For built-in drivers, load order depends on the initcall level and > > link order (how things are lined listed in the Makefile hierarchy). > > > > For loadable modules, thi

Re: [RFC v1 PATCH 3/3] driver: update all the code that use soc_device_match

2021-04-20 Thread Arnd Bergmann
On Tue, Apr 20, 2021 at 1:44 AM Dominique MARTINET wrote: > Arnd Bergmann wrote on Mon, Apr 19, 2021 at 02:16:36PM +0200: > > For built-in drivers, load order depends on the initcall level and > > link order (how things are lined listed in the Makefile hierarchy). > > > > For loadable modules, thi

Re: [RFC v1 PATCH 3/3] driver: update all the code that use soc_device_match

2021-04-20 Thread Péter Ujfalusi
Hi Alice, On 4/19/21 7:27 AM, Alice Guo (OSS) wrote: > From: Alice Guo > > Update all the code that use soc_device_match because add support for > soc_device_match returning -EPROBE_DEFER. > > Signed-off-by: Alice Guo > --- > drivers/bus/ti-sysc.c | 2 +- > drivers/cl

Re: [RFC Part2 PATCH 04/30] x86/mm: split the physmap when adding the page in RMP table

2021-04-20 Thread Borislav Petkov
On Mon, Apr 19, 2021 at 12:46:53PM -0500, Brijesh Singh wrote: > - KVM calls  alloc_page() to allocate a VMSA page. The allocator returns > 0xc820 (PFN 0x200, page-level=2M). The VMSA page is private > page so KVM will call RMPUPDATE to add the page as a private page in the > RMP table.

Re: [RFC Part2 PATCH 04/30] x86/mm: split the physmap when adding the page in RMP table

2021-04-20 Thread Borislav Petkov
On Mon, Apr 19, 2021 at 11:33:08AM -0700, Dave Hansen wrote: > My point was just that you can't _easily_ do the 2M->4k kernel mapping > demotion in a page fault handler, like I think Borislav was suggesting. Yeah, see my reply to Brijesh. Not in the #PF handler but when the guest does update the R

Re: [RFC Part2 PATCH 05/30] x86: define RMP violation #PF error code

2021-04-20 Thread Borislav Petkov
On Wed, Mar 24, 2021 at 12:04:11PM -0500, Brijesh Singh wrote: Btw, for all your patches where the subject prefix is only "x86:": The tip tree preferred format for patch subject prefixes is 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:', 'genirq/core:'. Please do not use fi

[PATCH 1/1 v9] use crc32 instead of md5 for hibernation e820 integrity check

2021-04-20 Thread Chris von Recklinghausen
Hibernation fails on a system in fips mode because md5 is used for the e820 integrity check and is not available. Use crc32 instead. The check is intended to detect whether the E820 memory map provided by the firmware after cold boot unexpectedly differs from the one that was in use when the hiber

[PATCH v3 02/18] crypto: rsa-pkcs1pad: Rename pkcs1pad-specific functions to rsapad

2021-04-20 Thread Varad Gautam
The existing RSA implementation supports PKCSv1.5 style signature paddings via rsa-pkcs1pad. A lot of the functionality implemented for rsa-pkcs1pad can be reused across other RSA padding schemes. Rename such functions as rsapad_* before moving them out of rsa-pkcs1pad.c. Signed-off-by: Varad Gaut

[PATCH v3 00/18] Implement RSASSA-PSS signature verification

2021-04-20 Thread Varad Gautam
Linux currently supports RSA PKCSv1.5 encoding scheme for signing / verification. This adds support for RSASSA PSS signature verification as described in RFC8017 [1]. Patch 1 extends the x509 certificate parser to unpack PSS signature parameters. Patches 2-8 pull out the common functions / struc

[PATCH v3 03/18] crypto: rsa-pkcs1pad: Extract pkcs1pad_create into a generic helper

2021-04-20 Thread Varad Gautam
which can be reused by other signature padding schemes as rsapad_akcipher_create. This will be moved out of rsa-pkcs1pad.c to be used across rsa-*pad implementations. Signed-off-by: Varad Gautam --- crypto/rsa-pkcs1pad.c | 48 ++- 1 file changed, 34 insert

[PATCH v3 05/18] crypto: rsa-pkcs1pad: Rename pkcs1pad_* structs to rsapad_*

2021-04-20 Thread Varad Gautam
Use generic naming to share with other padding scheme implementations. These will be moved out of rsa-pkcs1pad.c. Signed-off-by: Varad Gautam --- crypto/rsa-pkcs1pad.c | 62 +-- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/crypto/rsa-pkc

[PATCH v3 06/18] crypto: rsa: Start moving RSA common code to rsa-common

2021-04-20 Thread Varad Gautam
Move out helpers from rsa-pkcs1pad.c which will be shared across rsa-*pad implementations. Signed-off-by: Varad Gautam --- crypto/Makefile | 1 + crypto/rsa-common.c | 76 ++ crypto/rsa-pkcs1pad.c| 97 +---

[PATCH v3 07/18] crypto: rsa: Move more common code to rsa-common

2021-04-20 Thread Varad Gautam
Move helpers for setting public/private keys, RSA akcipher instance setup, keysize querying etc. to rsa-common.c. Signed-off-by: Varad Gautam --- crypto/rsa-common.c | 183 +++ crypto/rsa-pkcs1pad.c| 183 --- includ

[PATCH v3 01/18] X.509: Parse RSASSA-PSS style certificates

2021-04-20 Thread Varad Gautam
An X.509 wrapper for a RSASSA-PSS signature contains additional signature parameters over the PKCSv.15 encoding scheme. Extend the x509 parser to allow parsing RSASSA-PSS encoded certificates, with the defaults taken from RFC8017. References: https://tools.ietf.org/html/rfc8017#appendix-C Signed-o

[PATCH v3 04/18] crypto: rsa-pkcs1pad: Pull out child req processing code into helpers

2021-04-20 Thread Varad Gautam
rsa-pkcs1pad operations that require using RSA primitives rely on creating an akcipher child RSA transform and processing the results in the operation-specific callback. Add helpers rsapad_akcipher_setup_child and rsapad_akcipher_req_complete for req setup and callback handling, and switch pkcs1pad

[PATCH v3 08/18] crypto: rsa: Move rsapad_akcipher_setup_child and callback to rsa-common

2021-04-20 Thread Varad Gautam
Pull out more common code from rsa-pkcs1pad into rsa-common. Signed-off-by: Varad Gautam --- crypto/rsa-common.c | 31 +++ crypto/rsa-pkcs1pad.c| 32 include/crypto/internal/rsa-common.h | 9 3 files

[PATCH v3 14/18] crypto: Implement MGF1 Mask Generation Function for RSASSA-PSS

2021-04-20 Thread Varad Gautam
This generates a "mask" byte array of size mask_len bytes as a concatenation of digests, where each digest is calculated on a concatenation of an input seed and a running counter to fill up mask_len bytes - as described by RFC8017 sec B.2.1. "MGF1". The mask is useful for RSA signing/verification

[PATCH v3 15/18] crypto: rsa-psspad: Provide PSS signature verify operation

2021-04-20 Thread Varad Gautam
Trigger RSA transform on the signature being verified from psspad_verify, to produce intermediary data which will be handled in the psspad_verify_complete callback. Reference: https://tools.ietf.org/html/rfc8017#section-8.1.2 Signed-off-by: Varad Gautam --- crypto/rsa-psspad.c | 53 +

[PATCH v3 09/18] crypto: Extend akcipher API to pass signature parameters

2021-04-20 Thread Varad Gautam
For certain signature encoding schemes (eg. RSASSA-PSS), the verify/sign operation behavior depends on information contained in the signature blob. Allow passing this down to the crypto_template by introducing a crypto_akcipher_set_sig_params() call. Signed-off-by: Varad Gautam --- crypto/rsa-co

[PATCH v3 16/18] crypto: rsa-psspad: Implement signature verify callback

2021-04-20 Thread Varad Gautam
The RSA output must be processed as per the EMSA-PSS-VERIFY operation from RFC8017, which forms the core of the PSS signature verification. Implement the verification callback, which operates on the RSA output buffer. Reference: https://tools.ietf.org/html/rfc8017#section-9.1.2 Signed-off-by: Var

[PATCH v3 17/18] crypto: Accept pss as valid encoding during signature verification

2021-04-20 Thread Varad Gautam
Accept pss encoding for public_key_verify_signature. If CONFIG_CRYPTO_RSASSA_PSS is disabled, crypto_alloc_akcipher will fail to find a pss backend anyway. Signed-off-by: Varad Gautam Acked-by: Jarkko Sakkinen --- crypto/asymmetric_keys/public_key.c | 18 +- 1 file changed, 13 i

[PATCH v3 18/18] keyctl_pkey: Add pkey parameters saltlen and mgfhash for PSS

2021-04-20 Thread Varad Gautam
keyctl pkey_* operations accept enc and hash parameters at present. RSASSA-PSS signatures also require passing in the signature salt length and the mgf hash function. Add parameters: - 'saltlen' to feed in salt length of a PSS signature. - 'mgfhash' to feed in the hash function used for MGF. Sign

Re: [PATCH v2 18/18] keyctl_pkey: Add pkey parameters slen and mgfhash for PSS

2021-04-20 Thread Varad Gautam
On 4/9/21 4:15 PM, Ben Boeckel wrote: > On Thu, Apr 08, 2021 at 16:15:16 +0200, Varad Gautam wrote: >> keyctl pkey_* operations accept enc and hash parameters at present. >> RSASSA-PSS signatures also require passing in the signature salt >> length and the mgf hash function. >> >> Add parameters: >

Re: [PATCH v2 00/18] Implement RSASSA-PSS signature verification

2021-04-20 Thread Varad Gautam
Hi David, On 4/8/21 5:08 PM, David Howells wrote: > Varad Gautam wrote: > >> The test harness is available at [5]. > > Can you add this to the keyutils testsuite? > These are two separate things IMO - the keyutils tests test for "the keyctl interface behaves as advertised". Testing the underl

[PATCH v3 13/18] crypto: rsa-psspad: Get signature parameters from a given signature

2021-04-20 Thread Varad Gautam
Implement akcipher_alg->set_sig_params for rsassa-psspad to receive the salt length and MGF hash function for the signature being verified. Signed-off-by: Varad Gautam --- crypto/rsa-psspad.c | 21 - include/crypto/internal/rsa-common.h | 2 ++ 2 files chang

[PATCH v3 10/18] crypto: rsa: Move struct rsa_mpi_key definition to rsa.h

2021-04-20 Thread Varad Gautam
The RSASSA-PSS signature scheme requires knowing the RSA modulus size in bits. The rsa akcipher_alg max_size call is insufficient for this, as the returned keysize is rounded up to the next byte. Since the RSA modulus is stored as an MPI accessible via struct rsa_mpi_key, move the struct definitio

[PATCH v3 11/18] crypto: Scaffolding for RSA-PSS signature style

2021-04-20 Thread Varad Gautam
Add a crypto_template for rsa-psspad, hidden behind CONFIG_CRYPTO_RSASSA_PSS. Set the sign/verify/encrypt/decrypt operations to return -EOPNOTSUPP, to be implemented in the future Signed-off-by: Varad Gautam --- crypto/Kconfig| 6 ++ crypto/Makefile | 1 + cry

[PATCH v3 12/18] crypto: rsa-psspad: Introduce shash alloc/dealloc helpers

2021-04-20 Thread Varad Gautam
RSASSA-PSS verify operation needs to compute digests for its Mask Generation Function (MGF1), and for digest comparison. Add helpers to populate a crypto_shash and desc for use in both cases. Signed-off-by: Varad Gautam --- v3: Add psspad_check_hash_algo to only allow valid hash algorithms in

Re: [RFC v1 PATCH 1/3] drivers: soc: add support for soc_device_match returning -EPROBE_DEFER

2021-04-20 Thread Dan Carpenter
On Mon, Apr 19, 2021 at 10:20:13AM +0200, Geert Uytterhoeven wrote: > Hi Alice, > > CC Arnd (soc_device_match() author) > > On Mon, Apr 19, 2021 at 6:28 AM Alice Guo (OSS) wrote: > > From: Alice Guo > > > > In i.MX8M boards, the registration of SoC device is later than caam > > driver which nee

[PATCH 1/1 v10] x86/power use crc32 instead of md5 for hibernation e820 integrity check

2021-04-20 Thread Chris von Recklinghausen
Hibernation fails on a system in fips mode because md5 is used for the e820 integrity check and is not available. Use crc32 instead. The check is intended to detect whether the E820 memory map provided by the firmware after cold boot unexpectedly differs from the one that was in use when the hiber

Re: [PATCH v3 18/18] keyctl_pkey: Add pkey parameters saltlen and mgfhash for PSS

2021-04-20 Thread Ben Boeckel
On Tue, Apr 20, 2021 at 13:41:23 +0200, Varad Gautam wrote: > keyctl pkey_* operations accept enc and hash parameters at present. > RSASSA-PSS signatures also require passing in the signature salt > length and the mgf hash function. > > Add parameters: > - 'saltlen' to feed in salt length of a PSS

Re: [RFC Part2 PATCH 05/30] x86: define RMP violation #PF error code

2021-04-20 Thread Brijesh Singh
On 4/20/21 5:32 AM, Borislav Petkov wrote: > On Wed, Mar 24, 2021 at 12:04:11PM -0500, Brijesh Singh wrote: > > Btw, for all your patches where the subject prefix is only "x86:": > > The tip tree preferred format for patch subject prefixes is > 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault