|
@@ -454,8 +454,8 @@ static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd,
|
|
|
int i;
|
|
|
|
|
|
for (i = 0; i < NUM_WEP_KEYS; i++) {
|
|
|
- if (hostapd_set_encryption(ifname, hapd, "none", NULL, i, NULL,
|
|
|
- 0, i == 0 ? 1 : 0)) {
|
|
|
+ if (hostapd_set_key(ifname, hapd, WPA_ALG_NONE, NULL, i,
|
|
|
+ i == 0 ? 1 : 0, NULL, 0, NULL, 0)) {
|
|
|
wpa_printf(MSG_DEBUG, "Failed to clear default "
|
|
|
"encryption keys (ifname=%s keyidx=%d)",
|
|
|
ifname, i);
|
|
@@ -464,9 +464,9 @@ static void hostapd_broadcast_key_clear_iface(struct hostapd_data *hapd,
|
|
|
#ifdef CONFIG_IEEE80211W
|
|
|
if (hapd->conf->ieee80211w) {
|
|
|
for (i = NUM_WEP_KEYS; i < NUM_WEP_KEYS + 2; i++) {
|
|
|
- if (hostapd_set_encryption(ifname, hapd, "none", NULL,
|
|
|
- i, NULL, 0,
|
|
|
- i == 0 ? 1 : 0)) {
|
|
|
+ if (hostapd_set_key(ifname, hapd, WPA_ALG_NONE, NULL,
|
|
|
+ i, i == 0 ? 1 : 0, NULL, 0,
|
|
|
+ NULL, 0)) {
|
|
|
wpa_printf(MSG_DEBUG, "Failed to clear "
|
|
|
"default mgmt encryption keys "
|
|
|
"(ifname=%s keyidx=%d)", ifname, i);
|
|
@@ -491,11 +491,9 @@ static int hostapd_broadcast_wep_set(struct hostapd_data *hapd)
|
|
|
|
|
|
idx = ssid->wep.idx;
|
|
|
if (ssid->wep.default_len &&
|
|
|
- hostapd_set_encryption(hapd->conf->iface,
|
|
|
- hapd, "WEP", NULL, idx,
|
|
|
- ssid->wep.key[idx],
|
|
|
- ssid->wep.len[idx],
|
|
|
- idx == ssid->wep.idx)) {
|
|
|
+ hostapd_set_key(hapd->conf->iface,
|
|
|
+ hapd, WPA_ALG_WEP, NULL, idx, idx == ssid->wep.idx,
|
|
|
+ NULL, 0, ssid->wep.key[idx], ssid->wep.len[idx])) {
|
|
|
wpa_printf(MSG_WARNING, "Could not set WEP encryption.");
|
|
|
errors++;
|
|
|
}
|
|
@@ -513,10 +511,9 @@ static int hostapd_broadcast_wep_set(struct hostapd_data *hapd)
|
|
|
continue;
|
|
|
|
|
|
idx = key->idx;
|
|
|
- if (hostapd_set_encryption(ifname, hapd, "WEP", NULL,
|
|
|
- idx, key->key[idx],
|
|
|
- key->len[idx],
|
|
|
- idx == key->idx)) {
|
|
|
+ if (hostapd_set_key(ifname, hapd, WPA_ALG_WEP, NULL,
|
|
|
+ idx, idx == key->idx, NULL, 0,
|
|
|
+ key->key[idx], key->len[idx])) {
|
|
|
wpa_printf(MSG_WARNING, "Could not set "
|
|
|
"dynamic VLAN WEP encryption.");
|
|
|
errors++;
|
|
@@ -647,10 +644,10 @@ static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
if (hapd->conf->ssid.wep.key[i] &&
|
|
|
- hostapd_set_encryption(iface, hapd, "WEP", NULL,
|
|
|
- i, hapd->conf->ssid.wep.key[i],
|
|
|
- hapd->conf->ssid.wep.len[i],
|
|
|
- i == hapd->conf->ssid.wep.idx)) {
|
|
|
+ hostapd_set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
|
|
|
+ i == hapd->conf->ssid.wep.idx, NULL, 0,
|
|
|
+ hapd->conf->ssid.wep.key[i],
|
|
|
+ hapd->conf->ssid.wep.len[i])) {
|
|
|
wpa_printf(MSG_WARNING, "Could not set WEP "
|
|
|
"encryption.");
|
|
|
return -1;
|
|
@@ -839,7 +836,7 @@ static int hostapd_wpa_auth_get_msk(void *ctx, const u8 *addr, u8 *msk,
|
|
|
}
|
|
|
|
|
|
|
|
|
-static int hostapd_wpa_auth_set_key(void *ctx, int vlan_id, const char *alg,
|
|
|
+static int hostapd_wpa_auth_set_key(void *ctx, int vlan_id, wpa_alg alg,
|
|
|
const u8 *addr, int idx, u8 *key,
|
|
|
size_t key_len)
|
|
|
{
|
|
@@ -852,8 +849,8 @@ static int hostapd_wpa_auth_set_key(void *ctx, int vlan_id, const char *alg,
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
- return hostapd_set_encryption(ifname, hapd, alg, addr, idx,
|
|
|
- key, key_len, 1);
|
|
|
+ return hostapd_set_key(ifname, hapd, alg, addr, idx, 1, NULL, 0,
|
|
|
+ key, key_len);
|
|
|
}
|
|
|
|
|
|
|