mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(wifi): Pull in wpa_supplicant upstream code for SAE EXT key
SAE: EAPOL-Key and key/MIC length information for the new AKM suites Update the AKM suite specific mapping of various EAPOL-Key key lengths and algorithms to include the new SAE AKM suites with variable length keys. Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
parent
21ac680eac
commit
5719f7908d
@ -242,6 +242,8 @@ static unsigned int wpa_kck_len(int akmp, size_t pmk_len)
|
||||
return 24;
|
||||
case WPA_KEY_MGMT_OWE:
|
||||
return pmk_len / 2;
|
||||
case WPA_KEY_MGMT_SAE_EXT_KEY:
|
||||
return pmk_len / 2;
|
||||
default:
|
||||
return 16;
|
||||
}
|
||||
@ -254,6 +256,8 @@ static unsigned int wpa_kek_len(int akmp, size_t pmk_len)
|
||||
return 32;
|
||||
case WPA_KEY_MGMT_OWE:
|
||||
return pmk_len <= 32 ? 16 : 32;
|
||||
case WPA_KEY_MGMT_SAE_EXT_KEY:
|
||||
return pmk_len <= 32 ? 16 : 32;
|
||||
default:
|
||||
return 16;
|
||||
}
|
||||
@ -265,6 +269,8 @@ unsigned int wpa_mic_len(int akmp, size_t pmk_len)
|
||||
switch (akmp) {
|
||||
case WPA_KEY_MGMT_IEEE8021X_SUITE_B_192:
|
||||
return 24;
|
||||
case WPA_KEY_MGMT_SAE_EXT_KEY:
|
||||
return pmk_len / 2;
|
||||
default:
|
||||
return 16;
|
||||
}
|
||||
@ -904,6 +910,21 @@ int wpa_eapol_key_mic(const u8 *key, size_t key_len, int akmp, int ver,
|
||||
#ifdef CONFIG_WPA3_SAE
|
||||
case WPA_KEY_MGMT_SAE:
|
||||
return omac1_aes_128(key, buf, len, mic);
|
||||
case WPA_KEY_MGMT_SAE_EXT_KEY:
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"WPA: EAPOL-Key MIC using HMAC-SHA%u (AKM-defined - SAE-EXT-KEY)",
|
||||
(unsigned int) key_len * 8 * 2);
|
||||
if (key_len == 128 / 8) {
|
||||
if (hmac_sha256(key, key_len, buf, len, hash))
|
||||
return -1;
|
||||
} else {
|
||||
wpa_printf(MSG_INFO,
|
||||
"SAE: Unsupported KCK length: %u",
|
||||
(unsigned int) key_len);
|
||||
return -1;
|
||||
}
|
||||
os_memcpy(mic, hash, key_len);
|
||||
break;
|
||||
#endif /* CONFIG_WPA3_SAE */
|
||||
#ifdef CONFIG_SUITEB
|
||||
case WPA_KEY_MGMT_IEEE8021X_SUITE_B:
|
||||
@ -1181,6 +1202,20 @@ int wpa_pmk_to_ptk(const u8 *pmk, size_t pmk_len, const char *label,
|
||||
if (wpa_key_mgmt_sha256(akmp)) {
|
||||
sha256_prf(pmk, pmk_len, label, data, data_len,
|
||||
tmp, ptk_len);
|
||||
#ifdef CONFIG_WPA3_SAE
|
||||
} else if (wpa_key_mgmt_sae_ext_key(akmp)) {
|
||||
if (pmk_len == 32) {
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"SAE: PTK derivation using PRF(SHA256)");
|
||||
if (sha256_prf(pmk, pmk_len, label, data, data_len,
|
||||
tmp, ptk_len) < 0)
|
||||
return -1;
|
||||
} else {
|
||||
wpa_printf(MSG_INFO, "SAE: Unknown PMK length %u",
|
||||
(unsigned int) pmk_len);
|
||||
return -1;
|
||||
}
|
||||
#endif /* CONFIG_WPA3_SAE */
|
||||
} else {
|
||||
sha1_prf(pmk, pmk_len, label, data, data_len, tmp, ptk_len);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user