From 642187d6bffa526e0fa35159a94791a282502df3 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 23 Nov 2009 16:58:32 +0200 Subject: [PATCH] Merge set_key and hapd_set_key driver_ops into a single function --- hostapd/driver_i.h | 8 +++---- src/drivers/driver.h | 12 +++++------ src/drivers/driver_atheros.c | 2 +- src/drivers/driver_atmel.c | 4 ++-- src/drivers/driver_broadcom.c | 3 ++- src/drivers/driver_bsd.c | 4 ++-- src/drivers/driver_hostap.c | 15 ++++++------- src/drivers/driver_ipw.c | 8 +++---- src/drivers/driver_madwifi.c | 16 +++++++------- src/drivers/driver_ndis.c | 8 +++---- src/drivers/driver_ndiswrapper.c | 8 +++---- src/drivers/driver_nl80211.c | 37 ++++++++------------------------ src/drivers/driver_prism54.c | 15 +++++++------ src/drivers/driver_privsep.c | 9 ++++---- src/drivers/driver_ralink.c | 3 ++- src/drivers/driver_test.c | 36 ++++++++----------------------- src/drivers/driver_wext.c | 2 +- src/drivers/driver_wext.h | 2 +- wpa_supplicant/driver_i.h | 6 +++--- 19 files changed, 81 insertions(+), 117 deletions(-) diff --git a/hostapd/driver_i.h b/hostapd/driver_i.h index 9dc77fd17..22f0d3276 100644 --- a/hostapd/driver_i.h +++ b/hostapd/driver_i.h @@ -87,11 +87,11 @@ hostapd_set_key(const char *ifname, struct hostapd_data *hapd, int set_tx, const u8 *seq, size_t seq_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 hapd->driver->hapd_set_key(ifname, hapd->drv_priv, alg, addr, - key_idx, set_tx, seq, seq_len, key, - key_len); + return hapd->driver->set_key(ifname, hapd->drv_priv, alg, addr, + key_idx, set_tx, seq, seq_len, key, + key_len); } static inline int diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 426c848fe..03fea103c 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -15,7 +15,7 @@ #ifndef DRIVER_H #define DRIVER_H -#define WPA_SUPPLICANT_DRIVER_VERSION 3 +#define WPA_SUPPLICANT_DRIVER_VERSION 4 #include "defs.h" @@ -593,6 +593,7 @@ struct wpa_driver_ops { /** * set_key - Configure encryption key + * @ifname: Interface name (for multi-SSID/VLAN support) * @priv: private driver interface data * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP, * %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 * example on how this can be done. */ - int (*set_key)(void *priv, wpa_alg alg, const u8 *addr, - int key_idx, int set_tx, const u8 *seq, size_t seq_len, + int (*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); /** @@ -1246,10 +1248,6 @@ struct wpa_driver_ops { */ 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 idx, u8 *seq); int (*get_seqnum_igtk)(const char *ifname, void *priv, const u8 *addr, diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c index 912213675..de1b048d2 100644 --- a/src/drivers/driver_atheros.c +++ b/src/drivers/driver_atheros.c @@ -1315,7 +1315,7 @@ const struct wpa_driver_ops wpa_driver_atheros_ops = { .deinit = madwifi_deinit, .set_ieee8021x = madwifi_set_ieee8021x, .set_privacy = madwifi_set_privacy, - .hapd_set_key = madwifi_set_key, + .set_key = madwifi_set_key, .get_seqnum = madwifi_get_seqnum, .flush = madwifi_flush, .set_generic_elem = madwifi_set_opt_ie, diff --git a/src/drivers/driver_atmel.c b/src/drivers/driver_atmel.c index 0a7a66ddb..588bfec51 100644 --- a/src/drivers/driver_atmel.c +++ b/src/drivers/driver_atmel.c @@ -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, - const u8 *addr, int key_idx, +static int wpa_driver_atmel_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) { diff --git a/src/drivers/driver_broadcom.c b/src/drivers/driver_broadcom.c index 1044cd7d9..c7c427040 100644 --- a/src/drivers/driver_broadcom.c +++ b/src/drivers/driver_broadcom.c @@ -162,7 +162,8 @@ static int wpa_driver_broadcom_set_wpa(void *priv, int enable) 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 *seq, size_t seq_len, const u8 *key, size_t key_len) diff --git a/src/drivers/driver_bsd.c b/src/drivers/driver_bsd.c index e292c3dc3..856cfb7dd 100644 --- a/src/drivers/driver_bsd.c +++ b/src/drivers/driver_bsd.c @@ -828,7 +828,7 @@ const struct wpa_driver_ops wpa_driver_bsd_ops = { .hapd_deinit = bsd_deinit, .set_ieee8021x = bsd_set_ieee8021x, .set_privacy = bsd_set_privacy, - .hapd_set_key = bsd_set_key, + .set_key = bsd_set_key, .get_seqnum = bsd_get_seqnum, .flush = bsd_flush, .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 -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 u8 *seq, size_t seq_len, const u8 *key, size_t key_len) diff --git a/src/drivers/driver_hostap.c b/src/drivers/driver_hostap.c index ee57ee687..905560423 100644 --- a/src/drivers/driver_hostap.c +++ b/src/drivers/driver_hostap.c @@ -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, - const u8 *addr, int key_idx, int set_tx, - const u8 *seq, size_t seq_len, const u8 *key, - size_t key_len) +static int wpa_driver_hostap_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) { struct hostap_driver_data *drv = priv; 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, - const u8 *addr, int key_idx, +static int wpa_driver_hostap_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) { @@ -1700,12 +1700,12 @@ static void wpa_driver_hostap_deinit(void *priv) const struct wpa_driver_ops wpa_driver_hostap_ops = { .name = "hostap", .desc = "Host AP driver (Intersil Prism2/2.5/3)", + .set_key = wpa_driver_hostap_set_key, #ifdef HOSTAPD .hapd_init = hostap_init, .hapd_deinit = hostap_driver_deinit, .set_ieee8021x = hostap_set_ieee8021x, .set_privacy = hostap_set_privacy, - .hapd_set_key = hostap_set_key, .get_seqnum = hostap_get_seqnum, .flush = hostap_flush, .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_ssid = wpa_driver_hostap_get_ssid, .set_wpa = wpa_driver_hostap_set_wpa, - .set_key = wpa_driver_hostap_set_key, .set_countermeasures = wpa_driver_hostap_set_countermeasures, .set_drop_unencrypted = wpa_driver_hostap_set_drop_unencrypted, .scan = wpa_driver_hostap_scan, diff --git a/src/drivers/driver_ipw.c b/src/drivers/driver_ipw.c index 3c19cccf4..68f355d91 100644 --- a/src/drivers/driver_ipw.c +++ b/src/drivers/driver_ipw.c @@ -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, - const u8 *addr, int key_idx, int set_tx, - const u8 *seq, size_t seq_len, - const u8 *key, size_t key_len) +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 *seq, size_t seq_len, + const u8 *key, size_t key_len) { struct wpa_driver_ipw_data *drv = priv; struct ipw_param *param; diff --git a/src/drivers/driver_madwifi.c b/src/drivers/driver_madwifi.c index dfb33c97b..e14246f43 100644 --- a/src/drivers/driver_madwifi.c +++ b/src/drivers/driver_madwifi.c @@ -455,9 +455,10 @@ madwifi_del_key(void *priv, const u8 *addr, int key_idx) } static int -madwifi_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) +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, size_t seq_len, + const u8 *key, size_t key_len) { struct madwifi_driver_data *drv = priv; struct ieee80211req_key wk; @@ -1530,7 +1531,7 @@ wpa_driver_madwifi_del_key(struct wpa_driver_madwifi_data *drv, int key_idx, } 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 *seq, size_t seq_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 * Linux wireless extensions ioctl for this. */ - return wpa_driver_wext_set_key(drv->wext, alg, addr, - key_idx, set_tx, + return wpa_driver_wext_set_key(ifname, drv->wext, alg, + addr, key_idx, set_tx, seq, seq_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 = { .name = "madwifi", .desc = "MADWIFI 802.11 support (Atheros, etc.)", + .set_key = wpa_driver_madwifi_set_key, #ifdef HOSTAPD .hapd_init = madwifi_init, .hapd_deinit = madwifi_deinit, .set_ieee8021x = madwifi_set_ieee8021x, .set_privacy = madwifi_set_privacy, - .hapd_set_key = madwifi_set_key, .get_seqnum = madwifi_get_seqnum, .flush = madwifi_flush, .set_generic_elem = madwifi_set_opt_ie, @@ -1934,7 +1935,6 @@ const struct wpa_driver_ops wpa_driver_madwifi_ops = { #else /* HOSTAPD */ .get_bssid = wpa_driver_madwifi_get_bssid, .get_ssid = wpa_driver_madwifi_get_ssid, - .set_key = wpa_driver_madwifi_set_key, .init = wpa_driver_madwifi_init, .deinit = wpa_driver_madwifi_deinit, .set_countermeasures = wpa_driver_madwifi_set_countermeasures, diff --git a/src/drivers/driver_ndis.c b/src/drivers/driver_ndis.c index 65c369eb3..6ceb32215 100644 --- a/src/drivers/driver_ndis.c +++ b/src/drivers/driver_ndis.c @@ -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, - int key_idx, int set_tx, +static int wpa_driver_ndis_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) { @@ -1083,7 +1083,8 @@ wpa_driver_ndis_associate(void *priv, continue; wpa_printf(MSG_DEBUG, "NDIS: Re-setting static WEP " "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, NULL, 0, params->wep_key[i], params->wep_key_len[i]); @@ -3221,7 +3222,6 @@ const struct wpa_driver_ops wpa_driver_ndis_ops = { NULL /* hapd_deinit */, NULL /* set_ieee8021x */, NULL /* set_privacy */, - NULL /* hapd_set_key */, NULL /* get_seqnum */, NULL /* get_seqnum_igtk */, NULL /* flush */, diff --git a/src/drivers/driver_ndiswrapper.c b/src/drivers/driver_ndiswrapper.c index d8bd72e70..41ed4d06e 100644 --- a/src/drivers/driver_ndiswrapper.c +++ b/src/drivers/driver_ndiswrapper.c @@ -107,8 +107,8 @@ static int wpa_ndiswrapper_set_wpa(void *priv, int enabled) return ret; } -static int wpa_ndiswrapper_set_key(void *priv, wpa_alg alg, const u8 *addr, - int key_idx, int set_tx, +static int wpa_ndiswrapper_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) { @@ -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 * that plaintext APs can be used in all cases. */ - wpa_driver_wext_set_key(drv->wext, alg, addr, key_idx, set_tx, - seq, seq_len, key, key_len); + wpa_driver_wext_set_key(ifname, drv->wext, alg, addr, key_idx, + set_tx, seq, seq_len, key, key_len); } return ret; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 37f2a4395..db653f04a 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -1726,11 +1726,14 @@ nla_put_failure: } -static int nl_set_encr(int ifindex, struct wpa_driver_nl80211_data *drv, - 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) +static int wpa_driver_nl80211_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) { + struct wpa_driver_nl80211_data *drv = priv; + int ifindex = if_nametoindex(ifname); struct nl_msg *msg; 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, const u8 *addr, int cmd, u16 reason_code) { @@ -2046,7 +2037,8 @@ retry: for (i = 0; i < 4; i++) { if (!params->wep_key[i]) 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, params->wep_key[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) { if (a < b) @@ -4404,7 +4386,6 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = { #ifdef HOSTAPD .hapd_init = i802_init, .hapd_deinit = i802_deinit, - .hapd_set_key = i802_set_key, .get_seqnum = i802_get_seqnum, .flush = i802_flush, .read_sta_data = i802_read_sta_data, diff --git a/src/drivers/driver_prism54.c b/src/drivers/driver_prism54.c index c43aeccd7..2e0d7cda4 100644 --- a/src/drivers/driver_prism54.c +++ b/src/drivers/driver_prism54.c @@ -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, - const u8 *addr, int key_idx, int set_tx, - const u8 *seq, size_t seq_len, - const u8 *key, size_t key_len) +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 *seq, size_t seq_len, + const u8 *key, size_t key_len) { struct prism54_driver_data *drv = priv; 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 *seq, size_t seq_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 = { .name = "prism54", .desc = "Prism54.org driver (Intersil Prism GT/Duette/Indigo)", + .set_key = wpa_driver_prism54_set_key, #ifdef HOSTAPD .hapd_init = prism54_driver_init, .hapd_deinit = prism54_driver_deinit, /* .set_ieee8021x = prism54_init_1x, */ .set_privacy = prism54_set_privacy_invoked, - .hapd_set_key = prism54_set_key, .get_seqnum = prism54_get_seqnum, .flush = prism54_flush, .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_ssid = wpa_driver_prism54_get_ssid, .set_wpa = wpa_driver_prism54_set_wpa, - .set_key = wpa_driver_prism54_set_key, .set_countermeasures = wpa_driver_prism54_set_countermeasures, .set_drop_unencrypted = wpa_driver_prism54_set_drop_unencrypted, .scan = wpa_driver_prism54_scan, diff --git a/src/drivers/driver_privsep.c b/src/drivers/driver_privsep.c index ef9b5bd0a..0492369c2 100644 --- a/src/drivers/driver_privsep.c +++ b/src/drivers/driver_privsep.c @@ -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, - int key_idx, int set_tx, - const u8 *seq, size_t seq_len, - const u8 *key, size_t key_len) +static int wpa_driver_privsep_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) { struct wpa_driver_privsep_data *drv = priv; struct privsep_cmd_set_key cmd; diff --git a/src/drivers/driver_ralink.c b/src/drivers/driver_ralink.c index e9313cb33..6b6e6eeab 100644 --- a/src/drivers/driver_ralink.c +++ b/src/drivers/driver_ralink.c @@ -1241,7 +1241,8 @@ static int wpa_driver_ralink_add_wep(struct wpa_driver_ralink_data *drv, 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, const u8 *seq, size_t seq_len, const u8 *key, size_t key_len) diff --git a/src/drivers/driver_test.c b/src/drivers/driver_test.c index 555edcf83..bff76876d 100644 --- a/src/drivers/driver_test.c +++ b/src/drivers/driver_test.c @@ -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, 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, - int key_idx, int set_tx, +static int wpa_driver_test_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) { - wpa_printf(MSG_DEBUG, "%s: priv=%p alg=%d key_idx=%d set_tx=%d", - __func__, priv, alg, key_idx, set_tx); - if (addr) { + wpa_printf(MSG_DEBUG, "%s: ifname=%s priv=%p alg=%d key_idx=%d " + "set_tx=%d", + __func__, ifname, priv, alg, key_idx, set_tx); + if (addr) wpa_printf(MSG_DEBUG, " addr=" MACSTR, MAC2STR(addr)); - } - if (seq) { + if (seq) wpa_hexdump(MSG_DEBUG, " seq", seq, seq_len); - } - if (key) { - wpa_hexdump(MSG_DEBUG, " key", key, key_len); - } + if (key) + wpa_hexdump_key(MSG_DEBUG, " key", key, key_len); return 0; } @@ -2527,7 +2510,6 @@ const struct wpa_driver_ops wpa_driver_test_ops = { .valid_bss_mask = test_driver_valid_bss_mask, .hapd_set_ssid = test_driver_set_ssid, .set_privacy = test_driver_set_privacy, - .hapd_set_key = test_driver_set_key, .set_sta_vlan = test_driver_set_sta_vlan, .sta_add = test_driver_sta_add, .send_ether = test_driver_send_ether, diff --git a/src/drivers/driver_wext.c b/src/drivers/driver_wext.c index a291813bb..01487b924 100644 --- a/src/drivers/driver_wext.c +++ b/src/drivers/driver_wext.c @@ -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 * 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, int set_tx, const u8 *seq, size_t seq_len, const u8 *key, size_t key_len) diff --git a/src/drivers/driver_wext.h b/src/drivers/driver_wext.h index b89c2cb2f..caf3eff80 100644 --- a/src/drivers/driver_wext.h +++ b/src/drivers/driver_wext.h @@ -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_freq(void *priv, int freq); 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, int set_tx, const u8 *seq, size_t seq_len, const u8 *key, size_t key_len); diff --git a/wpa_supplicant/driver_i.h b/wpa_supplicant/driver_i.h index bd6de0665..4a7707a24 100644 --- a/wpa_supplicant/driver_i.h +++ b/wpa_supplicant/driver_i.h @@ -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) { wpa_s->keys_cleared = 0; - return wpa_s->driver->set_key(wpa_s->drv_priv, alg, addr, - key_idx, set_tx, seq, seq_len, - key, key_len); + return wpa_s->driver->set_key(wpa_s->ifname, wpa_s->drv_priv, + alg, addr, key_idx, set_tx, + seq, seq_len, key, key_len); } return -1; }