Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/net80211 Initialize all avail ciphers.
details: https://anonhg.NetBSD.org/src-all/rev/c199740ff90d
branches: trunk
changeset: 932448:c199740ff90d
user: Nathanial Sloss <nat%netbsd.org@localhost>
date: Fri May 08 07:09:14 2020 +1000
description:
Initialize all avail ciphers.
Avoid an unnecessary panic if we don't have a particular cipher.
diffstat:
sys/net80211/ieee80211_crypto.c | 7 ++++++-
sys/net80211/ieee80211_crypto.h | 3 +++
sys/net80211/ieee80211_crypto_ccmp.c | 6 +++---
sys/net80211/ieee80211_crypto_tkip.c | 2 +-
sys/net80211/ieee80211_crypto_wep.c | 2 +-
5 files changed, 14 insertions(+), 6 deletions(-)
diffs (84 lines):
diff -r 97820c5f9f3c -r c199740ff90d sys/net80211/ieee80211_crypto.c
--- a/sys/net80211/ieee80211_crypto.c Wed May 06 10:27:40 2020 +1000
+++ b/sys/net80211/ieee80211_crypto.c Fri May 08 07:09:14 2020 +1000
@@ -165,6 +165,9 @@
{
/* NB: we assume everything is pre-zero'd */
ciphers[IEEE80211_CIPHER_NONE] = &ieee80211_cipher_none;
+ ciphers[IEEE80211_CIPHER_TKIP] = &tkip;
+ ciphers[IEEE80211_CIPHER_WEP] = &wep;
+ ciphers[IEEE80211_CIPHER_AES_CCM] = &ccmp;
}
/*
@@ -333,7 +336,9 @@
return 0;
}
#else
- panic("wlan_cipher not usable."); /* NNN NetBSD modules? */
+ IEEE80211_DPRINTF(vap, IEEE80211_MSG_CRYPTO,
+ "%s: no support for cipher %d\n", __func__, cipher);
+ return 0;
#endif
}
diff -r 97820c5f9f3c -r c199740ff90d sys/net80211/ieee80211_crypto.h
--- a/sys/net80211/ieee80211_crypto.h Wed May 06 10:27:40 2020 +1000
+++ b/sys/net80211/ieee80211_crypto.h Fri May 08 07:09:14 2020 +1000
@@ -200,6 +200,9 @@
int (*ic_demic)(struct ieee80211_key *, struct mbuf *, int);
};
extern const struct ieee80211_cipher ieee80211_cipher_none;
+extern const struct ieee80211_cipher tkip;
+extern const struct ieee80211_cipher ccmp;
+extern const struct ieee80211_cipher wep;
#define IEEE80211_KEY_UNDEFINED(k) \
((k)->wk_cipher == &ieee80211_cipher_none)
diff -r 97820c5f9f3c -r c199740ff90d sys/net80211/ieee80211_crypto_ccmp.c
--- a/sys/net80211/ieee80211_crypto_ccmp.c Wed May 06 10:27:40 2020 +1000
+++ b/sys/net80211/ieee80211_crypto_ccmp.c Fri May 08 07:09:14 2020 +1000
@@ -90,7 +90,7 @@
static int ccmp_enmic(struct ieee80211_key *, struct mbuf *, int);
static int ccmp_demic(struct ieee80211_key *, struct mbuf *, int);
-static const struct ieee80211_cipher ccmp = {
+const struct ieee80211_cipher ccmp = {
.ic_name = "AES-CCM",
.ic_cipher = IEEE80211_CIPHER_AES_CCM,
.ic_header = IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN +
@@ -257,8 +257,8 @@
struct ccmp_ctx *ctx = k->wk_private;
struct ieee80211vap *vap = ctx->cc_vap;
struct ieee80211_frame *wh;
- uint8_t *ivp, tid;
- uint64_t pn;
+ uint8_t *ivp, tid = 0;
+ uint64_t pn = 0;
rxs = ieee80211_get_rx_params_ptr(m);
diff -r 97820c5f9f3c -r c199740ff90d sys/net80211/ieee80211_crypto_tkip.c
--- a/sys/net80211/ieee80211_crypto_tkip.c Wed May 06 10:27:40 2020 +1000
+++ b/sys/net80211/ieee80211_crypto_tkip.c Fri May 08 07:09:14 2020 +1000
@@ -81,7 +81,7 @@
static int tkip_decap(struct ieee80211_key *, struct mbuf *, int);
static int tkip_demic(struct ieee80211_key *, struct mbuf *, int);
-static const struct ieee80211_cipher tkip = {
+const struct ieee80211_cipher tkip = {
.ic_name = "TKIP",
.ic_cipher = IEEE80211_CIPHER_TKIP,
.ic_header = IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN +
diff -r 97820c5f9f3c -r c199740ff90d sys/net80211/ieee80211_crypto_wep.c
--- a/sys/net80211/ieee80211_crypto_wep.c Wed May 06 10:27:40 2020 +1000
+++ b/sys/net80211/ieee80211_crypto_wep.c Fri May 08 07:09:14 2020 +1000
@@ -78,7 +78,7 @@
static int wep_enmic(struct ieee80211_key *, struct mbuf *, int);
static int wep_demic(struct ieee80211_key *, struct mbuf *, int);
-static const struct ieee80211_cipher wep = {
+const struct ieee80211_cipher wep = {
.ic_name = "WEP",
.ic_cipher = IEEE80211_CIPHER_WEP,
.ic_header = IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN,
Home |
Main Index |
Thread Index |
Old Index