commit 8064cb599afd07c18105d868358fb7bf6d61c943
parent 6b1c716324272e353328f5116ca7bf7f7f2ba10d
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Wed, 19 Sep 2018 11:30:35 -0700
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.
Diffstat:
4 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/eapol.c b/src/eapol.c
@@ -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 */
diff --git a/src/ie.h b/src/ie.h
@@ -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;
diff --git a/src/netdev.c b/src/netdev.c
@@ -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 {
diff --git a/src/station.c b/src/station.c
@@ -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;