1 --- a/src/drivers/driver_madwifi.c
2 +++ b/src/drivers/driver_madwifi.c
3 @@ -459,7 +459,9 @@ wpa_driver_madwifi_set_key(const char *i
5 memset(&wk, 0, sizeof(wk));
7 - wk.ik_flags = IEEE80211_KEY_RECV | IEEE80211_KEY_XMIT;
8 + wk.ik_flags = IEEE80211_KEY_RECV;
10 + wk.ik_flags |= IEEE80211_KEY_XMIT;
11 if (addr == NULL || is_broadcast_ether_addr(addr)) {
12 memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
13 wk.ik_keyix = key_idx;
14 @@ -471,6 +473,20 @@ wpa_driver_madwifi_set_key(const char *i
15 wk.ik_keylen = key_len;
16 memcpy(wk.ik_keydata, key, key_len);
18 +#ifdef WORDS_BIGENDIAN
19 +#define WPA_KEY_RSC_LEN 8
22 + u8 tmp[WPA_KEY_RSC_LEN];
23 + os_memset(tmp, 0, sizeof(tmp));
24 + for (i = 0; i < seq_len; i++)
25 + tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i];
26 + os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN);
28 +#else /* WORDS_BIGENDIAN */
29 + os_memcpy(&wk.ik_keyrsc, seq, seq_len);
30 +#endif /* WORDS_BIGENDIAN */
32 ret = set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk));
34 wpa_printf(MSG_DEBUG, "%s: Failed to set key (addr %s"