]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Move cipher to enum wpa_cipher conversion into wpa_common.c
authorJouni Malinen <j@w1.fi>
Sun, 13 Jan 2013 16:02:20 +0000 (18:02 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 13 Jan 2013 16:02:20 +0000 (18:02 +0200)
Signed-hostap: Jouni Malinen <j@w1.fi>

src/common/wpa_common.c
src/common/wpa_common.h
wpa_supplicant/ap.c
wpa_supplicant/sme.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant_i.h

index c786b0a25d33ddb5239c06c59eac04ea8d4682d9..a8cf6be81932e2ad26fdc99b5acb0b354d481a30 100644 (file)
@@ -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 ||
index a326950c6da4cd7021b51201afa66c5ccc2da7e6..2d63662397aab8ee5e9713c78d4cbafce196d55b 100644 (file)
@@ -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);
index ee53c37d4e48d5a86edfb4450f8332fcd050b8ca..85ee6cb2488cd82871a7cb51361dedcabd2ffc04 100644 (file)
@@ -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
index cb94db8d30b156a5f98cf6e48e0423859659c538..30f9779ee11df88f857fa7e57cc2f79b3475229d 100644 (file)
@@ -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));
index 530e57f46115e2be7eb0a94205ee94c9e15e874e..64f5c1bded1d98772c042dec735899b327b79134 100644 (file)
@@ -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)
index 8408a4a7eeb64663433f9f7687d0787bcd6888a7..ecbdedf0d7ecc82b6254c671ba000ab55944658a 100644 (file)
@@ -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);