Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638414

Re: [PATCH] key: Convert big_key payload.data to struct

From Eric Biggers <ebiggers3@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH] key: Convert big_key payload.data to struct
Date 2017-05-09 23:50 +0200
Message-ID <tFlb3-7uq-7@gated-at.bofh.it> (permalink)
References <tEZke-1sP-15@gated-at.bofh.it> <tEYHw-Wn-19@gated-at.bofh.it> <tEZ0S-1js-11@gated-at.bofh.it> <tF7KO-6Yd-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, May 09, 2017 at 08:24:18AM +0100, David Howells wrote:
> Eric Biggers <ebiggers3@gmail.com> wrote:
> 
> > It probably would be easier to kmalloc() this struct and store a pointer to
> > it in key->payload.data[0]
> 
> Yeah, but it's a waste of resources if you don't have to do it.
> 
> David

Yes, but it seems very much like a micro-optimization, which isn't helpful when
the code contains undefined behavior and is creating problems.  This is the
*big* key type, after all; shouldn't the amount of data in the key normally be
large enough to make a kmalloc() of 24 bytes insignificant?

And besides, I expect that most users don't even use the big_keys feature.  If
we actually want to avoid wasting resources that aren't used, we shouldn't
allocate the crypto_rng and crypto_skcipher until someone tries to create a
big_key.  (Currently they're allocated unconditionally in big_key_init().)

- Eric

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] key: Convert big_key payload.data to struct Kees Cook <keescook@chromium.org> - 2017-05-08 23:50 +0200
  Re: [PATCH] key: Convert big_key payload.data to struct David Howells <dhowells@redhat.com> - 2017-05-09 00:10 +0200
    Re: [PATCH] key: Convert big_key payload.data to struct Kees Cook <keescook@chromium.org> - 2017-05-09 00:30 +0200
      Re: [PATCH] key: Convert big_key payload.data to struct David Howells <dhowells@redhat.com> - 2017-05-09 10:20 +0200
        Re: [PATCH] key: Convert big_key payload.data to struct Kees Cook <keescook@chromium.org> - 2017-05-09 18:20 +0200
    Re: [PATCH] key: Convert big_key payload.data to struct Eric Biggers <ebiggers3@gmail.com> - 2017-05-09 00:30 +0200
      Re: [PATCH] key: Convert big_key payload.data to struct David Howells <dhowells@redhat.com> - 2017-05-09 09:30 +0200
        Re: [PATCH] key: Convert big_key payload.data to struct Eric Biggers <ebiggers3@gmail.com> - 2017-05-09 23:50 +0200

csiph-web