mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
fix(wpa_supplicant): Assign correct return value for SAE y-construction failure
This commit is contained in:
@@ -66,7 +66,13 @@ static int crypto_ec_point_mul_ecc_hw(const mbedtls_ecp_group *grp,
|
|||||||
ecc_point_t p_hw = { 0 };
|
ecc_point_t p_hw = { 0 };
|
||||||
ecc_point_t r_hw = { 0 };
|
ecc_point_t r_hw = { 0 };
|
||||||
unsigned char scalar_le[MAX_SIZE] = { 0 };
|
unsigned char scalar_le[MAX_SIZE] = { 0 };
|
||||||
size_t curve_len = grp->pbits / 8;
|
size_t curve_len;
|
||||||
|
|
||||||
|
if (!grp || !p || !k || !res) {
|
||||||
|
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
curve_len = grp->pbits / 8;
|
||||||
|
|
||||||
if (!crypto_ec_point_mul_curve_supported(grp)) {
|
if (!crypto_ec_point_mul_curve_supported(grp)) {
|
||||||
return MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
|
return MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
|
||||||
@@ -969,7 +975,11 @@ static int crypto_ec_point_mul_p256_window4_core(const mbedtls_ecp_group *grp,
|
|||||||
int ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
|
int ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
|
||||||
bool started = false;
|
bool started = false;
|
||||||
|
|
||||||
if (!grp || grp->id != MBEDTLS_ECP_DP_SECP256R1 ||
|
if (!grp || !p || !k || !r) {
|
||||||
|
return MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (grp->id != MBEDTLS_ECP_DP_SECP256R1 ||
|
||||||
mbedtls_mpi_cmp_int(&p->MBEDTLS_PRIVATE(Z), 1) != 0) {
|
mbedtls_mpi_cmp_int(&p->MBEDTLS_PRIVATE(Z), 1) != 0) {
|
||||||
return MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
|
return MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
|
||||||
}
|
}
|
||||||
@@ -1167,6 +1177,10 @@ int crypto_ec_point_mul(struct crypto_ec *e, const struct crypto_ec_point *p,
|
|||||||
{
|
{
|
||||||
int ret = MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
int ret = MBEDTLS_ERR_ECP_BAD_INPUT_DATA;
|
||||||
|
|
||||||
|
if (!e || !p || !b || !res) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
#if CONFIG_MBEDTLS_HARDWARE_ECC
|
#if CONFIG_MBEDTLS_HARDWARE_ECC
|
||||||
ret = crypto_ec_point_mul_ecc_hw((mbedtls_ecp_group *)e,
|
ret = crypto_ec_point_mul_ecc_hw((mbedtls_ecp_group *)e,
|
||||||
(const mbedtls_ecp_point *)p,
|
(const mbedtls_ecp_point *)p,
|
||||||
|
|||||||
@@ -406,6 +406,7 @@ static int sae_derive_pwe_ecc(struct sae_data *sae, const u8 *addr1,
|
|||||||
crypto_bignum_to_bin(y, x_y + SAE_MAX_ECC_PRIME_LEN,
|
crypto_bignum_to_bin(y, x_y + SAE_MAX_ECC_PRIME_LEN,
|
||||||
SAE_MAX_ECC_PRIME_LEN, prime_len) < 0) {
|
SAE_MAX_ECC_PRIME_LEN, prime_len) < 0) {
|
||||||
wpa_printf(MSG_DEBUG, "SAE: Could not solve y");
|
wpa_printf(MSG_DEBUG, "SAE: Could not solve y");
|
||||||
|
res = -1;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user