diff mbox series

[03/10] handshake: add password identifier/setter

Message ID 20231205154647.1778389-3-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [01/10] scan: parse password identifier/exclusive bits | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

James Prestwood Dec. 5, 2023, 3:46 p.m. UTC
---
 src/handshake.c | 12 ++++++++++++
 src/handshake.h |  3 +++
 2 files changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/src/handshake.c b/src/handshake.c
index 1c5ed2c9..cf9c18d5 100644
--- a/src/handshake.c
+++ b/src/handshake.c
@@ -137,6 +137,12 @@  void handshake_state_free(struct handshake_state *s)
 		l_free(s->passphrase);
 	}
 
+	if (s->password_identifier) {
+		explicit_bzero(s->password_identifier,
+				strlen(s->password_identifier));
+		l_free(s->password_identifier);
+	}
+
 	if (s->ecc_sae_pts) {
 		unsigned int i;
 
@@ -364,6 +370,12 @@  void handshake_state_set_passphrase(struct handshake_state *s,
 	s->passphrase = l_strdup(passphrase);
 }
 
+void handshake_state_set_password_identifier(struct handshake_state *s,
+						const char *id)
+{
+	s->password_identifier = l_strdup(id);
+}
+
 void handshake_state_set_no_rekey(struct handshake_state *s, bool no_rekey)
 {
 	s->no_rekey = no_rekey;
diff --git a/src/handshake.h b/src/handshake.h
index 815eb44f..3b51cb34 100644
--- a/src/handshake.h
+++ b/src/handshake.h
@@ -143,6 +143,7 @@  struct handshake_state {
 	uint8_t ssid[32];
 	size_t ssid_len;
 	char *passphrase;
+	char *password_identifier;
 	uint8_t r0khid[48];
 	size_t r0khid_len;
 	uint8_t r1khid[6];
@@ -228,6 +229,8 @@  void handshake_state_set_event_func(struct handshake_state *s,
 					void *user_data);
 void handshake_state_set_passphrase(struct handshake_state *s,
 					const char *passphrase);
+void handshake_state_set_password_identifier(struct handshake_state *s,
+						const char *id);
 bool handshake_state_add_ecc_sae_pt(struct handshake_state *s,
 					const struct l_ecc_point *pt);
 void handshake_state_set_no_rekey(struct handshake_state *s, bool no_rekey);