From 17e3a5ee3c5a80db229d4acc20e5ce82300ae4a4 Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Wed, 17 Apr 2019 16:46:17 -0700 Subject: [PATCH] handshake: add setter for PTK With FILS support coming there needs to be a way to set the PTK directly. Other AKMs derive the PTK via the 4-way handshake, but FILS computes the PTK on its own. --- src/handshake.c | 7 +++++++ src/handshake.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/handshake.c b/src/handshake.c index d5787f5f..94389eda 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -117,6 +117,13 @@ void handshake_state_set_pmk(struct handshake_state *s, const uint8_t *pmk, s->have_pmk = true; } +void handshake_state_set_ptk(struct handshake_state *s, const uint8_t *ptk, + size_t ptk_len) +{ + memcpy(s->ptk, ptk, ptk_len); + s->ptk_complete = true; +} + void handshake_state_set_8021x_config(struct handshake_state *s, struct l_settings *settings) { diff --git a/src/handshake.h b/src/handshake.h index 2f97e0b2..c105b971 100644 --- a/src/handshake.h +++ b/src/handshake.h @@ -134,6 +134,8 @@ void handshake_state_set_authenticator_address(struct handshake_state *s, void handshake_state_set_authenticator(struct handshake_state *s, bool auth); void handshake_state_set_pmk(struct handshake_state *s, const uint8_t *pmk, size_t pmk_len); +void handshake_state_set_ptk(struct handshake_state *s, const uint8_t *ptk, + size_t ptk_len); void handshake_state_set_8021x_config(struct handshake_state *s, struct l_settings *settings); bool handshake_state_set_supplicant_rsn(struct handshake_state *s,