]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
SAE: Fix external authentication on big endian platforms
authorAshok Ponnaiah <aponnaia@codeaurora.org>
Fri, 30 Nov 2018 15:26:26 +0000 (17:26 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 30 Nov 2018 15:26:26 +0000 (17:26 +0200)
Need to handle the little endian 16-bit fields properly when building
and parsing Authentication frames.

Fixes: 5ff39c1380d9 ("SAE: Support external authentication offload for driver-SME cases")
Signed-off-by: Ashok Ponnaiah <aponnaia@codeaurora.org>
wpa_supplicant/sme.c

index a7e3bf28b98897822de557ac984fc0d54b716b1b..ccc2064bcfc5e20ebf8e16ebcf0482765c313a91 100644 (file)
@@ -895,10 +895,10 @@ static int sme_external_auth_build_buf(struct wpabuf *buf,
        os_memcpy(resp->da, da, ETH_ALEN);
        os_memcpy(resp->sa, sa, ETH_ALEN);
        os_memcpy(resp->bssid, da, ETH_ALEN);
-       resp->u.auth.auth_alg = WLAN_AUTH_SAE;
-       resp->seq_ctrl = seq_num << 4;
-       resp->u.auth.auth_transaction = auth_transaction;
-       resp->u.auth.status_code = WLAN_STATUS_SUCCESS;
+       resp->u.auth.auth_alg = host_to_le16(WLAN_AUTH_SAE);
+       resp->seq_ctrl = host_to_le16(seq_num << 4);
+       resp->u.auth.auth_transaction = host_to_le16(auth_transaction);
+       resp->u.auth.status_code = host_to_le16(WLAN_STATUS_SUCCESS);
        if (params)
                wpabuf_put_buf(buf, params);
 
@@ -1178,13 +1178,14 @@ void sme_external_auth_mgmt_rx(struct wpa_supplicant *wpa_s,
                return;
        }
 
-       if (header->u.auth.auth_alg == WLAN_AUTH_SAE) {
+       if (le_to_host16(header->u.auth.auth_alg) == WLAN_AUTH_SAE) {
                int res;
 
-               res = sme_sae_auth(wpa_s, header->u.auth.auth_transaction,
-                                  header->u.auth.status_code,
-                                  header->u.auth.variable,
-                                  len - auth_length, 1, header->sa);
+               res = sme_sae_auth(
+                       wpa_s, le_to_host16(header->u.auth.auth_transaction),
+                       le_to_host16(header->u.auth.status_code),
+                       header->u.auth.variable,
+                       len - auth_length, 1, header->sa);
                if (res < 0) {
                        /* Notify failure to the driver */
                        sme_send_external_auth_status(