3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-19 01:42:33 +01:00

ie: introduce IE_AKM_IS_SAE macro

To prepare for FT over SAE, several case/if statements needed to include
IE_RSN_AKM_SUITE_FT_OVER_SAE. Also a new macro was introduced to remove
duplicate if statement code checking for both FT_OVER_SAE and SAE AKM's.
This commit is contained in:
James Prestwood 2018-09-19 11:30:35 -07:00 committed by Denis Kenzior
parent 6b1c716324
commit 8064cb599a
4 changed files with 11 additions and 2 deletions

View File

@ -81,6 +81,7 @@ bool eapol_calculate_mic(enum ie_rsn_akm_suite akm, const uint8_t *kck,
case EAPOL_KEY_DESCRIPTOR_VERSION_AKM_DEFINED:
switch (akm) {
case IE_RSN_AKM_SUITE_SAE_SHA256:
case IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256:
return cmac_aes(kck, 16, frame, frame_len, mic, 16);
default:
return false;
@ -123,6 +124,7 @@ bool eapol_verify_mic(enum ie_rsn_akm_suite akm, const uint8_t *kck,
case EAPOL_KEY_DESCRIPTOR_VERSION_AKM_DEFINED:
switch (akm) {
case IE_RSN_AKM_SUITE_SAE_SHA256:
case IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256:
checksum = l_checksum_new_cmac_aes(kck, 16);
break;
default:
@ -167,7 +169,7 @@ uint8_t *eapol_decrypt_key_data(enum ie_rsn_akm_suite akm, const uint8_t *kek,
* type this will need to be expanded to handle the AKM types in
* its own switch.
*/
if (akm != IE_RSN_AKM_SUITE_SAE_SHA256)
if (!IE_AKM_IS_SAE(akm))
return NULL;
/* Fall through */

View File

@ -252,6 +252,10 @@ enum ie_rsn_akm_suite {
IE_RSN_AKM_SUITE_FT_OVER_8021X_SHA384 = 0x1000,
};
#define IE_AKM_IS_SAE(akm) \
((akm == IE_RSN_AKM_SUITE_SAE_SHA256) || \
(akm == IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256))
struct ie_tlv_iter {
unsigned int max;
unsigned int pos;

View File

@ -2510,7 +2510,7 @@ int netdev_connect(struct netdev *netdev, struct scan_bss *bss,
if (netdev->connected)
return -EISCONN;
if (hs->akm_suite == IE_RSN_AKM_SUITE_SAE_SHA256) {
if (IE_AKM_IS_SAE(hs->akm_suite)) {
netdev->sae_sm = sae_sm_new(hs, netdev_tx_sae_frame,
netdev_sae_complete, netdev);
} else {

View File

@ -380,6 +380,9 @@ static enum ie_rsn_akm_suite select_akm_suite(struct network *network,
if (info->akm_suites & IE_RSN_AKM_SUITE_8021X)
return IE_RSN_AKM_SUITE_8021X;
} else if (security == SECURITY_PSK) {
if (info->akm_suites & IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256)
return IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256;
if (info->akm_suites & IE_RSN_AKM_SUITE_SAE_SHA256)
return IE_RSN_AKM_SUITE_SAE_SHA256;