• Ard Biesheuvel's avatar
    crypto: michael_mic - fix broken misalignment handling · e1b2d980
    Ard Biesheuvel authored
    The Michael MIC driver uses the cra_alignmask to ensure that pointers
    presented to its update and finup/final methods are 32-bit aligned.
    However, due to the way the shash API works, this is no guarantee that
    the 32-bit reads occurring in the update method are also aligned, as the
    size of the buffer presented to update may be of uneven length. For
    instance, an update() of 3 bytes followed by a misaligned update() of 4
    or more bytes will result in a misaligned access using an accessor that
    is not suitable for this.
    
    On most architectures, this does not matter, and so setting the
    cra_alignmask is pointless. On architectures where this does matter,
    setting the cra_alignmask does not actually solve the problem.
    
    So let's get rid of the cra_alignmask, and use unaligned accessors
    instead, where appropriate.
    
    Cc: <stable@vger.kernel.org>
    Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    e1b2d980
michael_mic.c 3.37 KB