[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230706232709.t6imkh3q234b3dlm@macbook-pro-8.dhcp.thefacebook.com>
Date: Thu, 6 Jul 2023 16:27:09 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Roberto Sassu <roberto.sassu@...weicloud.com>
Cc: dhowells@...hat.com, dwmw2@...radead.org,
herbert@...dor.apana.org.au, davem@...emloft.net,
jarkko@...nel.org, song@...nel.org, jolsa@...nel.org,
ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
martin.lau@...ux.dev, yhs@...com, john.fastabend@...il.com,
kpsingh@...nel.org, sdf@...gle.com, haoluo@...gle.com,
rostedt@...dmis.org, mhiramat@...nel.org, mykolal@...com,
shuah@...nel.org, linux-kernel@...r.kernel.org,
keyrings@...r.kernel.org, linux-crypto@...r.kernel.org,
bpf@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org, pbrobinson@...il.com,
zbyszek@...waw.pl, zohar@...ux.ibm.com,
linux-integrity@...r.kernel.org, paul@...l-moore.com,
linux-security-module@...r.kernel.org, wiktor@...acode.biz,
devel@...ts.sequoia-pgp.org, gnupg-devel@...pg.org,
ebiggers@...nel.org, Jason@...c4.com, mail@...iej.szmigiero.name,
antony@...nard.ch, konstantin@...uxfoundation.org,
James.Bottomley@...senpartnership.com,
Roberto Sassu <roberto.sassu@...wei.com>
Subject: Re: [RFC][PATCH 00/10] KEYS: Introduce user asymmetric keys and
signatures
On Thu, Jul 06, 2023 at 04:42:13PM +0200, Roberto Sassu wrote:
> From: Roberto Sassu <roberto.sassu@...wei.com>
>
> Define a new TLV-based format for keys and signatures, aiming to store and
> use in the kernel the crypto material from other unsupported formats
> (e.g. PGP).
>
> TLV fields have been defined to fill the corresponding kernel structures
> public_key, public_key_signature and key_preparsed_payload.
>
> Keys:
> struct public_key { struct key_preparsed_payload {
> KEY_PUB --> void *key;
> u32 keylen; --> prep->payload.data[asym_crypto]
> KEY_ALGO --> const char *pkey_algo;
> KEY_KID0
> KEY_KID1 --> prep->payload.data[asym_key_ids]
> KEY_KID2
> KEY_DESC --> prep->description
>
>
> Signatures:
> struct public_key_signature {
> SIG_S --> u8 *s;
> u32 s_size;
> SIG_KEY_ALGO --> const char *pkey_algo;
> SIG_HASH_ALGO --> const char *hash_algo;
> u32 digest_size;
> SIG_ENC --> const char *encoding;
> SIG_KID0
> SIG_KID1 --> struct asymmetric_key_id *auth_ids[3];
> SIG_KID2
>
>
> For keys, since the format conversion has to be done in user space, user
> space is assumed to be trusted, in this proposal. Without this assumption,
> a malicious conversion tool could make a user load to the kernel a
> different key than the one expected.
>
> That should not be a particular problem for keys that are embedded in the
> kernel image and loaded at boot, since the conversion happens in a trusted
> environment such as the building infrastructure of the Linux distribution
> vendor.
>
> In the other cases, such as enrolling a key through the Machine Owner Key
> (MOK) mechanism, the user is responsible to ensure that the crypto material
> carried in the original format remains the same after the conversion.
>
> For signatures, assuming the strength of the crypto algorithms, altering
> the crypto material is simply a Denial-of-Service (DoS), as data can be
> validated only with the right signature.
>
>
> This patch set also offers the following contributions:
>
> - An API similar to the PKCS#7 one, to verify the authenticity of system
> data through user asymmetric keys and signatures
>
> - A mechanism to store a keyring blob in the kernel image and to extract
> and load the keys at system boot
>
> - eBPF binding, so that data authenticity verification with user asymmetric
> keys and signatures can be carried out also with eBPF programs
Nack to bpf bits.
You've convinced us that bpf_verify_pkcs7_signature() is what you need.
Yet, 9 month later there are no users of it and you came back with this new
bpf_verify_uasym_signature() helper that practically not much different.
Instead of brand new "public key info" format sign your rpms via
existing pkcs7 mechanism and verify with bpf_verify_pkcs7_signature().
Powered by blists - more mailing lists