automake build system
[mech_eap.orig] / src / ap / wpa_auth_ft.c
index 6e45af8..c9871d9 100644 (file)
@@ -55,6 +55,7 @@ static int wpa_ft_rrb_send(struct wpa_authenticator *wpa_auth, const u8 *dst,
 {
        if (wpa_auth->cb.send_ether == NULL)
                return -1;
+       wpa_printf(MSG_DEBUG, "FT: RRB send to " MACSTR, MAC2STR(dst));
        return wpa_auth->cb.send_ether(wpa_auth->cb.ctx, dst, ETH_P_RRB,
                                       data, data_len);
 }
@@ -97,11 +98,11 @@ int wpa_write_mdie(struct wpa_auth_config *conf, u8 *buf, size_t len)
 }
 
 
-static int wpa_write_ftie(struct wpa_auth_config *conf, const u8 *r0kh_id,
-                         size_t r0kh_id_len,
-                         const u8 *anonce, const u8 *snonce,
-                         u8 *buf, size_t len, const u8 *subelem,
-                         size_t subelem_len)
+int wpa_write_ftie(struct wpa_auth_config *conf, const u8 *r0kh_id,
+                  size_t r0kh_id_len,
+                  const u8 *anonce, const u8 *snonce,
+                  u8 *buf, size_t len, const u8 *subelem,
+                  size_t subelem_len)
 {
        u8 *pos = buf, *ielen;
        struct rsn_ftie *hdr;
@@ -692,6 +693,11 @@ u8 * wpa_sm_write_assoc_resp_ies(struct wpa_state_machine *sm, u8 *pos,
        ftie_len = res;
        pos += res;
 
+       os_free(sm->assoc_resp_ftie);
+       sm->assoc_resp_ftie = os_malloc(ftie_len);
+       if (sm->assoc_resp_ftie)
+               os_memcpy(sm->assoc_resp_ftie, ftie, ftie_len);
+
        _ftie = (struct rsn_ftie *) (ftie + 2);
        if (auth_alg == WLAN_AUTH_FT)
                _ftie->mic_control[1] = 3; /* Information element count */
@@ -1426,7 +1432,7 @@ static int wpa_ft_rrb_rx_pull(struct wpa_authenticator *wpa_auth,
        wpa_hexdump_key(MSG_DEBUG, "FT: PMK-R1", r.pmk_r1, PMK_LEN);
        wpa_hexdump(MSG_DEBUG, "FT: PMKR1Name", r.pmk_r1_name,
                    WPA_PMK_NAME_LEN);
-       r.pairwise = pairwise;
+       r.pairwise = host_to_le16(pairwise);
 
        if (aes_wrap(r1kh->key, (FT_R0KH_R1KH_RESP_DATA_LEN + 7) / 8,
                     r.nonce, resp.nonce) < 0) {
@@ -1729,7 +1735,7 @@ static void wpa_ft_generate_pmk_r1(struct wpa_authenticator *wpa_auth,
                    WPA_PMK_NAME_LEN);
        os_get_time(&now);
        WPA_PUT_LE32(f.timestamp, now.sec);
-       f.pairwise = pairwise;
+       f.pairwise = host_to_le16(pairwise);
        if (aes_wrap(r1kh->key, (FT_R0KH_R1KH_PUSH_DATA_LEN + 7) / 8,
                     f.timestamp, frame.timestamp) < 0)
                return;