• Jason A. Donenfeld's avatar
    security/keys: rewrite big_key crypto to use library interface · 521fd61c
    Jason A. Donenfeld authored
    A while back, I noticed that the crypto and crypto API usage in big_keys
    were entirely broken in multiple ways, so I rewrote it. Now, I'm
    rewriting it again, but this time using the simpler ChaCha20Poly1305
    library function. This makes the file considerably more simple; the
    diffstat alone should justify this commit. It also should be faster,
    since it no longer requires a mutex around the "aead api object" (nor
    allocations), allowing us to encrypt multiple items in parallel. We also
    benefit from being able to pass any type of pointer, so we can get rid
    of the ridiculously complex custom page allocator that big_key really
    doesn't need.
    
    [DH: Change the select CRYPTO_LIB_CHACHA20POLY1305 to a depends on as
     select doesn't propagate and the build can end up with an =y dependending
     on some =m pieces.
    
     The depends on CRYPTO also had to be removed otherwise the configurator
     complains about a recursive dependency.]
    
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Greg KH <gregkh@linuxfoundation.org>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: kernel-hardening@lists.openwall.com
    Reviewed-by: default avatarEric Biggers <ebiggers@google.com>
    Signed-off-by: default avatarJason A. Donenfeld <Jason@zx2c4.com>
    Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
    521fd61c
big_key.c 6.36 KB