mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-16 17:09:24 +01:00
sae: support default group for H2E
This was seemingly trivial at face value but doing so ended up pointing out a bug with how group_retry is set when forcing the default group. Since group_retry is initialized to -1 the increment in the force_default_group block results in it being set to zero, which is actually group 20, not 19. This did not matter for hunt and peck, but H2E actually uses the retry value to index its pre-generated points which then breaks SAE if forcing the default group with H2E. To handle H2E and force_default_group, the group selection logic will always begin iterating the group array regardless of SAE type.
This commit is contained in:
parent
d2f14b2951
commit
1455988efb
41
src/sae.c
41
src/sae.c
@ -152,39 +152,34 @@ static int sae_choose_next_group(struct sae_sm *sm)
|
|||||||
{
|
{
|
||||||
const unsigned int *ecc_groups = l_ecc_supported_ike_groups();
|
const unsigned int *ecc_groups = l_ecc_supported_ike_groups();
|
||||||
bool reset = sm->group_retry >= 0;
|
bool reset = sm->group_retry >= 0;
|
||||||
|
unsigned int group;
|
||||||
|
|
||||||
|
/* Find the next group in the list */
|
||||||
|
while ((group = ecc_groups[++sm->group_retry])) {
|
||||||
/*
|
/*
|
||||||
* If this is a buggy AP in which group negotiation is broken use the
|
* Forcing the default group; only choose group 19. If we have
|
||||||
* default group 19 and fail if this is a retry.
|
* already passed 19 (due to a retry) we will exhaust all other
|
||||||
|
* groups and should fail.
|
||||||
*/
|
*/
|
||||||
if (sm->sae_type == CRYPTO_SAE_LOOPING && sm->force_default_group) {
|
if (sm->force_default_group && group != 19)
|
||||||
if (sm->group_retry != -1) {
|
continue;
|
||||||
l_warn("Forced default group but was rejected!");
|
|
||||||
return -ENOENT;
|
/* Ensure the PT was derived for this group */
|
||||||
|
if (sm->sae_type == CRYPTO_SAE_HASH_TO_ELEMENT &&
|
||||||
|
!sm->handshake->ecc_sae_pts[sm->group_retry])
|
||||||
|
continue;
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
sae_debug("Forcing default SAE group 19");
|
if (!group)
|
||||||
|
|
||||||
sm->group_retry++;
|
|
||||||
sm->group = 19;
|
|
||||||
|
|
||||||
goto get_curve;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
sm->group_retry++;
|
|
||||||
|
|
||||||
if (ecc_groups[sm->group_retry] == 0)
|
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
} while (sm->sae_type != CRYPTO_SAE_LOOPING &&
|
|
||||||
!sm->handshake->ecc_sae_pts[sm->group_retry]);
|
sm->group = group;
|
||||||
|
|
||||||
if (reset)
|
if (reset)
|
||||||
sae_reset_state(sm);
|
sae_reset_state(sm);
|
||||||
|
|
||||||
sm->group = ecc_groups[sm->group_retry];
|
|
||||||
|
|
||||||
get_curve:
|
|
||||||
sae_debug("Using group %u", sm->group);
|
sae_debug("Using group %u", sm->group);
|
||||||
|
|
||||||
sm->curve = l_ecc_curve_from_ike_group(sm->group);
|
sm->curve = l_ecc_curve_from_ike_group(sm->group);
|
||||||
|
Loading…
Reference in New Issue
Block a user