Skip to contentSkip to conversation

crypto: gf128mul - Zero memory when freeing multiplication table

PATCH New Alex Cope 1 participant 1 message Nov 14, 2016 Crypto API

lore
Share & tools
lore

Alex Cope

author
#0 lore raw

PATCH 1/1 crypto: gf128mul - Zero memory when freeing multiplication table

GF(2^128) multiplication tables are typically used for secret information, so it's a good idea to zero them on free.

---
 crypto/gf128mul.c         | 4 ++--
 include/crypto/gf128mul.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
crypto/gf128mul.c +2 -2
index 5276607..0594dd6 100644
@@ -352,8 +352,8 @@ void gf128mul_free_64k(struct gf128mul_64k *t)
 	int i;
 
 	for (i = 0; i < 16; i++)
-		kfree(t->t[i]);
-	kfree(t);
+		kzfree(t->t[i]);
+	kzfree(t);
 }
 EXPORT_SYMBOL(gf128mul_free_64k);
 
include/crypto/gf128mul.h +1 -1
index da2530e..7217fe6 100644
@@ -177,7 +177,7 @@ void gf128mul_4k_bbe(be128 *a, struct gf128mul_4k *t);
 
 static inline void gf128mul_free_4k(struct gf128mul_4k *t)
 {
-	kfree(t);
+	kzfree(t);
 }
 
 
Signature · 1 line
2.8.0.rc3.226.g39d4020