Skip to contentSkip to conversation

dpp: zero nonces/keys on dpp_reset

PATCH In review James Prestwood 2 participants 3 messages Dec 22, 2021

lore
Share & tools
lore

James Prestwood

author
#0 lore raw

PATCH 1/2 dpp: zero nonces/keys on dpp_reset

---
 src/dpp.c | 6 ++++++
 1 file changed, 6 insertions(+)
src/dpp.c +6 -0
index 48343445..941c3f07 100644
@@ -163,6 +163,12 @@ static void dpp_reset(struct dpp_sm *dpp)
 
 	dpp->state = DPP_STATE_NOTHING;
 
+	explicit_bzero(dpp->r_nonce, dpp->nonce_len);
+	explicit_bzero(dpp->i_nonce, dpp->nonce_len);
+	explicit_bzero(dpp->e_nonce, dpp->nonce_len);
+	explicit_bzero(dpp->ke, dpp->key_len);
+	explicit_bzero(dpp->k2, dpp->key_len);
+
 	dpp_free_auth_data(dpp);
 }
 
Signature · 1 line
2.31.1
author
#1 lore raw

PATCH 2/2 dpp: init unwrapped pointer to NULL

Fixes possible issues with auto-free on error paths

---
 src/dpp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/dpp.c +1 -1
index 941c3f07..a4a21b3d 100644
@@ -780,7 +780,7 @@ static void dpp_handle_config_result_frame(struct dpp_sm *dpp,
 	const void *e_nonce = NULL;
 	const void *wrapped = NULL;
 	size_t wrapped_len;
-	_auto_(l_free) void *unwrapped;
+	_auto_(l_free) void *unwrapped = NULL;
 
 	if (dpp->state != DPP_STATE_CONFIGURING)
 		return;
Signature · 1 line
2.31.1
#2 lore raw
In reply to James Prestwood

Hi James,

Quoted 4 lines · James Prestwood
---
  src/dpp.c | 6 ++++++
  1 file changed, 6 insertions(+)

Both applied, thanks.

Regards,
-Denis