mech_eap.git
8 years agotests: WPS ER subscribe OOM
Jouni Malinen [Mon, 7 Sep 2015 13:38:38 +0000 (16:38 +0300)]
tests: WPS ER subscribe OOM

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS ER caching AP settings (OOM)
Jouni Malinen [Mon, 7 Sep 2015 13:31:38 +0000 (16:31 +0300)]
tests: WPS ER caching AP settings (OOM)

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS against external implementation
Jouni Malinen [Sun, 6 Sep 2015 18:47:28 +0000 (21:47 +0300)]
tests: WPS against external implementation

This adds a Python-based minimal WSC protocol implementation to allow
more testing coverage to be reached for various error cases in protected
attributes. The wps_ext test case completes successful exchange in both
the Enrollee and Registrar roles acting in the middle of AP and STA. The
other test cases cover error cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS ER init failure
Jouni Malinen [Mon, 7 Sep 2015 10:46:58 +0000 (13:46 +0300)]
tests: WPS ER init failure

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS AP configured for special ap_setup_locked=2 mode
Jouni Malinen [Mon, 7 Sep 2015 10:42:22 +0000 (13:42 +0300)]
tests: WPS AP configured for special ap_setup_locked=2 mode

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS AP and UPnP event subscription and many events
Jouni Malinen [Sun, 6 Sep 2015 08:56:10 +0000 (11:56 +0300)]
tests: WPS AP and UPnP event subscription and many events

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Multiple WPS ERs adding a new enrollee using PIN
Jouni Malinen [Sun, 6 Sep 2015 08:32:02 +0000 (11:32 +0300)]
tests: Multiple WPS ERs adding a new enrollee using PIN

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: D-Bus GroupFormationFailure signal
Jouni Malinen [Sat, 5 Sep 2015 19:29:00 +0000 (22:29 +0300)]
tests: D-Bus GroupFormationFailure signal

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoP2P: Add D-Bus signal GroupFormationFailure
Nishant Chaprana [Thu, 20 Aug 2015 10:58:33 +0000 (16:28 +0530)]
P2P: Add D-Bus signal GroupFormationFailure

This is similar to the control interface event
P2P-GROUP-FORMATION-FAILURE.

Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
8 years agotests: WPS config method update for WPS and P2P
Jouni Malinen [Sat, 5 Sep 2015 18:58:18 +0000 (21:58 +0300)]
tests: WPS config method update for WPS and P2P

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Allow config_methods to be cleared with an empty string
Jouni Malinen [Sat, 5 Sep 2015 18:49:38 +0000 (21:49 +0300)]
WPS: Allow config_methods to be cleared with an empty string

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: IBSS RSN OOM during wpa_init
Jouni Malinen [Sat, 5 Sep 2015 18:35:58 +0000 (21:35 +0300)]
tests: IBSS RSN OOM during wpa_init

This is a regression test for a segfault that was fixed in the previous
commit.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoRSN IBSS: Fix segfault on error path
Jouni Malinen [Sat, 5 Sep 2015 18:35:16 +0000 (21:35 +0300)]
RSN IBSS: Fix segfault on error path

If wpa_init() fails, wpa_deinit(NULL) must not be called to avoid
hitting a NULL pointer dereference.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Secure mesh network setup failing due to wpa_init() OOM
Jouni Malinen [Sat, 5 Sep 2015 18:30:45 +0000 (21:30 +0300)]
tests: Secure mesh network setup failing due to wpa_init() OOM

This is a regression test for incorrect error path behavior that was
fixed in the previous commits.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agomesh: Fix memory leak on error path
Masashi Honma [Wed, 26 Aug 2015 08:32:39 +0000 (17:32 +0900)]
mesh: Fix memory leak on error path

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
8 years agomesh: Fix segfault on error path
Masashi Honma [Wed, 26 Aug 2015 08:32:38 +0000 (17:32 +0900)]
mesh: Fix segfault on error path

When wpa_init() in __mesh_rsn_auth_init() failed, empty rsn->auth caused
segmentation fault due to NULL pointer dereference when wpa_deinit() was
called. Fix this by checking the pointer before executing deinit steps.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
8 years agomesh: Add RSN IE to Mesh Peering Open/Confirm frames
Masashi Honma [Mon, 31 Aug 2015 07:58:10 +0000 (16:58 +0900)]
mesh: Add RSN IE to Mesh Peering Open/Confirm frames

The RSN IE is required by IEEE Std 802.11-2012 on SAE use case:
Table 8-262 Mesh Peering Open frame Action field format
Table 8-263 Mesh Peering Confirm frame Action field format

Add the RSN IE to these frames.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
8 years agomesh: Rename IE field to clarify its use
Masashi Honma [Mon, 31 Aug 2015 07:58:09 +0000 (16:58 +0900)]
mesh: Rename IE field to clarify its use

This is used only for RSNE.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
8 years agoTDLS: Use proper IE parsing routine for non-EAPOL-Key cases
Jouni Malinen [Sat, 5 Sep 2015 17:51:11 +0000 (20:51 +0300)]
TDLS: Use proper IE parsing routine for non-EAPOL-Key cases

wpa_supplicant_parse_ies() was never supposed to be used as a generic IE
parser, i.e., it is for the specific purpose of parsing EAPOL-Key Key
Data IEs and KDEs. TDLS used this function for parsing generic AP IEs
and while that works, it resulted in confusing "WPA: Unrecognized
EAPOL-Key Key Data IE" debug messages. Clean this up by using
ieee802_11_parse_elems() for the cases where generic IEs are being
parsed.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAdd BSS operating frequency to more debug messages
Jouni Malinen [Sat, 5 Sep 2015 17:40:44 +0000 (20:40 +0300)]
Add BSS operating frequency to more debug messages

This makes it easier to analyze debug logs when figuring out channel
related issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: AP and STA tracking with passive scan
Jouni Malinen [Sat, 5 Sep 2015 17:29:01 +0000 (20:29 +0300)]
tests: AP and STA tracking with passive scan

Verify that Public Action frame from a STA is used to add a tracking
entry.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAdd station tracking based on other management frame subtypes
Jouni Malinen [Sat, 5 Sep 2015 16:38:06 +0000 (19:38 +0300)]
Add station tracking based on other management frame subtypes

This extends the previous tracking design to add a station entry based
on other management frames than Probe Request frames. For example, this
covers a case where the station is using passive scanning.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_gui: Increase control interface message buffer for LIST_NETWORKS
Jouni Malinen [Sat, 5 Sep 2015 16:28:56 +0000 (19:28 +0300)]
wpa_gui: Increase control interface message buffer for LIST_NETWORKS

Double the buffer length from 2048 to 4096 to match the length used
currently in wpa_supplicant. This allows wpa_gui to retrieve information
for more networks than previously.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Merge identical error paths in ssdp_listener_open()
Jouni Malinen [Sat, 5 Sep 2015 16:28:45 +0000 (19:28 +0300)]
WPS: Merge identical error paths in ssdp_listener_open()

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Dualband AP rejecting authentication from dualband STA on 2.4 GHz
Jouni Malinen [Sat, 5 Sep 2015 16:01:42 +0000 (19:01 +0300)]
tests: Dualband AP rejecting authentication from dualband STA on 2.4 GHz

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAdd option to reject authentication on 2.4 GHz from dualband STA
Jouni Malinen [Sat, 5 Sep 2015 16:00:03 +0000 (19:00 +0300)]
Add option to reject authentication on 2.4 GHz from dualband STA

The new no_auth_if_seen_on=<ifname> parameter can now be used to
configure hostapd to reject authentication from a station that was seen
on another radio.

This can be used with enabled track_sta_max_num configuration on another
interface controlled by the same hostapd process to reject
authentication attempts from a station that has been detected to be
capable of operating on another band, e.g., to try to reduce likelihood
of the station selecting a 2.4 GHz BSS when the AP operates both a 2.4
GHz and 5 GHz BSS concurrently.

Note: Enabling this can cause connectivity issues and increase latency for
connecting with the AP.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoIndicate CTRL-EVENT-AUTH-REJECT event on authentication rejection
Jouni Malinen [Sat, 5 Sep 2015 15:33:35 +0000 (18:33 +0300)]
Indicate CTRL-EVENT-AUTH-REJECT event on authentication rejection

This allows control interface monitors to get more detailed information
in cases where wpa_supplicant-based SME receives an Authentication frame
with non-zero status code.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Dualband AP not replying to probes from dualband STA on 2.4 GHz
Jouni Malinen [Sat, 5 Sep 2015 14:54:50 +0000 (17:54 +0300)]
tests: Dualband AP not replying to probes from dualband STA on 2.4 GHz

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAdd option to ignore Probe Request frames on 2.4 GHz from dualband STA
Jouni Malinen [Sat, 5 Sep 2015 14:53:15 +0000 (17:53 +0300)]
Add option to ignore Probe Request frames on 2.4 GHz from dualband STA

The new no_probe_resp_if_seen_on=<ifname> parameter can now be used to
configure hostapd to not reply to group-addressed Probe Request from a
station that was seen on another radio.

This can be used with enabled track_sta_max_num configuration on another
interface controlled by the same hostapd process to restrict Probe
Request frame handling from replying to group-addressed Probe Request
frames from a station that has been detected to be capable of operating
on another band, e.g., to try to reduce likelihood of the station
selecting a 2.4 GHz BSS when the AP operates both a 2.4 GHz and 5 GHz
BSS concurrently.

Note: Enabling this can cause connectivity issues and increase latency
for discovering the AP.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Unconnected station tracking
Jouni Malinen [Sat, 5 Sep 2015 14:13:15 +0000 (17:13 +0300)]
tests: Unconnected station tracking

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agohostapd: Add mechanism to track unconnected stations
Jouni Malinen [Sat, 5 Sep 2015 14:11:11 +0000 (17:11 +0300)]
hostapd: Add mechanism to track unconnected stations

hostapd can now be configured to track unconnected stations based on
Probe Request frames seen from them. This can be used, e.g., to detect
dualband capable station before they have associated. Such information
could then be used to provide guidance on which colocated BSS to use in
case of a dualband AP that operates concurrently on multiple bands under
the control of a single hostapd process.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_priv: Add authentication command and event
Jouni Malinen [Sat, 5 Sep 2015 10:21:17 +0000 (13:21 +0300)]
wpa_priv: Add authentication command and event

These are needed to work with nl80211 driver interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_priv: Add support for EVENT_SCAN_STARTED
Jouni Malinen [Sat, 5 Sep 2015 09:39:11 +0000 (12:39 +0300)]
wpa_priv: Add support for EVENT_SCAN_STARTED

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_priv: Print unsupported driver event name in debug log
Jouni Malinen [Sat, 5 Sep 2015 09:35:59 +0000 (12:35 +0300)]
wpa_priv: Print unsupported driver event name in debug log

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_priv: Clear extended_capa pointers
Jouni Malinen [Sat, 5 Sep 2015 09:32:58 +0000 (12:32 +0300)]
wpa_priv: Clear extended_capa pointers

For now, there is no support for passing extended_capa pointers through
the driver_privsep.c interface from wpa_priv. Avoid leaving bogus
pointers by explicitly clearing these on both wpa_priv and
wpa_supplicant sides.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_priv: Add support for global driver interface context
Jouni Malinen [Sat, 5 Sep 2015 09:03:18 +0000 (12:03 +0300)]
wpa_priv: Add support for global driver interface context

This is needed with driver_nl80211.c to be able to use the newer
wpa_driver_ops::init2() alternative.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_priv: allow l2_packet to be opened for ethertype 0x890d
Jouni Malinen [Sat, 5 Sep 2015 08:54:06 +0000 (11:54 +0300)]
wpa_priv: allow l2_packet to be opened for ethertype 0x890d

This is needed to initialize TDLS functionality.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_priv: Add -c argument to usage text
Jouni Malinen [Sat, 5 Sep 2015 08:44:34 +0000 (11:44 +0300)]
wpa_priv: Add -c argument to usage text

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agowpa_priv: Fix early exit path
Jouni Malinen [Sat, 5 Sep 2015 08:41:49 +0000 (11:41 +0300)]
wpa_priv: Fix early exit path

eloop_destroy() cannot be called before eloop_init() have been called
successfully.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoDo not advertise DSSS/CCK support in 40 MHz for 5 GHz band
Vasanthakumar Thiagarajan [Fri, 4 Sep 2015 05:22:58 +0000 (10:52 +0530)]
Do not advertise DSSS/CCK support in 40 MHz for 5 GHz band

DSSS/CCK rate support in 40 MHz has to be set to 0 for 5 GHz band since
this mechanism is designed only for the 2.4 GHz band. Clear
HT_CAP_INFO_DSSS_CCK40MHZ in ht_capab when the configured mode is
neither 11b nor 11g.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qti.qualcomm.com>
8 years agoMake it clearer that ap_scan=2 mode should not be used with nl80211
Jouni Malinen [Fri, 4 Sep 2015 22:04:29 +0000 (01:04 +0300)]
Make it clearer that ap_scan=2 mode should not be used with nl80211

Add more details into configuration comments and a runtime info message
if ap_scan=2 is used with the nl80211 driver interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS Enrollee protocol testing
Jouni Malinen [Mon, 31 Aug 2015 17:23:57 +0000 (20:23 +0300)]
tests: WPS Enrollee protocol testing

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: AP configuration using wps_config and wps_cred_processing=2
Jouni Malinen [Tue, 1 Sep 2015 09:25:31 +0000 (12:25 +0300)]
tests: AP configuration using wps_config and wps_cred_processing=2

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS ER timing out STA entry after negotiation
Jouni Malinen [Tue, 1 Sep 2015 09:18:00 +0000 (12:18 +0300)]
tests: WPS ER timing out STA entry after negotiation

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAllow wpa_cli/hostapd_cli client socket directory to be specified
Manikandan Mohan [Tue, 25 Aug 2015 04:34:03 +0000 (21:34 -0700)]
Allow wpa_cli/hostapd_cli client socket directory to be specified

This adds a new helper function wpa_ctrl_open2() that can be used
instead of wpa_ctrl_open() to override the default client socket
directory. Add optional -s<directory path> argument to hostapd_cli and
wpa_cli to allow the client socket directory to be specified.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoWPS: Remove trailing CR from subscription callback URLs
Jouni Malinen [Mon, 31 Aug 2015 13:17:31 +0000 (16:17 +0300)]
WPS: Remove trailing CR from subscription callback URLs

This cleans up the debug log a bit.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Print subscription UUID in debug log in more places
Jouni Malinen [Mon, 31 Aug 2015 13:16:59 +0000 (16:16 +0300)]
WPS: Print subscription UUID in debug log in more places

This makes it easier to debug subscription issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS AP and advertisement OOM
Jouni Malinen [Mon, 31 Aug 2015 10:05:48 +0000 (13:05 +0300)]
tests: WPS AP and advertisement OOM

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Clean up next_advertisement() error path
Jouni Malinen [Mon, 31 Aug 2015 09:56:56 +0000 (12:56 +0300)]
WPS: Clean up next_advertisement() error path

No need to have a common failure handler if it is used from only a
single location and that lcoation does not even need the memory freeing
step.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Merge event_send_start() error paths
Jouni Malinen [Mon, 31 Aug 2015 09:49:58 +0000 (12:49 +0300)]
WPS: Merge event_send_start() error paths

There is no need to keep these separate.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS UPnP SetSelectedRegistrar protocol testing
Jouni Malinen [Mon, 31 Aug 2015 09:47:38 +0000 (12:47 +0300)]
tests: WPS UPnP SetSelectedRegistrar protocol testing

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Merge SetSelectedRegistrar parsing error returns
Jouni Malinen [Mon, 31 Aug 2015 09:29:09 +0000 (12:29 +0300)]
WPS: Merge SetSelectedRegistrar parsing error returns

There is no need to maintain two error paths for this.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS ER Selected Registrar timeout
Jouni Malinen [Sun, 30 Aug 2015 22:55:56 +0000 (01:55 +0300)]
tests: WPS ER Selected Registrar timeout

This extends ap_wps_pbc_timeout to cover another long WPS timeout:
ER-initiated SetSelectedRegistrar timeout on AP. Using the same test
case for this avoids the need for another 120 second test case.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: More WPS/HTTP test coverage
Jouni Malinen [Fri, 28 Aug 2015 17:33:52 +0000 (20:33 +0300)]
tests: More WPS/HTTP test coverage

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-WSC peer: Reject connection on unexpected failure
Jouni Malinen [Sun, 30 Aug 2015 15:36:28 +0000 (18:36 +0300)]
EAP-WSC peer: Reject connection on unexpected failure

Previously, the EAP-WSC peer state machine ended up just ignoring an
error and waiting for a new message from the AP. This is not going to
recover the exchange, so simply force the connection to terminate
immediately.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAllow BSS to return information for AP that uses an invalid WSC IE
Jouni Malinen [Sat, 29 Aug 2015 20:59:44 +0000 (23:59 +0300)]
Allow BSS to return information for AP that uses an invalid WSC IE

Previously, the BSS command returned an error if the WSC IE(s) in scan
results could not be parsed. This may be not ideal for all cases, to
instead of rejecting the command completely, return all other
information apart from the WPS information in such a case.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Use a shared error path in http_client_addr()
Jouni Malinen [Sat, 29 Aug 2015 10:41:40 +0000 (13:41 +0300)]
WPS: Use a shared error path in http_client_addr()

This simplifies error processing by removing duplicated cleanup steps.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Clean up http_client_tx_ready()
Jouni Malinen [Sat, 29 Aug 2015 10:34:39 +0000 (13:34 +0300)]
WPS: Clean up http_client_tx_ready()

Calculate the send() buffer length only once to make this a bit more
readable.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Remove duplicated isgraph() loop in HTTP header parsing
Jouni Malinen [Fri, 28 Aug 2015 20:58:10 +0000 (23:58 +0300)]
WPS: Remove duplicated isgraph() loop in HTTP header parsing

The hbp pointer is moved to the next space already earlier in this code
path, so the while loop here did not really do anything.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoWPS: Merge common error paths in HTTP server
Jouni Malinen [Fri, 28 Aug 2015 17:33:22 +0000 (20:33 +0300)]
WPS: Merge common error paths in HTTP server

There is no need to maintain three separate "goto fail" cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: cfg80211 connect command to trigger roam
Jouni Malinen [Fri, 28 Aug 2015 16:01:47 +0000 (19:01 +0300)]
tests: cfg80211 connect command to trigger roam

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoRemove unnecessary enum typedef from wpa_auth_sm_event()
Jouni Malinen [Fri, 28 Aug 2015 13:34:38 +0000 (16:34 +0300)]
Remove unnecessary enum typedef from wpa_auth_sm_event()

This is more consistent with the expected coding style.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoEAPOL auth: Avoid recursive wpa_sm_step() on WPA_DEAUTH case
Jouni Malinen [Fri, 28 Aug 2015 13:32:14 +0000 (16:32 +0300)]
EAPOL auth: Avoid recursive wpa_sm_step() on WPA_DEAUTH case

It was possible for wpa_auth_sm_event(WPA_DEAUTH) to be called from
wpa_sm_step() iteration in the case the EAPOL authenticator state
machine ended up requesting the station to be disconnected. This
resulted in unnecessary recursive call to wpa_sm_step(). Avoid this by
using the already running call to process the state change.

It was possible to hit this sequence in the hwsim test case
ap_wpa2_eap_eke_server_oom.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoEAPOL auth: clear keyRun in AUTH_PAE INITIALIZE
Jouni Malinen [Fri, 28 Aug 2015 13:30:06 +0000 (16:30 +0300)]
EAPOL auth: clear keyRun in AUTH_PAE INITIALIZE

Clearing keyRun here is not specified in IEEE Std 802.1X-2004, but it
looks like this would be logical thing to do here since the EAPOL-Key
exchange is not possible in this state. It is possible to get here on
disconnection event without advancing to the AUTHENTICATING state to
clear keyRun before the IEEE 802.11 RSN authenticator state machine runs
and that may advance from AUTHENTICATION2 to INITPMK if keyRun = TRUE
has been left from the last association. This can be avoided by clearing
keyRun here.

It was possible to hit this corner case in the hwsim test case
ap_wpa2_eap_eke_server_oom in the case getKey operation was forced to
fail memory allocation. The following association resulted in the
station getting disconnected when entering INITPMK without going through
EAP authentication.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agonl80211: Use nla_put_nested() to set NL80211_ATTR_MAC_ADDRS
Jouni Malinen [Thu, 13 Aug 2015 13:03:23 +0000 (16:03 +0300)]
nl80211: Use nla_put_nested() to set NL80211_ATTR_MAC_ADDRS

This allows an empty nested list (i.e., no MAC addresses) to be included
in the NL80211_CMD_SET_MAC_ACL message unlike with
nla_nest_start()/nla_nest_end() where the current libnl implementation
removes the "empty" attribute and causes cfg80211 to reject the command.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agodbus: Fix a typo in function comment
MAYANK HAARIT [Fri, 21 Aug 2015 10:02:22 +0000 (10:02 +0000)]
dbus: Fix a typo in function comment

Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
Signed-off-by: Dilshad Ahmad <dilshad.a@samsung.com>
8 years agoP2PS: Remove redundant check in for loop
Purushottam Kushwaha [Fri, 21 Aug 2015 09:56:05 +0000 (09:56 +0000)]
P2PS: Remove redundant check in for loop

Signed-off-by: Purushottam Kushwaha <p.kushwaha@samsung.com>
Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
8 years agotests: Regression test for D-Bus setting scan_freq and freq_list
Jouni Malinen [Thu, 27 Aug 2015 21:13:53 +0000 (00:13 +0300)]
tests: Regression test for D-Bus setting scan_freq and freq_list

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agodbus: Do not quote scan_freq and freq_list in dbus_old_handlers.c
Jiří Klimeš [Tue, 18 Aug 2015 11:33:59 +0000 (13:33 +0200)]
dbus: Do not quote scan_freq and freq_list in dbus_old_handlers.c

scan_freq and freq_list are not parsed correctly by
wpa_config_parse_int_array() if quoted.

Patch for dbus_old_handlers.c, the same change as done by Robert Shade
<robert.shade@gmail.com> for dbus_new_handlers.c in commit
99276998fa26d4299825eeafb6386fe1c51f6287 ('dbus: Do not quote scan_freq
and freq_list').

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
8 years agoFix key derivation for Suite B 192-bit AKM to use SHA384
Jouni Malinen [Thu, 27 Aug 2015 17:42:14 +0000 (20:42 +0300)]
Fix key derivation for Suite B 192-bit AKM to use SHA384

While the EAPOL-Key MIC derivation was already changed from SHA256 to
SHA384 for the Suite B 192-bit AKM, KDF had not been updated similarly.
Fix this by using HMAC-SHA384 instead of HMAC-SHA256 when deriving PTK
from PMK when using the Suite B 192-bit AKM.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoMake sure configuration is saved to storage device
Mitchell Wills [Tue, 25 Aug 2015 00:24:30 +0000 (17:24 -0700)]
Make sure configuration is saved to storage device

Config file is written to a temp file and then it is renamed to the
original config file. However, it is possible that the rename operation
will be commited to storage while file data will be still in cache
causing original config file to be empty or partially written in case of
a system reboot without a clean shutdown. Make this less likely to occur
by forcing the data to be written to the storage device before renaming
the file.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
8 years agotests: More WPS ER coverage
Jouni Malinen [Mon, 24 Aug 2015 21:19:52 +0000 (00:19 +0300)]
tests: More WPS ER coverage

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: BSS entry expiration when AP changes SSID
Jouni Malinen [Tue, 25 Aug 2015 17:43:01 +0000 (20:43 +0300)]
tests: BSS entry expiration when AP changes SSID

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoDo not mark BSS entry in use if SSID has changed
Jingxiang Ge [Tue, 25 Aug 2015 17:31:40 +0000 (20:31 +0300)]
Do not mark BSS entry in use if SSID has changed

This allows a BSS entry to be expired if the AP has changed its SSID
while maintaining the same BSSID and we are associated with the BSS.
Previously, the same BSSID was enough to mark all BSS entries from the
BSSID as in use regardless of the SSID and as such, they could remain in
the wpa_supplicant BSS table indefinitely as long as the association
remaining.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoWPS: Fix HTTP body length check
Jouni Malinen [Mon, 24 Aug 2015 21:17:00 +0000 (00:17 +0300)]
WPS: Fix HTTP body length check

Commit 7da4f4b4991c85f1122a4591d8a4b7dd3bd12b4e ('WPS: Check maximum
HTTP body length earlier in the process') added too strict check for
body length allocation. The comparison of new_alloc_nbytes against
h->max_bytes did not take into account that HTTPREAD_BODYBUF_DELTA was
added to previous allocation even if that ended up going beyond
h->max_bytes. This ended up rejecting some valid HTTP operations, e.g.,
when checking AP response to WPS ER setting selected registrar.

Fix this by taking HTTPREAD_BODYBUF_DELTA into account.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Write PKCS#12 extra cert errors into debug log
Jouni Malinen [Mon, 24 Aug 2015 16:36:34 +0000 (19:36 +0300)]
OpenSSL: Write PKCS#12 extra cert errors into debug log

Commit de2a7b796d82d92120aa9532450863f503e1885a ('OpenSSL: Use
connection certificate chain with PKCS#12 extra certs') added a new
mechanism for doing this with OpenSSL 1.0.2 and newer. However, it did
not poinr out anything in debug log if SSL_add1_chain_cert() failed. Add
such a debug print and also silence static analyzer warning on res being
stored without being read (since the error case is ignored at least for
now).

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Catch RTNL assertions in the kernel check
Johannes Berg [Fri, 17 Jul 2015 13:19:02 +0000 (15:19 +0200)]
tests: Catch RTNL assertions in the kernel check

Catch RTNL assertions made by ASSERT_RTNL() in the kernel message
checks.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agotests: EAP-TLS/TTLS/PEAP session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:54:51 +0000 (22:54 +0300)]
tests: EAP-TLS/TTLS/PEAP session resumption

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Enable support for server side TLS session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:08:27 +0000 (22:08 +0300)]
OpenSSL: Enable support for server side TLS session resumption

This allows TLS-based EAP server methods to use session resumption.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-TLS server: Add support for session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:08:02 +0000 (22:08 +0300)]
EAP-TLS server: Add support for session resumption

This allows TLS session resumption to be used to enable abbreviated
handshake.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-TTLS server: Add support for session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:07:47 +0000 (22:07 +0300)]
EAP-TTLS server: Add support for session resumption

This allows TLS session resumption to be used to enable abbreviated
handshake and skipping of Phase 2.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-PEAP server: Add support for session resumption
Jouni Malinen [Sun, 23 Aug 2015 19:06:55 +0000 (22:06 +0300)]
EAP-PEAP server: Add support for session resumption

This allows TLS session resumption to be used to enable abbreviated
handshake and skipping of Phase 2.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP server: Set per-EAP method session context
Jouni Malinen [Sun, 23 Aug 2015 19:05:14 +0000 (22:05 +0300)]
EAP server: Set per-EAP method session context

This can be used to limit TLS session resumption within a TLS library
implementation to apply only for the cases where the same EAP method is
used. While the EAP server method matching will be enforced separately
by EAP server method implementations, this additional steps can optimize
cases by falling back to full authentication instead of having to reject
attempts after having completed session resumption successfully.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS: Add functions for managing cached session state
Jouni Malinen [Sun, 23 Aug 2015 19:01:37 +0000 (22:01 +0300)]
TLS: Add functions for managing cached session state

The new tls_connection_set_success_data(),
tls_connection_set_success_data_resumed(),
tls_connection_get_success_data(), and tls_connection_remove_session()
functions can be used to mark cached sessions valid and to remove
invalid cached sessions. This commit is only adding empty functions. The
actual functionality will be implemented in followup commits.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP server: Add tls_session_lifetime configuration
Jouni Malinen [Sun, 23 Aug 2015 18:26:39 +0000 (21:26 +0300)]
EAP server: Add tls_session_lifetime configuration

This new hostapd configuration parameter can be used to enable TLS
session resumption. This commit adds the configuration parameter through
the configuration system and RADIUS/EAPOL/EAP server components. The
actual changes to enable session caching will be addressed in followup
commits.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP server: Disable TLS session ticket with EAP-TLS/TTLS/PEAP
Jouni Malinen [Sun, 23 Aug 2015 18:22:22 +0000 (21:22 +0300)]
EAP server: Disable TLS session ticket with EAP-TLS/TTLS/PEAP

The EAP server is not yet capable of using TLS session ticket to resume
a session. Explicitly disable use of TLS session ticket with
EAP-TLS/TTLS/PEAP to avoid wasting resources on generating a session
ticket that cannot be used for anything.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Allow server connection parameters to be configured
Jouni Malinen [Sun, 23 Aug 2015 18:14:16 +0000 (21:14 +0300)]
OpenSSL: Allow server connection parameters to be configured

This extends OpenSSL version of tls_connection_set_verify() to support
the new flags argument.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS: Add new arguments to tls_connection_set_verify()
Jouni Malinen [Sun, 23 Aug 2015 18:11:01 +0000 (21:11 +0300)]
TLS: Add new arguments to tls_connection_set_verify()

The new flags and session_ctx arguments will be used in followup
commits.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoOpenSSL: Add wrapper struct for tls_init() result
Jouni Malinen [Sun, 23 Aug 2015 16:22:13 +0000 (19:22 +0300)]
OpenSSL: Add wrapper struct for tls_init() result

This new struct tls_data is needed to store per-tls_init() information
in the followup commits.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoRemove unnecessary NULL check from LOG_LEVEL handler
Jouni Malinen [Fri, 21 Aug 2015 17:02:10 +0000 (20:02 +0300)]
Remove unnecessary NULL check from LOG_LEVEL handler

cmd cannot be NULL here, so there is no need to check it before calling
os_strlen().

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Request fresh scan results after GO Negotiation
Jouni Malinen [Fri, 21 Aug 2015 15:40:23 +0000 (18:40 +0300)]
P2P: Request fresh scan results after GO Negotiation

The P2P group is not yet operating when going through GO Negotiation
exchange. Previously, an old cached scan result could be used to skip
the scan immediately after the GO Negotiation. While this is quite
unlikely to happen in practice, we can easily force a scan here now with
the generic scan_min_time mechanism. Do that to avoid any corner cases
that a previous instance of the group could have if found in cached scan
results.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Require fresh scan results for persistent group re-invocation
Jouni Malinen [Fri, 21 Aug 2015 15:28:28 +0000 (18:28 +0300)]
P2P: Require fresh scan results for persistent group re-invocation

The P2P group is not yet operating when going through invitation
exchange for re-invocation. Previously, an old cached scan result could
be used to skip the scan immediately after the invitation exchange.
While this may result in the fastest possible connection, it does have
some issues with cases where the GO takes some time to start up. It
would also be at least theoretically possible for some of the BSS
parameters to be different, so having a fresh scan result from the new
GO instance may be desired in any case.

Add a mechanism to skip scan results that have been last updated before
a specific point in time and as the first user for this mechanism,
require chan results to be more recent than the invitation message
exchange for the P2P Client role in persistent group re-invocation case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoeapol_test: Add an example controller script for RADIUS testing
Jouni Malinen [Thu, 20 Aug 2015 22:21:18 +0000 (01:21 +0300)]
eapol_test: Add an example controller script for RADIUS testing

This new script can be used as an example of load testing for RADIUS
authentication servers. It can control multiple eapol_test processes
over the control interface to run EAP-TLS authentication. As an example,
the following commands would run eight instances of eapol_test
concurrently:

for i in 0 1 2 3 4 5 6 7; do
    ./eapol_test -T /tmp/eapol_test -i $i > eapol_test.log$i &
done

time ./eapol_test.py --ctrl /tmp/eapol_test --num 8 --iter 100
0: PASS 100
1: PASS 100
2: PASS 100
3: PASS 100
4: PASS 100
5: PASS 100
6: PASS 100
7: PASS 100

real 0m0.339s

time ./eapol_test.py --ctrl /tmp/eapol_test --num 8 --iter 100 --no-fast-reauth
0: PASS 100
1: PASS 100
2: PASS 100
3: PASS 100
4: PASS 100
5: PASS 100
6: PASS 100
7: PASS 100

real 0m1.876s

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoeapol_test: Add a new operation mode for control interface use
Jouni Malinen [Thu, 20 Aug 2015 21:21:20 +0000 (00:21 +0300)]
eapol_test: Add a new operation mode for control interface use

The -T<ctrl_iface> command line argument can now be used to start
eapol_test in mode where the configuration file is not needed and the
authentication operations are started through the control interface.
Network profile is also managed through the control interface in this
case. This can be used to provide more control for scripted RADIUS
authentication server testing.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoeapol_test: Allow interface name to be specified
Jouni Malinen [Thu, 20 Aug 2015 20:13:33 +0000 (23:13 +0300)]
eapol_test: Allow interface name to be specified

The new -i<ifname> command line argument can be used to specify the name
of the interface to use. This is mainly to allow unique control
interface names to be defined without having to use multiple
directories.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: More WPS ER HTTP protocol testing
Jouni Malinen [Tue, 18 Aug 2015 22:36:48 +0000 (01:36 +0300)]
tests: More WPS ER HTTP protocol testing

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Skip TLS OCSP stapling test cases with BoringSSL builds
Jouni Malinen [Tue, 18 Aug 2015 17:02:57 +0000 (20:02 +0300)]
tests: Skip TLS OCSP stapling test cases with BoringSSL builds

BoringSSL removed the OpenSSL API used to implement OCSP stapling
support.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Allow AES-WRAP-192 test cases to be commented out with BoringSSL
Jouni Malinen [Tue, 18 Aug 2015 16:58:13 +0000 (19:58 +0300)]
tests: Allow AES-WRAP-192 test cases to be commented out with BoringSSL

BoringSSL does not support 192-bit AES, so these parts of the
wpa_supplicant module tests would fail.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Allow group 25 to fail in ap_wpa2_eap_pwd_groups with BoringSSL
Jouni Malinen [Tue, 18 Aug 2015 16:52:38 +0000 (19:52 +0300)]
tests: Allow group 25 to fail in ap_wpa2_eap_pwd_groups with BoringSSL

It looks like NID_X9_62_prime192v1 is not available, so allow that group
to fail without failing the full ap_wpa2_eap_pwd_groups test case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Use group 26 instead of 25 in sae_oom_wpas with BoringSSL
Jouni Malinen [Tue, 18 Aug 2015 16:46:56 +0000 (19:46 +0300)]
tests: Use group 26 instead of 25 in sae_oom_wpas with BoringSSL

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>