From d8f9d9d45cc4cfecef65927eb518048184a834b9 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Sat, 10 Jul 2021 18:54:33 -0500 Subject: [PATCH] sae: Transition to a new state explicitly Do not try to transition to a new state from sae_send_commit / sae_send_confirm since these methods can be called due to retransmissions or other unexpected messages. Instead, transition to the new state explicitly from sae_process_commit / sae_process_confirm. --- src/sae.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/sae.c b/src/sae.c index d80fd506..1be6cfcd 100644 --- a/src/sae.c +++ b/src/sae.c @@ -469,8 +469,6 @@ static void sae_send_confirm(struct sae_sm *sm) memcpy(ptr, confirm, 32); ptr += 32; - sm->state = SAE_STATE_CONFIRMED; - sm->tx_auth(body, 38, sm->user_data); } @@ -584,6 +582,7 @@ static int sae_process_commit(struct sae_sm *sm, const uint8_t *from, memcpy(sm->pmkid, tmp, 16); sae_send_confirm(sm); + sm->state = SAE_STATE_CONFIRMED; return 0; @@ -655,8 +654,6 @@ static bool sae_send_commit(struct sae_sm *sm, bool retry) if (!sae_build_commit(sm, hs->spa, hs->aa, commit, &len, retry)) return false; - sm->state = SAE_STATE_COMMITTED; - sm->tx_auth(commit, len, sm->user_data); return true; @@ -1062,6 +1059,7 @@ static bool sae_start(struct auth_proto *ap) else memcpy(sm->peer, sm->handshake->aa, 6); + sm->state = SAE_STATE_COMMITTED; return sae_send_commit(sm, false); }