git: e9961ea16496 - main - net80211: add driver / crypto methods to set the hardware / software cipher suites
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 09 May 2024 00:49:43 UTC
The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=e9961ea164968bf2bdab210eab69201b4bf2cb37 commit e9961ea164968bf2bdab210eab69201b4bf2cb37 Author: Adrian Chadd <adrian@FreeBSD.org> AuthorDate: 2024-04-18 01:47:07 +0000 Commit: Adrian Chadd <adrian@FreeBSD.org> CommitDate: 2024-05-09 00:49:12 +0000 net80211: add driver / crypto methods to set the hardware / software cipher suites Drivers currently announce hardware crypto cipher support by setting up ic_cryptocaps. This adds two public function calls: * ieee80211_set_software_ciphers() - set the software cipher set; * ieee80211_set_hardware_ciphers() - set the hardware cipher set. For now these just call into the newly crypto routines to set the ciphers. This then adds the two crypto routines, similarly named, to set the hardware/software cipher suite. This is a no-op right now - wep/tkip/ccmp are already set by default so drivers aren't required to call these routines for software encryption, and drivers already set ic_cryptocaps for hardware encryption. Differential Revision: https://reviews.freebsd.org/D44827 --- sys/net80211/ieee80211.c | 22 ++++++++++++++++++++++ sys/net80211/ieee80211_crypto.c | 21 +++++++++++++++++++++ sys/net80211/ieee80211_crypto.h | 4 ++++ sys/net80211/ieee80211_var.h | 4 ++++ 4 files changed, 51 insertions(+) diff --git a/sys/net80211/ieee80211.c b/sys/net80211/ieee80211.c index 15785a8f0966..1c82493274bb 100644 --- a/sys/net80211/ieee80211.c +++ b/sys/net80211/ieee80211.c @@ -434,6 +434,28 @@ ieee80211_ifdetach(struct ieee80211com *ic) IEEE80211_LOCK_DESTROY(ic); } +/* + * Called by drivers during attach to set the supported + * cipher set for software encryption. + */ +void +ieee80211_set_software_ciphers(struct ieee80211com *ic, + uint32_t cipher_suite) +{ + ieee80211_crypto_set_supported_software_ciphers(ic, cipher_suite); +} + +/* + * Called by drivers during attach to set the supported + * cipher set for hardware encryption. + */ +void +ieee80211_set_hardware_ciphers(struct ieee80211com *ic, + uint32_t cipher_suite) +{ + ieee80211_crypto_set_supported_hardware_ciphers(ic, cipher_suite); +} + struct ieee80211com * ieee80211_find_com(const char *name) { diff --git a/sys/net80211/ieee80211_crypto.c b/sys/net80211/ieee80211_crypto.c index ff78600e2f0e..e849fe06db65 100644 --- a/sys/net80211/ieee80211_crypto.c +++ b/sys/net80211/ieee80211_crypto.c @@ -164,6 +164,27 @@ ieee80211_crypto_detach(struct ieee80211com *ic) { } +/* + * Set the supported ciphers for software encryption. + */ +void +ieee80211_crypto_set_supported_software_ciphers(struct ieee80211com *ic, + uint32_t cipher_set) +{ + ic->ic_sw_cryptocaps = cipher_set; +} + +/* + * Set the supported ciphers for hardware encryption. + */ +void +ieee80211_crypto_set_supported_hardware_ciphers(struct ieee80211com *ic, + uint32_t cipher_set) +{ + ic->ic_cryptocaps = cipher_set; +} + + /* * Setup crypto support for a vap. */ diff --git a/sys/net80211/ieee80211_crypto.h b/sys/net80211/ieee80211_crypto.h index fc7c13cfdfb4..9637278701ff 100644 --- a/sys/net80211/ieee80211_crypto.h +++ b/sys/net80211/ieee80211_crypto.h @@ -162,6 +162,10 @@ MALLOC_DECLARE(M_80211_CRYPTO); void ieee80211_crypto_attach(struct ieee80211com *); void ieee80211_crypto_detach(struct ieee80211com *); +void ieee80211_crypto_set_supported_software_ciphers(struct ieee80211com *, + uint32_t cipher_set); +void ieee80211_crypto_set_supported_hardware_ciphers(struct ieee80211com *, + uint32_t cipher_set); void ieee80211_crypto_vattach(struct ieee80211vap *); void ieee80211_crypto_vdetach(struct ieee80211vap *); int ieee80211_crypto_newkey(struct ieee80211vap *, diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 2c13113b92a1..21fdff0b88a3 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -751,6 +751,10 @@ MALLOC_DECLARE(M_80211_VAP); int ic_printf(struct ieee80211com *, const char *, ...) __printflike(2, 3); void ieee80211_ifattach(struct ieee80211com *); void ieee80211_ifdetach(struct ieee80211com *); +void ieee80211_set_software_ciphers(struct ieee80211com *, + uint32_t cipher_suite); +void ieee80211_set_hardware_ciphers(struct ieee80211com *, + uint32_t cipher_suite); int ieee80211_vap_setup(struct ieee80211com *, struct ieee80211vap *, const char name[IFNAMSIZ], int unit, enum ieee80211_opmode opmode, int flags,