Skip to contentSkip to conversation

crypto: testmgr: clean up memory for sensitive information

PATCH In review Pirabarlen-Cheenaramen 2 participants 2 messages Apr 23, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: testmgr: clean up memory for sensitive information

---
 crypto/testmgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
crypto/testmgr.c +2 -2
index cd075c7..0af2e16 100644
@@ -953,8 +953,8 @@ static int __test_aead(struct crypto_aead *tfm, int enc,
 out_noaxbuf:
 	testmgr_free_buf(xbuf);
 out_noxbuf:
-	kfree(key);
-	kfree(iv);
+	kzfree(key);
+	kzfree(iv);
 	return ret;
 }
 
Signature · 1 line
1.9.1
#1 lore raw

Am Sonntag, 23. April 2017, 01:40:56 CEST schrieb Pirabarlen-Cheenaramen:

Hi Pirabarlen,

Quoted 11 lines
---
 crypto/testmgr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
crypto/testmgr.c +0 -0
index cd075c7..0af2e16 100644
@@ -953,8 +953,8 @@ static int __test_aead(struct crypto_aead *tfm, int enc,

out_noaxbuf:

crypto/testmgr.c static int __test_aead(struct crypto_aead *tfm, int enc, · line 958

Quoted 7 lines
crypto/testmgr.c +2 -2
 	testmgr_free_buf(xbuf);
 out_noxbuf:
-	kfree(key);
-	kfree(iv);
+	kzfree(key);
+	kzfree(iv);
 	return ret;

Hm, I do not think that key or IV are sensitive in this case.

	memcpy(key, template[i].key, template[i].klen);

	if (template[i].iv)
                        memcpy(iv, template[i].iv, iv_len);
                else
                        memset(iv, 0, MAX_IVLEN);

Ciao
Stephan