crypto: aead - prevent using AEADs without setting key
authorEric Biggers <ebiggers@google.com>
Wed, 3 Jan 2018 19:16:30 +0000 (11:16 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Jan 2018 12:03:39 +0000 (23:03 +1100)
commitdc26c17f743aa8e4720a5fda577dde855f2e36f8
treefcd23cb048b79d5d3a83a0901aae8289da8e46cc
parentf8d33fac84806eebd2ba31a3136066eeca19255f
crypto: aead - prevent using AEADs without setting key

Similar to what was done for the hash API, update the AEAD API to track
whether each transform has been keyed, and reject encryption/decryption
if a key is needed but one hasn't been set.

This isn't quite as important as the equivalent fix for the hash API
because AEADs always require a key, so are unlikely to be used without
one.  Still, tracking the key will prevent accidental unkeyed use.
algif_aead also had to track the key anyway, so the new flag replaces
that and slightly simplifies the algif_aead implementation.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/aead.c
crypto/algif_aead.c
include/crypto/aead.h