if_ath_keycache.c (219185) | if_ath_keycache.c (227357) |
---|---|
1/*- 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 */ 29 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_keycache.c 219185 2011-03-02 17:19:54Z adrian $"); | 31__FBSDID("$FreeBSD: head/sys/dev/ath/if_ath_keycache.c 227357 2011-11-08 19:25:52Z adrian $"); |
32 33/* 34 * Driver for the Atheros Wireless LAN controller. 35 * 36 * This software is derived from work of Atsushi Onoe; his contribution 37 * is greatly appreciated. 38 */ 39 --- 133 unchanged lines hidden (view full) --- 173} 174 175/* 176 * Set a net80211 key into the hardware. This handles the 177 * potential distribution of key state to multiple key 178 * cache slots for TKIP with hardware MIC support. 179 */ 180int | 32 33/* 34 * Driver for the Atheros Wireless LAN controller. 35 * 36 * This software is derived from work of Atsushi Onoe; his contribution 37 * is greatly appreciated. 38 */ 39 --- 133 unchanged lines hidden (view full) --- 173} 174 175/* 176 * Set a net80211 key into the hardware. This handles the 177 * potential distribution of key state to multiple key 178 * cache slots for TKIP with hardware MIC support. 179 */ 180int |
181ath_keyset(struct ath_softc *sc, const struct ieee80211_key *k, | 181ath_keyset(struct ath_softc *sc, struct ieee80211vap *vap, 182 const struct ieee80211_key *k, |
182 struct ieee80211_node *bss) 183{ 184#define N(a) (sizeof(a)/sizeof(a[0])) 185 static const u_int8_t ciphermap[] = { 186 HAL_CIPHER_WEP, /* IEEE80211_CIPHER_WEP */ 187 HAL_CIPHER_TKIP, /* IEEE80211_CIPHER_TKIP */ 188 HAL_CIPHER_AES_OCB, /* IEEE80211_CIPHER_AES_OCB */ 189 HAL_CIPHER_AES_CCM, /* IEEE80211_CIPHER_AES_CCM */ --- 17 unchanged lines hidden (view full) --- 207 KASSERT(cip->ic_cipher < N(ciphermap), 208 ("invalid cipher type %u", cip->ic_cipher)); 209 hk.kv_type = ciphermap[cip->ic_cipher]; 210 hk.kv_len = k->wk_keylen; 211 memcpy(hk.kv_val, k->wk_key, k->wk_keylen); 212 } else 213 hk.kv_type = HAL_CIPHER_CLR; 214 | 183 struct ieee80211_node *bss) 184{ 185#define N(a) (sizeof(a)/sizeof(a[0])) 186 static const u_int8_t ciphermap[] = { 187 HAL_CIPHER_WEP, /* IEEE80211_CIPHER_WEP */ 188 HAL_CIPHER_TKIP, /* IEEE80211_CIPHER_TKIP */ 189 HAL_CIPHER_AES_OCB, /* IEEE80211_CIPHER_AES_OCB */ 190 HAL_CIPHER_AES_CCM, /* IEEE80211_CIPHER_AES_CCM */ --- 17 unchanged lines hidden (view full) --- 208 KASSERT(cip->ic_cipher < N(ciphermap), 209 ("invalid cipher type %u", cip->ic_cipher)); 210 hk.kv_type = ciphermap[cip->ic_cipher]; 211 hk.kv_len = k->wk_keylen; 212 memcpy(hk.kv_val, k->wk_key, k->wk_keylen); 213 } else 214 hk.kv_type = HAL_CIPHER_CLR; 215 |
215 if ((k->wk_flags & IEEE80211_KEY_GROUP) && sc->sc_mcastkey) { | 216 /* 217 * XXX TODO: check this: 218 * 219 * Group keys on hardware that supports multicast frame 220 * key search should only be done in adhoc/hostap mode, 221 * not STA mode. 222 * 223 * XXX TODO: what about mesh, tdma? 224 */ 225#if 0 226 if ((vap->iv_opmode == IEEE80211_M_HOSTAP || 227 vap->iv_opmode == IEEE80211_M_IBSS) && 228#else 229 if ( 230#endif 231 (k->wk_flags & IEEE80211_KEY_GROUP) && 232 sc->sc_mcastkey) { |
216 /* 217 * Group keys on hardware that supports multicast frame 218 * key search use a MAC that is the sender's address with 219 * the multicast bit set instead of the app-specified address. 220 */ 221 IEEE80211_ADDR_COPY(gmac, bss->ni_macaddr); 222 gmac[0] |= 0x01; 223 mac = gmac; --- 264 unchanged lines hidden (view full) --- 488 * slot(s) must already have been allocated by ath_key_alloc. 489 */ 490int 491ath_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, 492 const u_int8_t mac[IEEE80211_ADDR_LEN]) 493{ 494 struct ath_softc *sc = vap->iv_ic->ic_ifp->if_softc; 495 | 233 /* 234 * Group keys on hardware that supports multicast frame 235 * key search use a MAC that is the sender's address with 236 * the multicast bit set instead of the app-specified address. 237 */ 238 IEEE80211_ADDR_COPY(gmac, bss->ni_macaddr); 239 gmac[0] |= 0x01; 240 mac = gmac; --- 264 unchanged lines hidden (view full) --- 505 * slot(s) must already have been allocated by ath_key_alloc. 506 */ 507int 508ath_key_set(struct ieee80211vap *vap, const struct ieee80211_key *k, 509 const u_int8_t mac[IEEE80211_ADDR_LEN]) 510{ 511 struct ath_softc *sc = vap->iv_ic->ic_ifp->if_softc; 512 |
496 return ath_keyset(sc, k, vap->iv_bss); | 513 return ath_keyset(sc, vap, k, vap->iv_bss); |
497} | 514} |