mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-29 22:19:23 +01:00
sae: fix a spec violation with duplicate commits
If a commit is received while in an accepted state the spec states the scalar should be checked against the previous commit and if equal the message should be silently dropped.
This commit is contained in:
parent
799e7af9c7
commit
8ca638fb88
28
src/sae.c
28
src/sae.c
@ -1182,10 +1182,32 @@ static int sae_verify_accepted(struct sae_sm *sm, uint16_t trans,
|
|||||||
{
|
{
|
||||||
uint16_t sc;
|
uint16_t sc;
|
||||||
|
|
||||||
/* spec does not specify what to do here, so print and discard */
|
/*
|
||||||
if (trans != SAE_STATE_CONFIRMED) {
|
* 12.4.8.6.1 Parent process behavior
|
||||||
l_error("received transaction %u in accepted state", trans);
|
*
|
||||||
|
* "Upon receipt of an SAE Commit message... and it is in Accepted
|
||||||
|
* state, the scalar in the received frame is checked against the
|
||||||
|
* peer-scalar used in authentication of the existing protocol instance
|
||||||
|
* (in Accepted state). If it is identical, the frame shall be dropped"
|
||||||
|
*/
|
||||||
|
if (trans == SAE_STATE_COMMITTED) {
|
||||||
|
bool drop;
|
||||||
|
unsigned int nbytes = l_ecc_curve_get_scalar_bytes(sm->curve);
|
||||||
|
struct l_ecc_scalar *p_scalar;
|
||||||
|
|
||||||
|
if (len < nbytes + 2)
|
||||||
|
return -EMSGSIZE;
|
||||||
|
|
||||||
|
p_scalar = l_ecc_scalar_new(sm->curve, frame + 2, nbytes);
|
||||||
|
|
||||||
|
drop = l_ecc_scalars_are_equal(sm->p_scalar, p_scalar);
|
||||||
|
l_ecc_scalar_free(p_scalar);
|
||||||
|
|
||||||
|
if (drop)
|
||||||
return -EBADMSG;
|
return -EBADMSG;
|
||||||
|
|
||||||
|
l_error("received transaction %u in accepted state", trans);
|
||||||
|
return -EPROTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sm->sync > SAE_SYNC_MAX)
|
if (sm->sync > SAE_SYNC_MAX)
|
||||||
|
Loading…
Reference in New Issue
Block a user