mesh: parse mesh-related information elements

Add support for parsing mesh id, mesh config, mesh peering,
AMPE and MIC information elements.

Signed-hostap: Bob Copeland <me@bobcopeland.com>
config: add mesh mode, user_mpm, and no_auto_peer options

Modify network mode to support mode number 5 when CONFIG_MESH is
enabled.

Add user_mpm config parameter, when this is set to 1 (the default) the
peer link management is done on userspace, otherwise the peer management
will be done by the kernel.

Also add no_auto_peer parameter, which controls wheter a station will
automatically initiate peering to another mesh peer that comes into
range.

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
Signed-hostap: Thomas Pedersen <thomas@noack.us>

---
Still TODO: incorporate various fixes from Yu Niiro for
saving options
Makefile: add mesh support to wpa_s build

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-hostap: Thomas Pedersen <thomas@noack.us>

--
v8: squashed all makefile changes together, reordered, added android.mk
    bits
aes_siv: implement RFC 5297 AES-SIV

Add an implementation of Synthetic Initialization Vector (SIV)
Authenticated Encryption Using the Advanced Encryption Standard (AES).

This mode of AES is used to protect peering frames when using
the authenticated mesh peering exchange.

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
Signed-hostap: Bob Copeland <me@bobcopeland.com>
mesh_rsn: add mesh robust security network

This implementation provides:

- Mesh SAE authentication mechanism
- Key management (set/get PSK)
- Cryptographic key establishment
- Enhanced protection mechanisms for robust management frames

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
Signed-hostap: Thomas Pedersen <thomas@noack.us>

---
v2: Squash with "Include user_mpm in global configuration dump" https://github.com/cozybit/wpa_s_mesh_android/commit/524391c7da144c2fb967c2719bfc60760df14b93
v4: Reordered to earlier in the patch series
v6: Updated email addresses, added signed-hostap
v7: remove blank lines before Signed-hostap
v8: split out unrelated stuff
auth: handle auth frames for mesh ifaces

Modify wpa_supplicant/hostapd logic to allow SAE auth on Mesh
interfaces.

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-hostap: Thomas Pedersen <thomas@noack.us>
---
Still TODO: pick up Chun-Yeow Yeoh's changes
wpa_supplicant: implement mesh scanning

When mesh is configured in, include the wildcard
mesh id so that mesh networks are returned.  Tag any
returned mesh networks with [MESH].

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-hostap: Jason Abele <jason.abele@gmail.com>
wpa_s, ctrl_iface: Add mesh_group_{add,remove}

Parse MESH_GROUP_ADD/REMOVE commands on ctrl interface and call
wpa_supplicant routines.  These commands are used to start or
join a mesh network.

The mesh id is given in the configuration file, therefore there is
no need to scan before joining a mesh network.  We reuse the
connect_without_scan construct used by p2p for that same purpose.

Signed-off-by: Javier Cardona <javier@cozybit.com>
Signed-hostap: Javier Lopez <jlopex@gmail.com>
sample conf: add description for new mesh options

Modify sample wpa_supplicant.conf file to include user_mpm option
and new network mode (5), including open and secure mesh networking.

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
Signed-hostap: Thomas Pedersen <thomas@noack.us>

---
v5: Changed default, adjust the explanation for user_mpm=1 per Bob's
recommendation.
v6: Updated email address, added signed-hostap
v7: remove blank lines before Signed-hostap, fix description of
    variable default
hwsim_tests: add test_wpas_mesh test cases

This wpa_supplicant tests include basic tests for:

- Mesh scan
- Mesh group add/remove
- Mesh peer connected/disconnected
- Add/Set/Remove to test mesh mode network
- Open mesh connectivity test
- Secure mesh connectivity test
- no_auto_peer

Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
[no_auto_peer test by: Javier Cardona <javier@cozybit.com>
Signed-hostap: Javier Lopez <jlopex@gmail.com>
wpa_s: enable mesh HT mode

Add a new option "mesh_ht_mode" that specifies the HT mode for the
mesh, with this option on, mesh beacons, actions frames, and probe
responses with include the appropriate HT information elements.

Change the mesh tests to check for the presence of HT in the scan
results, for this to work "disable_scan_offload" must be added to
p2p*.conf.

Signed-off-by: Ashok Nagarajan <ashok.dragon@gmail.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
[Original implementation by Chun-Yeow Yeoh <yeohchunyeow@gmail.com>]
Signed-hostap: Jason Mobarak <x@jason.mobarak.name>

---
Still TODO: fixup order of IEs
hostapd: check if mesh_conf struct is set

Modify hostapd.c logic to add checks for valid mconf data structure:

- For hostapd_setup_bss we don't need to flush old stations in case
  we're rejoining a mesh network.

- In hostapd_setup_interface_complete, we don't need to setup the
  interface until we join the mesh (same reasoning for
  hostapd_tx_queue_params).

Signed-off-by: Javier Lopez <jlopex@gmail.com>
Signed-off-by: Jason Mobarak <x@jason.mobarak.name>
Signed-hostap: Javier Lopez <jlopex@gmail.com>

---
v4: Reword commit per Thomas' suggestion, specify why we're checking
    mconf for null.
v6: Update email addresses, add signed-hostap.
v7: remove blank lines before Signed-hostap