eap-pwd: check if server point/scalar is valid

Reported-By: Mathy Vanhoef <Mathy.Vanhoef@nyu.edu>
This commit is contained in:
James Prestwood 2019-04-10 11:54:13 -07:00 committed by Denis Kenzior
parent f9d92d6cdd
commit 9192f506d3
1 changed files with 8 additions and 4 deletions

View File

@ -389,10 +389,16 @@ static void eap_pwd_handle_commit(struct eap_state *eap,
pwd->element_s = l_ecc_point_from_data(pwd->curve,
L_ECC_POINT_TYPE_FULL,
pkt, nbytes * 2);
if (!pwd->element_s)
goto invalid_point;
if (!pwd->element_s) {
l_error("Server sent invalid Element_S during commit");
goto error;
}
pwd->scalar_s = l_ecc_scalar_new(pwd->curve, pkt + nbytes * 2, nbytes);
if (!pwd->scalar_s) {
l_error("Server sent invalid Scalar_S during commit");
goto error;
}
pwd->p_rand = l_ecc_scalar_new_random(pwd->curve);
p_mask = l_ecc_scalar_new_random(pwd->curve);
@ -423,8 +429,6 @@ static void eap_pwd_handle_commit(struct eap_state *eap,
return;
invalid_point:
l_error("invalid point during commit exchange");
error:
eap_method_error(eap);
}