• Phil Carmody's avatar
    crypto: aes - Undefined behaviour in crypto_aes_expand_key · 7b4ffcf9
    Phil Carmody authored
    It's undefined behaviour in C to write outside the bounds of an array.
    The key expansion routine takes a shortcut of creating 8 words at a
    time, but this creates 4 additional words which don't fit in the array.
    
    As everyone is hopefully now aware, GCC is at liberty to make any
    assumptions and optimisations it likes in situations where it can
    detect that UB has occured, up to and including nasal demons, and
    as the indices being accessed in the array are trivially calculable,
    it's rash to invite gcc to do take any liberties at all.
    Signed-off-by: default avatarPhil Carmody <ext-phil.2.carmody@nokia.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    7b4ffcf9
aes_generic.c 61.9 KB