Merge set_key and hapd_set_key driver_ops into a single function

This commit is contained in:
Jouni Malinen 2009-11-23 16:58:32 +02:00 committed by Jouni Malinen
parent fd7a5dd15f
commit 642187d6bf
19 changed files with 81 additions and 117 deletions

View file

@ -87,11 +87,11 @@ hostapd_set_key(const char *ifname, struct hostapd_data *hapd,
int set_tx, const u8 *seq, size_t seq_len, int set_tx, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)
{ {
if (hapd->driver == NULL || hapd->driver->hapd_set_key == NULL) if (hapd->driver == NULL || hapd->driver->set_key == NULL)
return 0; return 0;
return hapd->driver->hapd_set_key(ifname, hapd->drv_priv, alg, addr, return hapd->driver->set_key(ifname, hapd->drv_priv, alg, addr,
key_idx, set_tx, seq, seq_len, key, key_idx, set_tx, seq, seq_len, key,
key_len); key_len);
} }
static inline int static inline int

View file

@ -15,7 +15,7 @@
#ifndef DRIVER_H #ifndef DRIVER_H
#define DRIVER_H #define DRIVER_H
#define WPA_SUPPLICANT_DRIVER_VERSION 3 #define WPA_SUPPLICANT_DRIVER_VERSION 4
#include "defs.h" #include "defs.h"
@ -593,6 +593,7 @@ struct wpa_driver_ops {
/** /**
* set_key - Configure encryption key * set_key - Configure encryption key
* @ifname: Interface name (for multi-SSID/VLAN support)
* @priv: private driver interface data * @priv: private driver interface data
* @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP, * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
* %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK); * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
@ -634,8 +635,9 @@ struct wpa_driver_ops {
* in driver_*.c set_key() implementation, see driver_ndis.c for an * in driver_*.c set_key() implementation, see driver_ndis.c for an
* example on how this can be done. * example on how this can be done.
*/ */
int (*set_key)(void *priv, wpa_alg alg, const u8 *addr, int (*set_key)(const char *ifname, void *priv, wpa_alg alg,
int key_idx, int set_tx, const u8 *seq, size_t seq_len, const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len); const u8 *key, size_t key_len);
/** /**
@ -1246,10 +1248,6 @@ struct wpa_driver_ops {
*/ */
int (*set_privacy)(const char *ifname, void *priv, int enabled); int (*set_privacy)(const char *ifname, void *priv, int enabled);
int (*hapd_set_key)(const char *ifname, void *priv, wpa_alg alg,
const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len);
int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr, int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
int idx, u8 *seq); int idx, u8 *seq);
int (*get_seqnum_igtk)(const char *ifname, void *priv, const u8 *addr, int (*get_seqnum_igtk)(const char *ifname, void *priv, const u8 *addr,

View file

@ -1315,7 +1315,7 @@ const struct wpa_driver_ops wpa_driver_atheros_ops = {
.deinit = madwifi_deinit, .deinit = madwifi_deinit,
.set_ieee8021x = madwifi_set_ieee8021x, .set_ieee8021x = madwifi_set_ieee8021x,
.set_privacy = madwifi_set_privacy, .set_privacy = madwifi_set_privacy,
.hapd_set_key = madwifi_set_key, .set_key = madwifi_set_key,
.get_seqnum = madwifi_get_seqnum, .get_seqnum = madwifi_get_seqnum,
.flush = madwifi_flush, .flush = madwifi_flush,
.set_generic_elem = madwifi_set_opt_ie, .set_generic_elem = madwifi_set_opt_ie,

View file

@ -188,8 +188,8 @@ static int wpa_driver_atmel_set_wpa(void *priv, int enabled)
} }
static int wpa_driver_atmel_set_key(void *priv, wpa_alg alg, static int wpa_driver_atmel_set_key(const char *ifname, void *priv,
const u8 *addr, int key_idx, wpa_alg alg, const u8 *addr, int key_idx,
int set_tx, const u8 *seq, size_t seq_len, int set_tx, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)
{ {

View file

@ -162,7 +162,8 @@ static int wpa_driver_broadcom_set_wpa(void *priv, int enable)
return 0; return 0;
} }
static int wpa_driver_broadcom_set_key(void *priv, wpa_alg alg, static int wpa_driver_broadcom_set_key(const char *ifname, void *priv,
wpa_alg alg,
const u8 *addr, int key_idx, int set_tx, const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)

View file

@ -828,7 +828,7 @@ const struct wpa_driver_ops wpa_driver_bsd_ops = {
.hapd_deinit = bsd_deinit, .hapd_deinit = bsd_deinit,
.set_ieee8021x = bsd_set_ieee8021x, .set_ieee8021x = bsd_set_ieee8021x,
.set_privacy = bsd_set_privacy, .set_privacy = bsd_set_privacy,
.hapd_set_key = bsd_set_key, .set_key = bsd_set_key,
.get_seqnum = bsd_get_seqnum, .get_seqnum = bsd_get_seqnum,
.flush = bsd_flush, .flush = bsd_flush,
.set_generic_elem = bsd_set_opt_ie, .set_generic_elem = bsd_set_opt_ie,
@ -1023,7 +1023,7 @@ wpa_driver_bsd_del_key(struct wpa_driver_bsd_data *drv, int key_idx,
} }
static int static int
wpa_driver_bsd_set_key(void *priv, wpa_alg alg, wpa_driver_bsd_set_key(const char *ifname, void *priv, wpa_alg alg,
const unsigned char *addr, int key_idx, int set_tx, const unsigned char *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)

View file

@ -431,10 +431,10 @@ static int hostapd_ioctl(void *priv, struct prism2_hostapd_param *param,
} }
static int hostap_set_key(const char *ifname, void *priv, wpa_alg alg, static int wpa_driver_hostap_set_key(const char *ifname, void *priv,
const u8 *addr, int key_idx, int set_tx, wpa_alg alg, const u8 *addr, int key_idx,
const u8 *seq, size_t seq_len, const u8 *key, int set_tx, const u8 *seq, size_t seq_len,
size_t key_len) const u8 *key, size_t key_len)
{ {
struct hostap_driver_data *drv = priv; struct hostap_driver_data *drv = priv;
struct prism2_hostapd_param *param; struct prism2_hostapd_param *param;
@ -1350,8 +1350,8 @@ static void show_set_key_error(struct prism2_hostapd_param *param)
} }
static int wpa_driver_hostap_set_key(void *priv, wpa_alg alg, static int wpa_driver_hostap_set_key(const char *ifname, void *priv,
const u8 *addr, int key_idx, wpa_alg alg, const u8 *addr, int key_idx,
int set_tx, const u8 *seq, size_t seq_len, int set_tx, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)
{ {
@ -1700,12 +1700,12 @@ static void wpa_driver_hostap_deinit(void *priv)
const struct wpa_driver_ops wpa_driver_hostap_ops = { const struct wpa_driver_ops wpa_driver_hostap_ops = {
.name = "hostap", .name = "hostap",
.desc = "Host AP driver (Intersil Prism2/2.5/3)", .desc = "Host AP driver (Intersil Prism2/2.5/3)",
.set_key = wpa_driver_hostap_set_key,
#ifdef HOSTAPD #ifdef HOSTAPD
.hapd_init = hostap_init, .hapd_init = hostap_init,
.hapd_deinit = hostap_driver_deinit, .hapd_deinit = hostap_driver_deinit,
.set_ieee8021x = hostap_set_ieee8021x, .set_ieee8021x = hostap_set_ieee8021x,
.set_privacy = hostap_set_privacy, .set_privacy = hostap_set_privacy,
.hapd_set_key = hostap_set_key,
.get_seqnum = hostap_get_seqnum, .get_seqnum = hostap_get_seqnum,
.flush = hostap_flush, .flush = hostap_flush,
.set_generic_elem = hostap_set_generic_elem, .set_generic_elem = hostap_set_generic_elem,
@ -1727,7 +1727,6 @@ const struct wpa_driver_ops wpa_driver_hostap_ops = {
.get_bssid = wpa_driver_hostap_get_bssid, .get_bssid = wpa_driver_hostap_get_bssid,
.get_ssid = wpa_driver_hostap_get_ssid, .get_ssid = wpa_driver_hostap_get_ssid,
.set_wpa = wpa_driver_hostap_set_wpa, .set_wpa = wpa_driver_hostap_set_wpa,
.set_key = wpa_driver_hostap_set_key,
.set_countermeasures = wpa_driver_hostap_set_countermeasures, .set_countermeasures = wpa_driver_hostap_set_countermeasures,
.set_drop_unencrypted = wpa_driver_hostap_set_drop_unencrypted, .set_drop_unencrypted = wpa_driver_hostap_set_drop_unencrypted,
.scan = wpa_driver_hostap_scan, .scan = wpa_driver_hostap_scan,

View file

@ -213,10 +213,10 @@ static int wpa_driver_ipw_set_wpa(void *priv, int enabled)
} }
static int wpa_driver_ipw_set_key(void *priv, wpa_alg alg, static int wpa_driver_ipw_set_key(const char *ifname, void *priv, wpa_alg alg,
const u8 *addr, int key_idx, int set_tx, const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)
{ {
struct wpa_driver_ipw_data *drv = priv; struct wpa_driver_ipw_data *drv = priv;
struct ipw_param *param; struct ipw_param *param;

View file

@ -455,9 +455,10 @@ madwifi_del_key(void *priv, const u8 *addr, int key_idx)
} }
static int static int
madwifi_set_key(const char *ifname, void *priv, wpa_alg alg, wpa_driver_madwifi_set_key(const char *ifname, void *priv, wpa_alg alg,
const u8 *addr, int key_idx, int set_tx, const u8 *seq, const u8 *addr, int key_idx, int set_tx,
size_t seq_len, const u8 *key, size_t key_len) const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len)
{ {
struct madwifi_driver_data *drv = priv; struct madwifi_driver_data *drv = priv;
struct ieee80211req_key wk; struct ieee80211req_key wk;
@ -1530,7 +1531,7 @@ wpa_driver_madwifi_del_key(struct wpa_driver_madwifi_data *drv, int key_idx,
} }
static int static int
wpa_driver_madwifi_set_key(void *priv, wpa_alg alg, wpa_driver_madwifi_set_key(const char *ifname, void *priv, wpa_alg alg,
const u8 *addr, int key_idx, int set_tx, const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)
@ -1552,8 +1553,8 @@ wpa_driver_madwifi_set_key(void *priv, wpa_alg alg,
* configuration with IEEE80211_IOCTL_SETKEY, so use * configuration with IEEE80211_IOCTL_SETKEY, so use
* Linux wireless extensions ioctl for this. * Linux wireless extensions ioctl for this.
*/ */
return wpa_driver_wext_set_key(drv->wext, alg, addr, return wpa_driver_wext_set_key(ifname, drv->wext, alg,
key_idx, set_tx, addr, key_idx, set_tx,
seq, seq_len, seq, seq_len,
key, key_len); key, key_len);
} }
@ -1910,12 +1911,12 @@ static void wpa_driver_madwifi_deinit(void *priv)
const struct wpa_driver_ops wpa_driver_madwifi_ops = { const struct wpa_driver_ops wpa_driver_madwifi_ops = {
.name = "madwifi", .name = "madwifi",
.desc = "MADWIFI 802.11 support (Atheros, etc.)", .desc = "MADWIFI 802.11 support (Atheros, etc.)",
.set_key = wpa_driver_madwifi_set_key,
#ifdef HOSTAPD #ifdef HOSTAPD
.hapd_init = madwifi_init, .hapd_init = madwifi_init,
.hapd_deinit = madwifi_deinit, .hapd_deinit = madwifi_deinit,
.set_ieee8021x = madwifi_set_ieee8021x, .set_ieee8021x = madwifi_set_ieee8021x,
.set_privacy = madwifi_set_privacy, .set_privacy = madwifi_set_privacy,
.hapd_set_key = madwifi_set_key,
.get_seqnum = madwifi_get_seqnum, .get_seqnum = madwifi_get_seqnum,
.flush = madwifi_flush, .flush = madwifi_flush,
.set_generic_elem = madwifi_set_opt_ie, .set_generic_elem = madwifi_set_opt_ie,
@ -1934,7 +1935,6 @@ const struct wpa_driver_ops wpa_driver_madwifi_ops = {
#else /* HOSTAPD */ #else /* HOSTAPD */
.get_bssid = wpa_driver_madwifi_get_bssid, .get_bssid = wpa_driver_madwifi_get_bssid,
.get_ssid = wpa_driver_madwifi_get_ssid, .get_ssid = wpa_driver_madwifi_get_ssid,
.set_key = wpa_driver_madwifi_set_key,
.init = wpa_driver_madwifi_init, .init = wpa_driver_madwifi_init,
.deinit = wpa_driver_madwifi_deinit, .deinit = wpa_driver_madwifi_deinit,
.set_countermeasures = wpa_driver_madwifi_set_countermeasures, .set_countermeasures = wpa_driver_madwifi_set_countermeasures,

View file

@ -975,8 +975,8 @@ static int wpa_driver_ndis_add_wep(struct wpa_driver_ndis_data *drv,
} }
static int wpa_driver_ndis_set_key(void *priv, wpa_alg alg, const u8 *addr, static int wpa_driver_ndis_set_key(const char *ifname, void *priv, wpa_alg alg,
int key_idx, int set_tx, const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)
{ {
@ -1083,7 +1083,8 @@ wpa_driver_ndis_associate(void *priv,
continue; continue;
wpa_printf(MSG_DEBUG, "NDIS: Re-setting static WEP " wpa_printf(MSG_DEBUG, "NDIS: Re-setting static WEP "
"key %d", i); "key %d", i);
wpa_driver_ndis_set_key(drv, WPA_ALG_WEP, bcast, i, wpa_driver_ndis_set_key(drv->ifname, drv, WPA_ALG_WEP,
bcast, i,
i == params->wep_tx_keyidx, i == params->wep_tx_keyidx,
NULL, 0, params->wep_key[i], NULL, 0, params->wep_key[i],
params->wep_key_len[i]); params->wep_key_len[i]);
@ -3221,7 +3222,6 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = {
NULL /* hapd_deinit */, NULL /* hapd_deinit */,
NULL /* set_ieee8021x */, NULL /* set_ieee8021x */,
NULL /* set_privacy */, NULL /* set_privacy */,
NULL /* hapd_set_key */,
NULL /* get_seqnum */, NULL /* get_seqnum */,
NULL /* get_seqnum_igtk */, NULL /* get_seqnum_igtk */,
NULL /* flush */, NULL /* flush */,

View file

@ -107,8 +107,8 @@ static int wpa_ndiswrapper_set_wpa(void *priv, int enabled)
return ret; return ret;
} }
static int wpa_ndiswrapper_set_key(void *priv, wpa_alg alg, const u8 *addr, static int wpa_ndiswrapper_set_key(const char *ifname, void *priv, wpa_alg alg,
int key_idx, int set_tx, const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)
{ {
@ -142,8 +142,8 @@ static int wpa_ndiswrapper_set_key(void *priv, wpa_alg alg, const u8 *addr,
* did not associate. Try to make sure the keys are cleared so * did not associate. Try to make sure the keys are cleared so
* that plaintext APs can be used in all cases. * that plaintext APs can be used in all cases.
*/ */
wpa_driver_wext_set_key(drv->wext, alg, addr, key_idx, set_tx, wpa_driver_wext_set_key(ifname, drv->wext, alg, addr, key_idx,
seq, seq_len, key, key_len); set_tx, seq, seq_len, key, key_len);
} }
return ret; return ret;

View file

@ -1726,11 +1726,14 @@ nla_put_failure:
} }
static int nl_set_encr(int ifindex, struct wpa_driver_nl80211_data *drv, static int wpa_driver_nl80211_set_key(const char *ifname, void *priv,
wpa_alg alg, const u8 *addr, int key_idx, int set_tx, wpa_alg alg, const u8 *addr, int key_idx,
const u8 *seq, size_t seq_len, int set_tx,
const u8 *key, size_t key_len) const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len)
{ {
struct wpa_driver_nl80211_data *drv = priv;
int ifindex = if_nametoindex(ifname);
struct nl_msg *msg; struct nl_msg *msg;
int ret; int ret;
@ -1942,18 +1945,6 @@ nla_put_failure:
} }
static int wpa_driver_nl80211_set_key(void *priv, wpa_alg alg,
const u8 *addr, int key_idx,
int set_tx, const u8 *seq,
size_t seq_len,
const u8 *key, size_t key_len)
{
struct wpa_driver_nl80211_data *drv = priv;
return nl_set_encr(drv->ifindex, drv, alg, addr, key_idx, set_tx, seq,
seq_len, key, key_len);
}
static int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv, static int wpa_driver_nl80211_mlme(struct wpa_driver_nl80211_data *drv,
const u8 *addr, int cmd, u16 reason_code) const u8 *addr, int cmd, u16 reason_code)
{ {
@ -2046,7 +2037,8 @@ retry:
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (!params->wep_key[i]) if (!params->wep_key[i])
continue; continue;
wpa_driver_nl80211_set_key(drv, WPA_ALG_WEP, NULL, i, wpa_driver_nl80211_set_key(drv->ifname, drv, WPA_ALG_WEP, NULL,
i,
i == params->wep_tx_keyidx, NULL, 0, i == params->wep_tx_keyidx, NULL, 0,
params->wep_key[i], params->wep_key[i],
params->wep_key_len[i]); params->wep_key_len[i]);
@ -3746,16 +3738,6 @@ static int have_ifidx(struct wpa_driver_nl80211_data *drv, int ifidx)
} }
static int i802_set_key(const char *iface, void *priv, wpa_alg alg,
const u8 *addr, int key_idx, int set_tx, const u8 *seq,
size_t seq_len, const u8 *key, size_t key_len)
{
struct wpa_driver_nl80211_data *drv = priv;
return nl_set_encr(if_nametoindex(iface), drv, alg, addr, key_idx,
set_tx, seq, seq_len, key, key_len);
}
static inline int min_int(int a, int b) static inline int min_int(int a, int b)
{ {
if (a < b) if (a < b)
@ -4404,7 +4386,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
#ifdef HOSTAPD #ifdef HOSTAPD
.hapd_init = i802_init, .hapd_init = i802_init,
.hapd_deinit = i802_deinit, .hapd_deinit = i802_deinit,
.hapd_set_key = i802_set_key,
.get_seqnum = i802_get_seqnum, .get_seqnum = i802_get_seqnum,
.flush = i802_flush, .flush = i802_flush,
.read_sta_data = i802_read_sta_data, .read_sta_data = i802_read_sta_data,

View file

@ -199,10 +199,11 @@ prism54_sta_set_flags(void *priv, const u8 *addr, int total_flags,
} }
static int prism54_set_key(const char *ifname, void *priv, wpa_alg alg, static int wpa_driver_prism54_set_key(const char *ifname, void *priv,
const u8 *addr, int key_idx, int set_tx, wpa_alg alg, const u8 *addr, int key_idx,
const u8 *seq, size_t seq_len, int set_tx,
const u8 *key, size_t key_len) const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len)
{ {
struct prism54_driver_data *drv = priv; struct prism54_driver_data *drv = priv;
pimdev_hdr *hdr; pimdev_hdr *hdr;
@ -1159,7 +1160,8 @@ static int wpa_driver_prism54_set_wpa(void *priv, int enabled)
} }
static int wpa_driver_prism54_set_key(void *priv, wpa_alg alg, static int wpa_driver_prism54_set_key(const char *ifname, void *priv,
wpa_alg alg,
const u8 *addr, int key_idx, int set_tx, const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)
@ -1419,12 +1421,12 @@ static void wpa_driver_prism54_deinit(void *priv)
const struct wpa_driver_ops wpa_driver_prism54_ops = { const struct wpa_driver_ops wpa_driver_prism54_ops = {
.name = "prism54", .name = "prism54",
.desc = "Prism54.org driver (Intersil Prism GT/Duette/Indigo)", .desc = "Prism54.org driver (Intersil Prism GT/Duette/Indigo)",
.set_key = wpa_driver_prism54_set_key,
#ifdef HOSTAPD #ifdef HOSTAPD
.hapd_init = prism54_driver_init, .hapd_init = prism54_driver_init,
.hapd_deinit = prism54_driver_deinit, .hapd_deinit = prism54_driver_deinit,
/* .set_ieee8021x = prism54_init_1x, */ /* .set_ieee8021x = prism54_init_1x, */
.set_privacy = prism54_set_privacy_invoked, .set_privacy = prism54_set_privacy_invoked,
.hapd_set_key = prism54_set_key,
.get_seqnum = prism54_get_seqnum, .get_seqnum = prism54_get_seqnum,
.flush = prism54_flush, .flush = prism54_flush,
.set_generic_elem = prism54_set_generic_elem, .set_generic_elem = prism54_set_generic_elem,
@ -1438,7 +1440,6 @@ const struct wpa_driver_ops wpa_driver_prism54_ops = {
.get_bssid = wpa_driver_prism54_get_bssid, .get_bssid = wpa_driver_prism54_get_bssid,
.get_ssid = wpa_driver_prism54_get_ssid, .get_ssid = wpa_driver_prism54_get_ssid,
.set_wpa = wpa_driver_prism54_set_wpa, .set_wpa = wpa_driver_prism54_set_wpa,
.set_key = wpa_driver_prism54_set_key,
.set_countermeasures = wpa_driver_prism54_set_countermeasures, .set_countermeasures = wpa_driver_prism54_set_countermeasures,
.set_drop_unencrypted = wpa_driver_prism54_set_drop_unencrypted, .set_drop_unencrypted = wpa_driver_prism54_set_drop_unencrypted,
.scan = wpa_driver_prism54_scan, .scan = wpa_driver_prism54_scan,

View file

@ -196,10 +196,11 @@ wpa_driver_privsep_get_scan_results2(void *priv)
} }
static int wpa_driver_privsep_set_key(void *priv, wpa_alg alg, const u8 *addr, static int wpa_driver_privsep_set_key(const char *ifname, void *priv,
int key_idx, int set_tx, wpa_alg alg, const u8 *addr,
const u8 *seq, size_t seq_len, int key_idx, int set_tx,
const u8 *key, size_t key_len) const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len)
{ {
struct wpa_driver_privsep_data *drv = priv; struct wpa_driver_privsep_data *drv = priv;
struct privsep_cmd_set_key cmd; struct privsep_cmd_set_key cmd;

View file

@ -1241,7 +1241,8 @@ static int wpa_driver_ralink_add_wep(struct wpa_driver_ralink_data *drv,
return res; return res;
} }
static int wpa_driver_ralink_set_key(void *priv, wpa_alg alg, const u8 *addr, static int wpa_driver_ralink_set_key(const char *ifname, void *priv,
wpa_alg alg, const u8 *addr,
int key_idx, int set_tx, int key_idx, int set_tx,
const u8 *seq, size_t seq_len, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)

View file

@ -1124,21 +1124,6 @@ static int test_driver_set_privacy(const char *ifname, void *priv, int enabled)
} }
static int test_driver_set_key(const char *iface, void *priv, wpa_alg alg,
const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len)
{
wpa_printf(MSG_DEBUG, "%s(iface=%s alg=%d idx=%d set_tx=%d)",
__func__, iface, alg, key_idx, set_tx);
if (addr)
wpa_printf(MSG_DEBUG, " addr=" MACSTR, MAC2STR(addr));
if (key)
wpa_hexdump_key(MSG_DEBUG, " key", key, key_len);
return 0;
}
static int test_driver_set_sta_vlan(void *priv, const u8 *addr, static int test_driver_set_sta_vlan(void *priv, const u8 *addr,
const char *ifname, int vlan_id) const char *ifname, int vlan_id)
{ {
@ -1457,22 +1442,20 @@ static struct wpa_scan_results * wpa_driver_test_get_scan_results2(void *priv)
} }
static int wpa_driver_test_set_key(void *priv, wpa_alg alg, const u8 *addr, static int wpa_driver_test_set_key(const char *ifname, void *priv, wpa_alg alg,
int key_idx, int set_tx, const u8 *addr, int key_idx, int set_tx,
const u8 *seq, size_t seq_len, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)
{ {
wpa_printf(MSG_DEBUG, "%s: priv=%p alg=%d key_idx=%d set_tx=%d", wpa_printf(MSG_DEBUG, "%s: ifname=%s priv=%p alg=%d key_idx=%d "
__func__, priv, alg, key_idx, set_tx); "set_tx=%d",
if (addr) { __func__, ifname, priv, alg, key_idx, set_tx);
if (addr)
wpa_printf(MSG_DEBUG, " addr=" MACSTR, MAC2STR(addr)); wpa_printf(MSG_DEBUG, " addr=" MACSTR, MAC2STR(addr));
} if (seq)
if (seq) {
wpa_hexdump(MSG_DEBUG, " seq", seq, seq_len); wpa_hexdump(MSG_DEBUG, " seq", seq, seq_len);
} if (key)
if (key) { wpa_hexdump_key(MSG_DEBUG, " key", key, key_len);
wpa_hexdump(MSG_DEBUG, " key", key, key_len);
}
return 0; return 0;
} }
@ -2527,7 +2510,6 @@ const struct wpa_driver_ops wpa_driver_test_ops = {
.valid_bss_mask = test_driver_valid_bss_mask, .valid_bss_mask = test_driver_valid_bss_mask,
.hapd_set_ssid = test_driver_set_ssid, .hapd_set_ssid = test_driver_set_ssid,
.set_privacy = test_driver_set_privacy, .set_privacy = test_driver_set_privacy,
.hapd_set_key = test_driver_set_key,
.set_sta_vlan = test_driver_set_sta_vlan, .set_sta_vlan = test_driver_set_sta_vlan,
.sta_add = test_driver_sta_add, .sta_add = test_driver_sta_add,
.send_ether = test_driver_send_ether, .send_ether = test_driver_send_ether,

View file

@ -1820,7 +1820,7 @@ static int wpa_driver_wext_set_key_ext(void *priv, wpa_alg alg,
* This function uses SIOCSIWENCODEEXT by default, but tries to use * This function uses SIOCSIWENCODEEXT by default, but tries to use
* SIOCSIWENCODE if the extended ioctl fails when configuring a WEP key. * SIOCSIWENCODE if the extended ioctl fails when configuring a WEP key.
*/ */
int wpa_driver_wext_set_key(void *priv, wpa_alg alg, int wpa_driver_wext_set_key(const char *ifname, void *priv, wpa_alg alg,
const u8 *addr, int key_idx, const u8 *addr, int key_idx,
int set_tx, const u8 *seq, size_t seq_len, int set_tx, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len) const u8 *key, size_t key_len)

View file

@ -53,7 +53,7 @@ int wpa_driver_wext_get_ssid(void *priv, u8 *ssid);
int wpa_driver_wext_set_ssid(void *priv, const u8 *ssid, size_t ssid_len); int wpa_driver_wext_set_ssid(void *priv, const u8 *ssid, size_t ssid_len);
int wpa_driver_wext_set_freq(void *priv, int freq); int wpa_driver_wext_set_freq(void *priv, int freq);
int wpa_driver_wext_set_mode(void *priv, int mode); int wpa_driver_wext_set_mode(void *priv, int mode);
int wpa_driver_wext_set_key(void *priv, wpa_alg alg, int wpa_driver_wext_set_key(const char *ifname, void *priv, wpa_alg alg,
const u8 *addr, int key_idx, const u8 *addr, int key_idx,
int set_tx, const u8 *seq, size_t seq_len, int set_tx, const u8 *seq, size_t seq_len,
const u8 *key, size_t key_len); const u8 *key, size_t key_len);

View file

@ -160,9 +160,9 @@ static inline int wpa_drv_set_key(struct wpa_supplicant *wpa_s, wpa_alg alg,
{ {
if (wpa_s->driver->set_key) { if (wpa_s->driver->set_key) {
wpa_s->keys_cleared = 0; wpa_s->keys_cleared = 0;
return wpa_s->driver->set_key(wpa_s->drv_priv, alg, addr, return wpa_s->driver->set_key(wpa_s->ifname, wpa_s->drv_priv,
key_idx, set_tx, seq, seq_len, alg, addr, key_idx, set_tx,
key, key_len); seq, seq_len, key, key_len);
} }
return -1; return -1;
} }