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.
This commit is contained in:
Denis Kenzior 2021-07-10 18:54:33 -05:00
parent cb810c12ff
commit d8f9d9d45c
1 changed files with 2 additions and 4 deletions

View File

@ -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);
}