diff --git a/src/common/sae.c b/src/common/sae.c index ff26e9e31..fcca157f2 100644 --- a/src/common/sae.c +++ b/src/common/sae.c @@ -202,6 +202,12 @@ static int sae_derive_pwe(struct sae_data *sae, const u8 *addr1, u8 pwd_seed[SHA256_MAC_LEN]; int res; + if (counter > 200) { + /* This should not happen in practice */ + wpa_printf(MSG_DEBUG, "SAE: Failed to derive PWE"); + break; + } + wpa_printf(MSG_DEBUG, "SAE: counter = %u", counter); if (hmac_sha256_vector(addrs, sizeof(addrs), 2, addr, len, pwd_seed) < 0) @@ -220,12 +226,6 @@ static int sae_derive_pwe(struct sae_data *sae, const u8 *addr1, wpa_printf(MSG_DEBUG, "SAE: Use this PWE"); found = 1; } - - if (counter > 200) { - /* This should not happen in practice */ - wpa_printf(MSG_DEBUG, "SAE: Failed to derive PWE"); - break; - } } crypto_ec_point_deinit(pwe_tmp, 1);