diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c index c786b0a25..a8cf6be81 100644 --- a/src/common/wpa_common.c +++ b/src/common/wpa_common.c @@ -1132,6 +1132,26 @@ int wpa_cipher_to_alg(int cipher) } +enum wpa_cipher wpa_cipher_to_suite_driver(int cipher) +{ + switch (cipher) { + case WPA_CIPHER_NONE: + return CIPHER_NONE; + case WPA_CIPHER_WEP40: + return CIPHER_WEP40; + case WPA_CIPHER_WEP104: + return CIPHER_WEP104; + case WPA_CIPHER_CCMP: + return CIPHER_CCMP; + case WPA_CIPHER_GCMP: + return CIPHER_GCMP; + case WPA_CIPHER_TKIP: + default: + return CIPHER_TKIP; + } +} + + int wpa_cipher_valid_pairwise(int cipher) { return cipher == WPA_CIPHER_CCMP || diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h index a326950c6..2d6366239 100644 --- a/src/common/wpa_common.h +++ b/src/common/wpa_common.h @@ -392,6 +392,7 @@ int wpa_ft_parse_ies(const u8 *ies, size_t ies_len, struct wpa_ft_ies *parse); int wpa_cipher_key_len(int cipher); int wpa_cipher_rsc_len(int cipher); int wpa_cipher_to_alg(int cipher); +enum wpa_cipher wpa_cipher_to_suite_driver(int cipher); int wpa_cipher_valid_pairwise(int cipher); u32 wpa_cipher_to_suite(int proto, int cipher); int rsn_cipher_put_suites(u8 *pos, int ciphers); diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index ee53c37d4..85ee6cb24 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -460,7 +460,8 @@ int wpa_supplicant_create_ap(struct wpa_supplicant *wpa_s, "cipher."); return -1; } - params.pairwise_suite = cipher_suite2driver(wpa_s->pairwise_cipher); + params.pairwise_suite = + wpa_cipher_to_suite_driver(wpa_s->pairwise_cipher); params.group_suite = params.pairwise_suite; #ifdef CONFIG_P2P diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index cb94db8d3..30f9779ee 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -643,8 +643,9 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode, params.wpa_ie = wpa_s->sme.assoc_req_ie_len ? wpa_s->sme.assoc_req_ie : NULL; params.wpa_ie_len = wpa_s->sme.assoc_req_ie_len; - params.pairwise_suite = cipher_suite2driver(wpa_s->pairwise_cipher); - params.group_suite = cipher_suite2driver(wpa_s->group_cipher); + params.pairwise_suite = + wpa_cipher_to_suite_driver(wpa_s->pairwise_cipher); + params.group_suite = wpa_cipher_to_suite_driver(wpa_s->group_cipher); #ifdef CONFIG_HT_OVERRIDES os_memset(&htcaps, 0, sizeof(htcaps)); os_memset(&htcaps_mask, 0, sizeof(htcaps_mask)); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 530e57f46..64f5c1bde 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -845,26 +845,6 @@ static void wpa_supplicant_reconfig(int sig, void *signal_ctx) } -enum wpa_cipher cipher_suite2driver(int cipher) -{ - switch (cipher) { - case WPA_CIPHER_NONE: - return CIPHER_NONE; - case WPA_CIPHER_WEP40: - return CIPHER_WEP40; - case WPA_CIPHER_WEP104: - return CIPHER_WEP104; - case WPA_CIPHER_CCMP: - return CIPHER_CCMP; - case WPA_CIPHER_GCMP: - return CIPHER_GCMP; - case WPA_CIPHER_TKIP: - default: - return CIPHER_TKIP; - } -} - - enum wpa_key_mgmt key_mgmt2driver(int key_mgmt) { switch (key_mgmt) { @@ -1480,8 +1460,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s, wpa_clear_keys(wpa_s, bss ? bss->bssid : NULL); use_crypt = 1; - cipher_pairwise = cipher_suite2driver(wpa_s->pairwise_cipher); - cipher_group = cipher_suite2driver(wpa_s->group_cipher); + cipher_pairwise = wpa_cipher_to_suite_driver(wpa_s->pairwise_cipher); + cipher_group = wpa_cipher_to_suite_driver(wpa_s->group_cipher); if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE || wpa_s->key_mgmt == WPA_KEY_MGMT_IEEE8021X_NO_WPA) { if (wpa_s->key_mgmt == WPA_KEY_MGMT_NONE) diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 8408a4a7e..ecbdedf0d 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -748,7 +748,6 @@ void wpa_supplicant_terminate_proc(struct wpa_global *global); void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr, const u8 *buf, size_t len); enum wpa_key_mgmt key_mgmt2driver(int key_mgmt); -enum wpa_cipher cipher_suite2driver(int cipher); void wpa_supplicant_update_config(struct wpa_supplicant *wpa_s); void wpa_supplicant_clear_status(struct wpa_supplicant *wpa_s); void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid);