• Ondrej Kozina's avatar
    dm crypt: wipe kernel key copy after IV initialization · dc94902b
    Ondrej Kozina authored
    Loading key via kernel keyring service erases the internal
    key copy immediately after we pass it in crypto layer. This is
    wrong because IV is initialized later and we use wrong key
    for the initialization (instead of real key there's just zeroed
    block).
    
    The bug may cause data corruption if key is loaded via kernel keyring
    service first and later same crypt device is reactivated using exactly
    same key in hexbyte representation, or vice versa. The bug (and fix)
    affects only ciphers using following IVs: essiv, lmk and tcw.
    
    Fixes: c538f6ec ("dm crypt: add ability to use keys from the kernel key retention service")
    Cc: stable@vger.kernel.org # 4.10+
    Signed-off-by: default avatarOndrej Kozina <okozina@redhat.com>
    Reviewed-by: default avatarMilan Broz <gmazyland@gmail.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    dc94902b
dm-crypt.c 77.3 KB