Skip to contentSkip to conversation

crypto: asym_tpm: correct zero out potential secrets

PATCH New Greg Kroah-Hartman 1 participant 1 message Dec 4, 2020

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

PATCH 1/1 crypto: asym_tpm: correct zero out potential secrets

The function derive_pub_key() should be calling memzero_explicit() instead of memset() in case the complier decides to optimize away the call to memset() because it "knows" no one is going to touch the memory anymore.

---
 crypto/asymmetric_keys/asym_tpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/asymmetric_keys/asym_tpm.c +1 -1
index 378b18b9bc34..84a5d6af9609 100644
@@ -354,7 +354,7 @@ static uint32_t derive_pub_key(const void *pub_key, uint32_t len, uint8_t *buf)
 	memcpy(cur, e, sizeof(e));
 	cur += sizeof(e);
 	/* Zero parameters to satisfy set_pub_key ABI. */
-	memset(cur, 0, SETKEY_PARAMS_SIZE);
+	memzero_explicit(cur, SETKEY_PARAMS_SIZE);
 
 	return cur - buf;
 }
Signature · 1 line
2.29.2