3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

sae: verify peer element for valid point

The return from l_ecc_point_from_data was not being checked for NULL,
which would cause a segfault if the peer sent an invalid point.
This adds a check and fails the protocol if p_element is NULL, as the
spec defines.
This commit is contained in:
James Prestwood 2019-01-10 13:43:37 -08:00 committed by Denis Kenzior
parent 48f5a051bc
commit 73dd0602fd

View File

@ -450,6 +450,10 @@ static void sae_process_commit(struct sae_sm *sm, const uint8_t *from,
sm->p_element = l_ecc_point_from_data(sm->curve, L_ECC_POINT_TYPE_FULL, sm->p_element = l_ecc_point_from_data(sm->curve, L_ECC_POINT_TYPE_FULL,
ptr, 64); ptr, 64);
if (!sm->p_element) {
reason = MMPDU_REASON_CODE_UNSPECIFIED;
goto reject;
}
if (l_ecc_scalars_are_equal(sm->p_scalar, sm->scalar) || if (l_ecc_scalars_are_equal(sm->p_scalar, sm->scalar) ||
l_ecc_points_are_equal(sm->p_element, sm->element)) { l_ecc_points_are_equal(sm->p_element, sm->element)) {