Patchwork [v3,2/2] crypto: authencesn - don't leak pointers to authenc keys

login
register
mail settings
Submitter Tudor-Dan Ambarus
Date April 3, 2018, 6:39 a.m.
Message ID <20180403063901.5123-2-tudor.ambarus@microchip.com>
Download mbox | patch
Permalink /patch/10320657/
State Accepted
Delegated to: Herbert Xu
Headers show

Comments

Tudor-Dan Ambarus - April 3, 2018, 6:39 a.m.
In crypto_authenc_esn_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>
---
 crypto/authencesn.c | 1 +
 1 file changed, 1 insertion(+)
Herbert Xu - April 20, 2018, 4:50 p.m.
On Tue, Apr 03, 2018 at 09:39:01AM +0300, Tudor Ambarus wrote:
> In crypto_authenc_esn_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>

Patch applied.  Thanks.

Patch

diff --git a/crypto/authencesn.c b/crypto/authencesn.c
index 15f91dd..50b8047 100644
--- a/crypto/authencesn.c
+++ b/crypto/authencesn.c
@@ -90,6 +90,7 @@  static int crypto_authenc_esn_setkey(struct crypto_aead *authenc_esn, const u8 *
 					   CRYPTO_TFM_RES_MASK);
 
 out:
+	memzero_explicit(&keys, sizeof(keys));
 	return err;
 
 badkey: