diff --git a/src/common/sae.c b/src/common/sae.c index 44ffcd09f..900702a59 100644 --- a/src/common/sae.c +++ b/src/common/sae.c @@ -524,12 +524,6 @@ static int sae_derive_k_ecc(struct sae_data *sae, u8 *k) if (K == NULL) goto fail; - if (!crypto_ec_point_is_on_curve(sae->tmp->ec, - sae->tmp->peer_commit_element_ecc)) { - wpa_printf(MSG_DEBUG, "SAE: Peer element is not on curve"); - goto fail; - } - /* * K = scalar-op(rand, (elem-op(scalar-op(peer-commit-scalar, PWE), * PEER-COMMIT-ELEMENT))) @@ -821,6 +815,12 @@ static u16 sae_parse_commit_element_ecc(struct sae_data *sae, const u8 *pos, if (sae->tmp->peer_commit_element_ecc == NULL) return WLAN_STATUS_UNSPECIFIED_FAILURE; + if (!crypto_ec_point_is_on_curve(sae->tmp->ec, + sae->tmp->peer_commit_element_ecc)) { + wpa_printf(MSG_DEBUG, "SAE: Peer element is not on curve"); + return WLAN_STATUS_UNSPECIFIED_FAILURE; + } + return WLAN_STATUS_SUCCESS; }