[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAADnVQLOWsqs1=MS=k2uJu01vNJzd9EZxtEwHW24t4+myj5s0w@mail.gmail.com>
Date: Fri, 10 Jun 2022 09:20:44 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Roberto Sassu <roberto.sassu@...wei.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
KP Singh <kpsingh@...nel.org>, bpf <bpf@...r.kernel.org>,
Network Development <netdev@...r.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v3 1/2] bpf: Add bpf_verify_signature() helper
On Fri, Jun 10, 2022 at 6:59 AM Roberto Sassu <roberto.sassu@...wei.com> wrote:
>
> Since the maximum number of parameters of an eBPF helper is 5, the keyring
> and signature types share one (keyring ID: low 16 bits, signature type:
> high 16 bits).
...
> + * long bpf_verify_signature(u8 *data, u32 datalen, u8 *sig, u32 siglen, u32 info)
> + * Description
> + * Verify a signature of length *siglen* against the supplied data
> + * with length *datalen*. *info* contains the keyring identifier
> + * (low 16 bits) and the signature type (high 16 bits). The keyring
> + * identifier can have the following values (some defined in
> + * verification.h): 0 for the primary keyring (immutable keyring of
> + * system keys); 1 for both the primary and secondary keyring
> + * (where keys can be added only if they are vouched for by
> + * existing keys in those keyrings); 2 for the platform keyring
> + * (primarily used by the integrity subsystem to verify a kexec'ed
> + * kerned image and, possibly, the initramfs signature); 0xffff for
> + * the session keyring (for testing purposes).
Muxing all kinds of info in the 5th arg isn't great.
It's better to use dynptr here for data and sig.
It will free up two extra arguments.
Powered by blists - more mailing lists