From: Eric Biggers <ebiggers3@gmail.com>
To: keyrings@vger.kernel.org
Subject: Re: [PATCH v2] KEYS: Convert KEYCTL_DH_COMPUTE to use the crypto KPP API
Date: Mon, 05 Jun 2017 22:03:10 +0000 [thread overview]
Message-ID: <20170605220310.GC87699@gmail.com> (raw)
In-Reply-To: <1638.1496419102@warthog.procyon.org.uk>
Hi Stephan,
On Mon, Jun 05, 2017 at 11:51:32PM +0200, Stephan Müller wrote:
> Am Montag, 5. Juni 2017, 05:41:32 CEST schrieb Eric Biggers:
>
> Hi Eric,
> >
> > Also, Stephan, what is the purpose of the "__spare" field in
> > keyctl_kdf_params? How is it ever supposed to be used for anything if the
> > kernel doesn't even validate that it contains 0's? Some flag hacked into
> > the 'otherinfolen' field...?
>
> The idea in the very first patch set was the presence of a "flags" field. We
> have a proliferation of system calls in the last few years which just add a
> "flags" parameter compared to an identical older system call.
>
> To prevent falling into this trap, I wanted to have a flags field. The core
> reason is that there are multiple options allowed and possible how to derive a
> key. The current approach is the easiest and smallest one, i.e. using the
> SP800-108 counter KDF. Other KDFs are possible too. To allow such openness, we
> decided to leave some room.
>
> See https://patchwork.kernel.org/patch/9224837/ and search for __spare[8] in
> the answer from Mat.
>
Well, regardless of what it's reserved *for* (if anything), this is *not* the
correct way to do a reserved field. The API needs to verify that it has value 0
and return -EINVAL otherwise, i.e.
if (memchr_inv(kdfcopy->__spare, 0, sizeof(kdfcopy->__spare)))
return -EINVAL;
It can't simply be ignored, otherwise users will have no way to know whether any
new fields are recognized or not. Also if there is no validation, users will
screw up and pass in a nonzero value (perhaps through leaving it uninitialized)
before it's un-reserved, which will then break as soon as the space is actually
used for something.
Eric
next prev parent reply other threads:[~2017-06-05 22:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20170511003557.3467-1-mathew.j.martineau@linux.intel.com>
2017-06-02 15:58 ` [PATCH v2] KEYS: Convert KEYCTL_DH_COMPUTE to use the crypto KPP API David Howells
2017-06-02 15:58 ` David Howells
2017-06-04 15:38 ` Stephan Müller
2017-06-04 15:38 ` Stephan Müller
2017-06-05 10:03 ` David Howells
2017-06-05 10:03 ` David Howells
2017-06-05 3:41 ` Eric Biggers
2017-06-05 21:51 ` Stephan Müller
2017-06-05 22:03 ` Eric Biggers [this message]
2017-06-06 0:16 ` Mat Martineau
2017-06-06 0:33 ` Mat Martineau
2017-06-06 0:33 ` Mat Martineau
2017-06-07 16:58 ` Mat Martineau
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=20170605220310.GC87699@gmail.com \
--to=ebiggers3@gmail.com \
--cc=keyrings@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.