Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90307
b: refs/heads/master
c: 9ae4fda
h: refs/heads/master
i:
  90305: 22b1077
  90303: 49c8bc5
v: v3
  • Loading branch information
Emmanuel Grumbach authored and John W. Linville committed Mar 25, 2008
1 parent a0719ab commit e7f9096
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5d2cdcd4e85c5187db30a6b29f79fbbe59f39f78
refs/heads/master: 9ae4fda332df616ef47d5bb710c39681641d4303
17 changes: 17 additions & 0 deletions trunk/include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,16 @@ static inline void SET_IEEE80211_PERM_ADDR(struct ieee80211_hw *hw, u8 *addr)
* parameter is guaranteed to be valid until another call to set_key()
* removes it, but it can only be used as a cookie to differentiate
* keys.
*
* In TKIP some HW need to be provided a phase 1 key, for RX decryption
* acceleration (i.e. iwlwifi). Those drivers should provide update_tkip_key
* handler.
* The update_tkip_key() call updates the driver with the new phase 1 key.
* This happens everytime the iv16 wraps around (every 65536 packets). The
* set_key() call will happen only once for each key (unless the AP did
* rekeying), it will not include a valid phase 1 key. The valid phase 1 key is
* provided by udpate_tkip_key only. The trigger that makes mac80211 call this
* handler is software decryption with wrap around of iv16.
*/

/**
Expand Down Expand Up @@ -1003,6 +1013,10 @@ enum ieee80211_ampdu_mlme_action {
* and remove_interface calls, i.e. while the interface with the
* given local_address is enabled.
*
* @update_tkip_key: See the section "Hardware crypto acceleration"
* This callback will be called in the context of Rx. Called for drivers
* which set IEEE80211_KEY_FLAG_TKIP_REQ_RX_P1_KEY.
*
* @hw_scan: Ask the hardware to service the scan request, no need to start
* the scan state machine in stack. The scan must honour the channel
* configuration done by the regulatory agent in the wiphy's registered
Expand Down Expand Up @@ -1094,6 +1108,9 @@ struct ieee80211_ops {
int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
const u8 *local_address, const u8 *address,
struct ieee80211_key_conf *key);
void (*update_tkip_key)(struct ieee80211_hw *hw,
struct ieee80211_key_conf *conf, const u8 *address,
u32 iv32, u16 *phase1key);
int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);
int (*get_stats)(struct ieee80211_hw *hw,
struct ieee80211_low_level_stats *stats);
Expand Down
15 changes: 14 additions & 1 deletion trunk/net/mac80211/tkip.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
struct ieee80211_key *key,
u8 *payload, size_t payload_len, u8 *ta,
int only_iv, int queue,
u8 *ra, int only_iv, int queue,
u32 *out_iv32, u16 *out_iv16)
{
u32 iv32;
Expand Down Expand Up @@ -368,6 +368,19 @@ int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
printk("\n");
}
#endif /* CONFIG_TKIP_DEBUG */
if (key->local->ops->update_tkip_key &&
key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
u8 bcast[ETH_ALEN] =
{0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
u8 *sta_addr = key->sta->addr;

if (is_multicast_ether_addr(ra))
sta_addr = bcast;

key->local->ops->update_tkip_key(
local_to_hw(key->local), &key->conf,
sta_addr, iv32, key->u.tkip.p1k_rx[queue]);
}
}

tkip_mixing_phase2(key->u.tkip.p1k_rx[queue],
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/mac80211/tkip.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ enum {
int ieee80211_tkip_decrypt_data(struct crypto_blkcipher *tfm,
struct ieee80211_key *key,
u8 *payload, size_t payload_len, u8 *ta,
int only_iv, int queue,
u8 *ra, int only_iv, int queue,
u32 *out_iv32, u16 *out_iv16);

#endif /* TKIP_H */
2 changes: 1 addition & 1 deletion trunk/net/mac80211/wpa.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ ieee80211_crypto_tkip_decrypt(struct ieee80211_rx_data *rx)
res = ieee80211_tkip_decrypt_data(rx->local->wep_rx_tfm,
key, skb->data + hdrlen,
skb->len - hdrlen, rx->sta->addr,
hwaccel, rx->queue,
hdr->addr1, hwaccel, rx->queue,
&rx->tkip_iv32,
&rx->tkip_iv16);
if (res != TKIP_DECRYPT_OK || wpa_test) {
Expand Down

0 comments on commit e7f9096

Please sign in to comment.