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
This commit is contained in:
Adrian Chadd 2024-04-17 18:47:07 -07:00
parent 491938d743
commit e9961ea164
4 changed files with 51 additions and 0 deletions

View file

@ -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)
{

View file

@ -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.
*/

View file

@ -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 *,

View file

@ -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,