From: Roberto Sassu <roberto.sassu@huaweicloud.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: dhowells@redhat.com, dwmw2@infradead.org,
herbert@gondor.apana.org.au, davem@davemloft.net,
jarkko@kernel.org, song@kernel.org, jolsa@kernel.org,
ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, yhs@fb.com, john.fastabend@gmail.com,
kpsingh@kernel.org, sdf@google.com, haoluo@google.com,
rostedt@goodmis.org, mhiramat@kernel.org, mykolal@fb.com,
shuah@kernel.org, linux-kernel@vger.kernel.org,
keyrings@vger.kernel.org, linux-crypto@vger.kernel.org,
bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, pbrobinson@gmail.com,
zbyszek@in.waw.pl, zohar@linux.ibm.com,
linux-integrity@vger.kernel.org, paul@paul-moore.com,
linux-security-module@vger.kernel.org, wiktor@metacode.biz,
devel@lists.sequoia-pgp.org, gnupg-devel@gnupg.org,
ebiggers@kernel.org, Jason@zx2c4.com, mail@maciej.szmigiero.name,
antony@vennard.ch, konstantin@linuxfoundation.org,
James.Bottomley@hansenpartnership.com,
Roberto Sassu <roberto.sassu@huawei.com>
Subject: Re: [RFC][PATCH 00/10] KEYS: Introduce user asymmetric keys and signatures
Date: Fri, 07 Jul 2023 09:03:05 +0200 [thread overview]
Message-ID: <46a2328ab35907970dcd9a7240cd9072abeb66b2.camel@huaweicloud.com> (raw)
In-Reply-To: <20230706232709.t6imkh3q234b3dlm@macbook-pro-8.dhcp.thefacebook.com>
On Thu, 2023-07-06 at 16:27 -0700, Alexei Starovoitov wrote:
> On Thu, Jul 06, 2023 at 04:42:13PM +0200, Roberto Sassu wrote:
> > From: Roberto Sassu <roberto.sassu@huawei.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.
Sure, no problem. Will remove them in the next iteration.
> 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().
Asking Linux distribution vendors to execute gpg in their kernel build,
or asking them to revisit their PKI, rebuild all their packages, and
adapting all their tools dealing with the current mechanism?
Which solution do you think it is better?
Thanks
Roberto
prev parent reply other threads:[~2023-07-07 7:04 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-06 14:42 [RFC][PATCH 00/10] KEYS: Introduce user asymmetric keys and signatures Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 01/10] crypto: Export public key algorithm information Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 02/10] crypto: Export signature encoding information Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 03/10] KEYS: asymmetric: Introduce a parser for user asymmetric keys and sigs Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 04/10] KEYS: asymmetric: Introduce the user asymmetric key parser Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 05/10] KEYS: asymmetric: Introduce the user asymmetric key signature parser Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 06/10] verification: Add verify_uasym_signature() and verify_uasym_sig_message() Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 07/10] KEYS: asymmetric: Preload user asymmetric keys from a keyring blob Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 08/10] KEYS: Introduce load_uasym_keyring() Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 09/10] bpf: Introduce bpf_verify_uasym_signature() kfunc Roberto Sassu
2023-07-06 14:42 ` [RFC][PATCH 10/10] selftests/bpf: Prepare a test for user asymmetric key signatures Roberto Sassu
2023-07-06 14:42 ` [RFC][GNUPG][PATCH 1/2] Convert PGP keys to the user asymmetric keys format Roberto Sassu
2023-07-06 14:42 ` [RFC][GNUPG][PATCH 2/2] Convert PGP signatures to the user asymmetric key signatures format Roberto Sassu
2023-07-06 23:27 ` [RFC][PATCH 00/10] KEYS: Introduce user asymmetric keys and signatures Alexei Starovoitov
2023-07-07 7:03 ` Roberto Sassu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46a2328ab35907970dcd9a7240cd9072abeb66b2.camel@huaweicloud.com \
--to=roberto.sassu@huaweicloud.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=Jason@zx2c4.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=antony@vennard.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=devel@lists.sequoia-pgp.org \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=ebiggers@kernel.org \
--cc=gnupg-devel@gnupg.org \
--cc=haoluo@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=jarkko@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=keyrings@vger.kernel.org \
--cc=konstantin@linuxfoundation.org \
--cc=kpsingh@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mail@maciej.szmigiero.name \
--cc=martin.lau@linux.dev \
--cc=mhiramat@kernel.org \
--cc=mykolal@fb.com \
--cc=paul@paul-moore.com \
--cc=pbrobinson@gmail.com \
--cc=roberto.sassu@huawei.com \
--cc=rostedt@goodmis.org \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=wiktor@metacode.biz \
--cc=yhs@fb.com \
--cc=zbyszek@in.waw.pl \
--cc=zohar@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).