]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OCV: Parse all types of OCI information elements
authorMathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
Mon, 6 Aug 2018 19:46:28 +0000 (15:46 -0400)
committerJouni Malinen <j@w1.fi>
Sun, 16 Dec 2018 22:02:14 +0000 (00:02 +0200)
Add functionality to parse all variations of the OCI element.

Signed-off-by: Mathy Vanhoef <Mathy.Vanhoef@cs.kuleuven.be>
src/ap/wpa_auth_ie.c
src/ap/wpa_auth_ie.h
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h
src/common/wpa_common.c
src/common/wpa_common.h
src/rsn_supp/wpa_ie.c
src/rsn_supp/wpa_ie.h

index f00aa0b60a23b68bd47efc0d20e6c4da77c0df7d..92c70da817945f000bda4cd1e8d65f40ca77ccc4 100644 (file)
@@ -1014,6 +1014,15 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
        }
 #endif /* CONFIG_P2P */
 
+#ifdef CONFIG_OCV
+       if (pos[1] > RSN_SELECTOR_LEN + 2 &&
+           RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_OCI) {
+               ie->oci = pos + 2 + RSN_SELECTOR_LEN;
+               ie->oci_len = pos[1] - RSN_SELECTOR_LEN;
+               return 0;
+       }
+#endif /* CONFIG_OCV */
+
        return 0;
 }
 
index 73e433349049b7af6ea71bc794550248f0af5474..a38b206fd0f44a5c58849a6ffeb0ab89d1196b77 100644 (file)
@@ -33,6 +33,10 @@ struct wpa_eapol_ie_parse {
        const u8 *ip_addr_req;
        const u8 *ip_addr_alloc;
 #endif /* CONFIG_P2P */
+#ifdef CONFIG_OCV
+       const u8 *oci;
+       size_t oci_len;
+#endif /* CONFIG_OCV */
 
        const u8 *osen;
        size_t osen_len;
index e207599c5b749096958fb8902931af2408d16d86..76f4684b9110f43d44ca5aa04f9cf662904f1f0b 100644 (file)
@@ -266,6 +266,10 @@ static int ieee802_11_parse_extension(const u8 *pos, size_t elen,
                elems->password_id = pos;
                elems->password_id_len = elen;
                break;
+       case WLAN_EID_EXT_OCV_OCI:
+               elems->oci = pos;
+               elems->oci_len = elen;
+               break;
        default:
                if (show_errors) {
                        wpa_printf(MSG_MSGDUMP,
index f8e8b525a9dbd7bea64724794e5a72ef7eb19af0..a9b248319a1527770226744fb5530766da60aaa1 100644 (file)
@@ -85,6 +85,7 @@ struct ieee802_11_elems {
        const u8 *power_capab;
        const u8 *roaming_cons_sel;
        const u8 *password_id;
+       const u8 *oci;
 
        u8 ssid_len;
        u8 supp_rates_len;
@@ -131,6 +132,7 @@ struct ieee802_11_elems {
        u8 power_capab_len;
        u8 roaming_cons_sel_len;
        u8 password_id_len;
+       u8 oci_len;
 
        struct mb_ies_info mb_ies;
 };
index 2d989048ac94326ec98e35ff3dbc557111e78da3..b47f632e50c5683672b9a2d14fc6ea85247e3644 100644 (file)
@@ -880,6 +880,12 @@ static int wpa_ft_parse_ftie(const u8 *ie, size_t ie_len,
                        parse->igtk_len = len;
                        break;
 #endif /* CONFIG_IEEE80211W */
+#ifdef CONFIG_OCV
+               case FTIE_SUBELEM_OCI:
+                       parse->oci = pos;
+                       parse->oci_len = len;
+                       break;
+#endif /* CONFIG_OCV */
                default:
                        wpa_printf(MSG_DEBUG, "FT: Unknown subelem id %u", id);
                        break;
index b21b1385e3c701cae5209bd0cb4ce418d2c4d197..37b58341a73270499e7b29f78bf608380a53de32 100644 (file)
@@ -454,6 +454,10 @@ struct wpa_ft_ies {
        size_t tie_len;
        const u8 *igtk;
        size_t igtk_len;
+#ifdef CONFIG_OCV
+       const u8 *oci;
+       size_t oci_len;
+#endif /* CONFIG_OCV */
        const u8 *ric;
        size_t ric_len;
        int key_mgmt;
index ea2e9267222e74860373e80c840a6eb9601e3b3b..ae9f4ca241d8248551502ef3429dbf44bfaa2482 100644 (file)
@@ -465,6 +465,17 @@ static int wpa_parse_generic(const u8 *pos, const u8 *end,
        }
 #endif /* CONFIG_P2P */
 
+#ifdef CONFIG_OCV
+       if (pos[1] >= RSN_SELECTOR_LEN + 1 &&
+           RSN_SELECTOR_GET(pos + 2) == RSN_KEY_DATA_OCI) {
+               ie->oci = pos + 2 + RSN_SELECTOR_LEN;
+               ie->oci_len = pos[1] - RSN_SELECTOR_LEN;
+               wpa_hexdump(MSG_DEBUG, "WPA: OCI KDE in EAPOL-Key",
+                           pos, pos[1] + 2);
+               return 0;
+       }
+#endif /* CONFIG_OCV */
+
        return 0;
 }
 
index 0e72af56029eb9a01a107d315e87b61584bacf3c..9d53973a94314a982c8f82c2997218ab99ee1c89 100644 (file)
@@ -53,6 +53,10 @@ struct wpa_eapol_ie_parse {
        const u8 *ip_addr_req;
        const u8 *ip_addr_alloc;
 #endif /* CONFIG_P2P */
+#ifdef CONFIG_OCV
+       const u8 *oci;
+       size_t oci_len;
+#endif /* CONFIG_OCV */
 };
 
 int wpa_supplicant_parse_ies(const u8 *buf, size_t len,