• Eric Biggers's avatar
    crypto: x86/aegis - fix handling chunked inputs and MAY_SLEEP · ba6771c0
    Eric Biggers authored
    The x86 AEGIS implementations all fail the improved AEAD tests because
    they produce the wrong result with some data layouts.  The issue is that
    they assume that if the skcipher_walk API gives 'nbytes' not aligned to
    the walksize (a.k.a. walk.stride), then it is the end of the data.  In
    fact, this can happen before the end.
    
    Also, when the CRYPTO_TFM_REQ_MAY_SLEEP flag is given, they can
    incorrectly sleep in the skcipher_walk_*() functions while preemption
    has been disabled by kernel_fpu_begin().
    
    Fix these bugs.
    
    Fixes: 1d373d4e ("crypto: x86 - Add optimized AEGIS implementations")
    Cc: <stable@vger.kernel.org> # v4.18+
    Cc: Ondrej Mosnacek <omosnace@redhat.com>
    Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
    Reviewed-by: default avatarOndrej Mosnacek <omosnace@redhat.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    ba6771c0
aegis256-aesni-glue.c 10.8 KB