• Herbert Xu's avatar
    crypto: gcm - Fix rfc4543 decryption crash · e5393d80
    Herbert Xu authored
    This bug has already bee fixed upstream since 4.2.  However, it
    was fixed during the AEAD conversion so no fix was backported to
    the older kernels.
    
    [bwh: The upstream commit was adcbc688 ("crypto: gcm - Convert to
    new AEAD interface")]
    
    When we do an RFC 4543 decryption, we will end up writing the
    ICV beyond the end of the dst buffer.  This should lead to a
    crash but for some reason it was never noticed.
    
    This patch fixes it by only writing back the ICV for encryption.
    
    Fixes: d733ac90 ("crypto: gcm - fix rfc4543 to handle async...")
    Reported-by: default avatarPatrick Meyer <patrick.meyer@vasgard.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    e5393d80
gcm.c 36.7 KB