summaryrefslogtreecommitdiff
path: root/sys/net80211/ieee80211_crypto.c
diff options
context:
space:
mode:
authorDamien Bergamini <damien@cvs.openbsd.org>2007-08-22 20:52:27 +0000
committerDamien Bergamini <damien@cvs.openbsd.org>2007-08-22 20:52:27 +0000
commit195cb071271cf73b0a4551338b5b8c2abfedb1e6 (patch)
treed60a251ad30e10499e0e8484acafff58269cfe2c /sys/net80211/ieee80211_crypto.c
parent4f19245ee53a151b1ae297678ba39835912a1efe (diff)
add a ieee80211_get_txkey() function to determine the key to use for
transmitting a frame to a given node. change ieee80211_encrypt() so that it now takes the key as parameter. this change is required because drivers doing hardware crypto need to know what key is being used.
Diffstat (limited to 'sys/net80211/ieee80211_crypto.c')
-rw-r--r--sys/net80211/ieee80211_crypto.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sys/net80211/ieee80211_crypto.c b/sys/net80211/ieee80211_crypto.c
index efb56d12b3f..4de11315eff 100644
--- a/sys/net80211/ieee80211_crypto.c
+++ b/sys/net80211/ieee80211_crypto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ieee80211_crypto.c,v 1.32 2007/08/22 20:40:34 damien Exp $ */
+/* $OpenBSD: ieee80211_crypto.c,v 1.33 2007/08/22 20:52:26 damien Exp $ */
/* $NetBSD: ieee80211_crypto.c,v 1.5 2003/12/14 09:56:53 dyoung Exp $ */
/*-
@@ -123,21 +123,20 @@ ieee80211_crypto_detach(struct ifnet *ifp)
}
}
-struct mbuf *
-ieee80211_encrypt(struct ieee80211com *ic, struct mbuf *m0,
+struct ieee80211_key *
+ieee80211_get_txkey(struct ieee80211com *ic, const struct ieee80211_frame *wh,
struct ieee80211_node *ni)
{
- struct ieee80211_frame *wh;
- struct ieee80211_key *k;
-
- /* select the key for encryption */
- wh = mtod(m0, struct ieee80211_frame *);
if (IEEE80211_IS_MULTICAST(wh->i_addr1) ||
ni->ni_pairwise_cipher == IEEE80211_CIPHER_USEGROUP)
- k = &ic->ic_nw_keys[ic->ic_wep_txkey];
- else
- k = &ni->ni_pairwise_key;
+ return &ic->ic_nw_keys[ic->ic_wep_txkey];
+ return &ni->ni_pairwise_key;
+}
+struct mbuf *
+ieee80211_encrypt(struct ieee80211com *ic, struct mbuf *m0,
+ struct ieee80211_key *k)
+{
switch (k->k_cipher) {
case IEEE80211_CIPHER_WEP40:
case IEEE80211_CIPHER_WEP104: