OSDN Git Service

big key: get rid of stack array allocation
authorTycho Andersen <tycho@tycho.ws>
Tue, 24 Apr 2018 20:26:37 +0000 (14:26 -0600)
committerJames Morris <james.morris@microsoft.com>
Fri, 11 May 2018 20:07:45 +0000 (13:07 -0700)
commita964f395614af195cf5c5caa84a9c487b86d5ba5
tree4f816e0c843c2aa721e58ae9f9693054dc1b5396
parent5859cdf55063943192f316b3d6c673fd6fcbee46
big key: get rid of stack array allocation

We're interested in getting rid of all of the stack allocated arrays in the
kernel [1]. This patch simply hardcodes the iv length to match that of the
hardcoded cipher.

[1]: https://lkml.org/lkml/2018/3/7/621

v2: hardcode the length of the nonce to be the GCM AES IV length, and do a
    sanity check in init(), Eric Biggers
v3: * remember to free big_key_aead when sanity check fails
    * define a constant for big key IV size so it can be changed along side
      the algorithm in the code

Signed-off-by: Tycho Andersen <tycho@tycho.ws>
Reviewed-by: Kees Cook <keescook@chromium.org>
CC: David Howells <dhowells@redhat.com>
CC: James Morris <jmorris@namei.org>
CC: "Serge E. Hallyn" <serge@hallyn.com>
CC: Jason A. Donenfeld <Jason@zx2c4.com>
CC: Eric Biggers <ebiggers3@gmail.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
security/keys/big_key.c