[lkml]   [2017]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] key: Convert big_key to struct
On Tue, May 09, 2017 at 08:24:18AM +0100, David Howells wrote:
> Eric Biggers <> wrote:
> > It probably would be easier to kmalloc() this struct and store a pointer to
> > it in key->[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

 \ /
  Last update: 2017-05-10 21:20    [W:0.057 / U:0.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site