From c1d40e226305b7aa3d0c79e5d8f89a277ac9b67c Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Tue, 5 Dec 2023 07:46:40 -0800 Subject: [PATCH] handshake: add password identifier/setter --- src/handshake.c | 12 ++++++++++++ src/handshake.h | 3 +++ 2 files changed, 15 insertions(+) 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);