commit 4680c0c13bf86abedf0ca204999018570a3acb0d
parent c36358cc7cbdb0dea516e646414f919303430a7a
Author: James Prestwood <prestwoj@gmail.com>
Date: Fri, 22 Nov 2024 07:15:46 -0800
handshake: add handshake_state_remove_pmksa
This is needed in order to clear the PMKSA from the handshake state
without actually putting it back into the cache. This is something
that will be needed in case the AP rejects the association due to
an expired (or forgotten) PMKSA.
Diffstat:
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/handshake.c b/src/handshake.c
@@ -1280,3 +1280,19 @@ void handshake_state_cache_pmksa(struct handshake_state *s)
if (L_WARN_ON(pmksa_cache_put(pmksa) < 0))
l_free(pmksa);
}
+
+bool handshake_state_remove_pmksa(struct handshake_state *s)
+{
+ struct pmksa *pmksa;
+
+ if (!s->have_pmksa)
+ return false;
+
+ pmksa = handshake_state_steal_pmksa(s);
+ if (!pmksa)
+ return false;
+
+ l_free(pmksa);
+
+ return true;
+}
diff --git a/src/handshake.h b/src/handshake.h
@@ -310,6 +310,7 @@ int handshake_state_verify_oci(struct handshake_state *s, const uint8_t *oci,
bool handshake_state_set_pmksa(struct handshake_state *s, struct pmksa *pmksa);
void handshake_state_cache_pmksa(struct handshake_state *s);
+bool handshake_state_remove_pmksa(struct handshake_state *s);
bool handshake_util_ap_ie_matches(const struct ie_rsn_info *msg_info,
const uint8_t *scan_ie, bool is_wpa);