crypto: authenc - don't leak pointers to authenc keys
authorTudor-Dan Ambarus <tudor.ambarus@microchip.com>
Tue, 3 Apr 2018 06:39:00 +0000 (09:39 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 20 Apr 2018 16:58:30 +0000 (00:58 +0800)
In crypto_authenc_setkey we save pointers to the authenc keys in
a local variable of type struct crypto_authenc_keys and we don't
zeroize it after use. Fix this and don't leak pointers to the
authenc keys.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/authenc.c

index d3d6d72fe649ff00e87bf3a2eb0db591da11081e..4fa8d40d947b7594f8a7b089a8a86e8ea1b5e81d 100644 (file)
@@ -108,6 +108,7 @@ static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
                                       CRYPTO_TFM_RES_MASK);
 
 out:
+       memzero_explicit(&keys, sizeof(keys));
        return err;
 
 badkey: