mech_eap.git
9 years agoAllow SCAN command to specify scan_ssid=1 SSIDs
Li Jianyun [Tue, 1 Jul 2014 15:22:56 +0000 (23:22 +0800)]
Allow SCAN command to specify scan_ssid=1 SSIDs

The new "scan_id=<comma separated list of network ids>" parameter can
now be used to specify a list of network ids that have scan_ssid=1 to
indicate active scanning of the SSID. This adds the listed SSIDs to the
scan command to allow manual scan requests to perform active scans for
hidden SSIDs. For example, "SCAN scan_id=1,7,11" would run a scan with
the SSID fetched from the configured network blocks 1, 7, and 11
(assuming those are set with scan_ssid=1). The SSIDs will be included
even from network blocks that are currently disabled.

The maximum number of SSIDs added to the request is limited by the
driver support. If more than supported values are specified, the command
will fail (returns "FAIL").

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoWPS: Clear keys/PINs explicitly
Jouni Malinen [Tue, 1 Jul 2014 22:46:45 +0000 (01:46 +0300)]
WPS: Clear keys/PINs explicitly

Use an explicit memset call to clear any configuration parameter and
dynamic data that contains private information like keys or identity.
This brings in an additional layer of protection by reducing the length
of time this type of private data is kept in memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoClear hostapd configuration keys explicitly
Jouni Malinen [Tue, 1 Jul 2014 22:45:45 +0000 (01:45 +0300)]
Clear hostapd configuration keys explicitly

Use an explicit memset call to clear any hostapd configuration parameter
that contains private information like keys or identity. This brings in
an additional layer of protection by reducing the length of time this
type of private data is kept in memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoHS 2.0 R2: Clear hs20-osu-client configuration keys explicitly
Jouni Malinen [Tue, 1 Jul 2014 22:43:33 +0000 (01:43 +0300)]
HS 2.0 R2: Clear hs20-osu-client configuration keys explicitly

Use an explicit memset call to clear any hs20-osu-client configuration
parameter that contains private information like keys or identity. This
brings in an additional layer of protection by reducing the length of
time this type of private data is kept in memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP server: Clear keying material on deinit
Jouni Malinen [Sun, 29 Jun 2014 22:48:41 +0000 (01:48 +0300)]
EAP server: Clear keying material on deinit

Reduce the amount of time keying material (MSK, EMSK, temporary private
data) remains in memory in EAP methods. This provides additional
protection should there be any issues that could expose process memory
to external observers.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP peer: Clear keying material on deinit
Jouni Malinen [Sun, 29 Jun 2014 18:16:30 +0000 (21:16 +0300)]
EAP peer: Clear keying material on deinit

Reduce the amount of time keying material (MSK, EMSK, temporary private
data) remains in memory in EAP methods. This provides additional
protection should there be any issues that could expose process memory
to external observers.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoClear wpa_supplicant configuration keys explicitly
Jouni Malinen [Sun, 29 Jun 2014 22:32:07 +0000 (01:32 +0300)]
Clear wpa_supplicant configuration keys explicitly

Use an explicit memset call to clear any wpa_supplicant configuration
parameter that contains private information like keys or identity. This
brings in an additional layer of protection by reducing the length of
time this type of private data is kept in memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-AKA: Remove unnecessary dead increment
Jouni Malinen [Sun, 29 Jun 2014 22:47:44 +0000 (01:47 +0300)]
EAP-AKA: Remove unnecessary dead increment

The pos pointer is not used after this now nor in future plans, so no
need to increment the value. This remove a static analyzer warning about
dead increment.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-GPSK: Avoid dead increment by checking pos pointer
Jouni Malinen [Sun, 29 Jun 2014 22:46:42 +0000 (01:46 +0300)]
EAP-GPSK: Avoid dead increment by checking pos pointer

Instead of using the pre-calculated length of the buffer, determine the
length of used data based on the pos pointer. This avoids a static
analyzer warning about dead increment.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFT: Debug print extra response data
Jouni Malinen [Sun, 29 Jun 2014 22:45:26 +0000 (01:45 +0300)]
FT: Debug print extra response data

This shows any extra data from FT response and also avoids a static
analyzer warning on dead increment.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoPCSC: Debug print extra response data
Jouni Malinen [Sun, 29 Jun 2014 22:44:33 +0000 (01:44 +0300)]
PCSC: Debug print extra response data

This shows any extra data from USIM response and also avoids a static
analyzer warning on dead increment.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoInterworking: Remove unnecessary dead increment
Jouni Malinen [Sun, 29 Jun 2014 22:08:49 +0000 (01:08 +0300)]
Interworking: Remove unnecessary dead increment

build_root_nai() will not be extended to write something after the
domain, so there is no need to update the pos pointer after the final
os_snprintf() call in the function. Remove this to make a static
analyzer happier.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoCheck for no key_mgmt/proto/auth_alg entries in config writer
Jouni Malinen [Sun, 29 Jun 2014 21:56:27 +0000 (00:56 +0300)]
Check for no key_mgmt/proto/auth_alg entries in config writer

This is not really necessary check, but it keeps a static analyzer
happier by avoiding dead increment. Doing it this way rather than
removing the increment is less likely to cause problems when new entries
are added here in the future (the "dead" increment would be very much
needed in those cases).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRemove unnecessary tracking of first entry
Jouni Malinen [Sun, 29 Jun 2014 21:50:40 +0000 (00:50 +0300)]
Remove unnecessary tracking of first entry

The pointer to the current position is enough to figure out whether the
proto string is the first one in the buffer. Removing the separate
tracking variable cleans up a static analyzer warning on dead
assignment.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWFD: Explicit limit for subelement length (CID 68127)
Jouni Malinen [Sun, 29 Jun 2014 21:43:28 +0000 (00:43 +0300)]
WFD: Explicit limit for subelement length (CID 68127)

This adds an explicit limit for the maximum Wi-Fi Display subelement
length for ASCII hexdump. This would not really be needed since the
buffer is already limited by maximum frame length. Anyway, since this
can make static analyzers happier and the subelement used with this
function is short, we may as well include an explicit check.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoHS 2.0: Verify assoc_req_ie buffer size for indication elements
Jouni Malinen [Sun, 29 Jun 2014 21:32:12 +0000 (00:32 +0300)]
HS 2.0: Verify assoc_req_ie buffer size for indication elements

While the buffer is expected to be large enough for all the IEs, it is
better to check for this explicitly when adding the HS 2.0 Indication
element. (CID 68601)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoSAE: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:28:25 +0000 (20:28 +0300)]
SAE: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWEP shared key: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:27:45 +0000 (20:27 +0300)]
WEP shared key: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-GTC: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:26:25 +0000 (20:26 +0300)]
EAP-GTC: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-MSCHAPv2: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:25:36 +0000 (20:25 +0300)]
EAP-MSCHAPv2: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-TTLS: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:25:05 +0000 (20:25 +0300)]
EAP-TTLS: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-MD5: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:24:41 +0000 (20:24 +0300)]
EAP-MD5: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-PSK: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:24:10 +0000 (20:24 +0300)]
EAP-PSK: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-PEAP: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:22:44 +0000 (20:22 +0300)]
EAP-PEAP: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-LEAP: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:22:17 +0000 (20:22 +0300)]
EAP-LEAP: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-GPSK: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:21:59 +0000 (20:21 +0300)]
EAP-GPSK: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-PAX: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:21:31 +0000 (20:21 +0300)]
EAP-PAX: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-FAST: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:21:03 +0000 (20:21 +0300)]
EAP-FAST: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-EKE: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:20:28 +0000 (20:20 +0300)]
EAP-EKE: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-SAKE: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:19:59 +0000 (20:19 +0300)]
EAP-SAKE: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-SIM/AKA: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:19:19 +0000 (20:19 +0300)]
EAP-SIM/AKA: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-IKEv2: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:18:40 +0000 (20:18 +0300)]
EAP-IKEv2: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoTLS: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:18:00 +0000 (20:18 +0300)]
TLS: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoMilenage: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:17:14 +0000 (20:17 +0300)]
Milenage: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAES-GCM: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:16:58 +0000 (20:16 +0300)]
AES-GCM: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAES-CCM: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:16:39 +0000 (20:16 +0300)]
AES-CCM: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAPOL supplicant: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:16:10 +0000 (20:16 +0300)]
EAPOL supplicant: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRSN authenticator: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:15:37 +0000 (20:15 +0300)]
RSN authenticator: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRSN supplicant: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:15:07 +0000 (20:15 +0300)]
RSN supplicant: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoMACsec: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:14:17 +0000 (20:14 +0300)]
MACsec: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRADIUS: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 17:13:01 +0000 (20:13 +0300)]
RADIUS: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWPS: Use os_memcmp_const() for hash/password comparisons
Jouni Malinen [Sun, 29 Jun 2014 16:38:17 +0000 (19:38 +0300)]
WPS: Use os_memcmp_const() for hash/password comparisons

This makes the implementation less likely to provide useful timing
information to potential attackers from comparisons of information
received from a remote device and private material known only by the
authorized devices.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd constant time memory comparison function os_memcmp_const
Jouni Malinen [Sun, 29 Jun 2014 16:33:19 +0000 (19:33 +0300)]
Add constant time memory comparison function os_memcmp_const

This function is meant for comparing passwords or hash values where
difference in execution time could provide external observer information
about the location of the difference in the memory buffers. The return
value does not behave like os_memcmp(), i.e., os_memcmp_const() cannot
be used to sort items into a defined order. Unlike os_memcmp(),
execution time of os_memcmp_const() does not depend on the contents of
the compared memory buffers, but only on the total compared length.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-pwd: Add explicit total length limit
Jouni Malinen [Sun, 29 Jun 2014 15:52:09 +0000 (18:52 +0300)]
EAP-pwd: Add explicit total length limit

Instead of using implicit limit based on 16-bit unsigned integer having
a maximum value of 65535, limit the maximum length of a fragmented
EAP-pwd message explicitly to 15000 bytes. None of the supported groups
use longer messages, so it is fine to reject any longer message without
even trying to reassemble it. This will hopefully also help in reducing
false warnings from static analyzers (CID 68124).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-SIM/AKA: Pass EAP type as argument to eap_sim_msg_finish()
Jouni Malinen [Sun, 29 Jun 2014 15:46:29 +0000 (18:46 +0300)]
EAP-SIM/AKA: Pass EAP type as argument to eap_sim_msg_finish()

This makes it easier for static analyzers to figure out which code paths
are possible within eap_sim_msg_finish() for EAP-SIM. This will
hopefully avoid some false warnings (CID 68110, CID 68113, CID 68114).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoPeerKey: Clean up EAPOL-Key Key Data processing
Jouni Malinen [Sun, 29 Jun 2014 15:32:12 +0000 (18:32 +0300)]
PeerKey: Clean up EAPOL-Key Key Data processing

This extends the earlier commit e6270129f6ac06c319480c409ee7013a1ad33127
('Clean up EAPOL-Key Key Data processing') design to be used with
PeerKey EAPOL-key processing as well. This avoids false warnings from
static analyzer (CID 62860, CID 62861, CID 62862).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agodbus: Clean up array-array-type property getter
Jouni Malinen [Sun, 29 Jun 2014 15:20:13 +0000 (18:20 +0300)]
dbus: Clean up array-array-type property getter

The previously used design was a bit too complex for static analyzers
(e.g., CID 68131, CID 68133) to understand which resulted in false
warnings about uninitialized memory. Avoid this by explicitly
initializing the pointer array to NULL and also skipping any invalid
NULL entry in the helper function.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agodbus: Add PropertiesChanged signal to Peer object
Tomasz Bursztyka [Mon, 2 Jun 2014 14:42:08 +0000 (17:42 +0300)]
dbus: Add PropertiesChanged signal to Peer object

This signal will be thrown when a Peer joins or leaves a group.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agoP2P: Add a utility function to run a method on every known peer
Tomasz Bursztyka [Mon, 2 Jun 2014 14:42:07 +0000 (17:42 +0300)]
P2P: Add a utility function to run a method on every known peer

This will be useful in wpa_supplicant part to signal if a peer got its
group changed.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agodbus: Remove GroupMember object type and use Peer instead
Tomasz Bursztyka [Mon, 2 Jun 2014 14:42:06 +0000 (17:42 +0300)]
dbus: Remove GroupMember object type and use Peer instead

GroupMember is unusable in itself and all the necessary informations are
stored in Peer objects, thus replace the use of GroupMember by Peer.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agodbus: Add a Groups property to a Peer object on which it belongs
Tomasz Bursztyka [Mon, 2 Jun 2014 14:42:05 +0000 (17:42 +0300)]
dbus: Add a Groups property to a Peer object on which it belongs

If only the Peer is part of one or more group, this property will tell
those via listing their object paths.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agoP2P: Add utility functions to get GO/client interface
Tomasz Bursztyka [Mon, 2 Jun 2014 14:42:04 +0000 (17:42 +0300)]
P2P: Add utility functions to get GO/client interface

This will be useful for a peer to know if it is part of a group either
as a client of our local GO or as the peer GO.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agoP2P Add a utility to run a callback on all available groups
Tomasz Bursztyka [Mon, 2 Jun 2014 14:42:03 +0000 (17:42 +0300)]
P2P Add a utility to run a callback on all available groups

This will be useful in wpa_supplicant to match group's SSIDs against a
specific one.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agoP2P: Add a utility function to get the group configuration
Tomasz Bursztyka [Mon, 2 Jun 2014 14:42:02 +0000 (17:42 +0300)]
P2P: Add a utility function to get the group configuration

This will be useful for finding the interface related to this group
after formation based on the group SSID.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agoTDLS: Clean up add/set peer operations
Jouni Malinen [Sun, 29 Jun 2014 09:29:50 +0000 (12:29 +0300)]
TDLS: Clean up add/set peer operations

Use a helper function to avoid multiple copies of the same long list of
argument parameters to wpa_sm_tdls_peer_addset() from the peer entry.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoTDLS: Tear down connection on malformed Setup Confirm
Arik Nemtsov [Wed, 25 Jun 2014 14:41:55 +0000 (17:41 +0300)]
TDLS: Tear down connection on malformed Setup Confirm

Otherwise the peer will erroneously assume we have a working direct
link.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Abort local setup when failing to add STA
Arik Nemtsov [Wed, 25 Jun 2014 14:41:54 +0000 (17:41 +0300)]
TDLS: Abort local setup when failing to add STA

The driver might not always be able to add the new station. Abort the
setup when this happens.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Update peer STA as soon as full peer info is available
Arik Nemtsov [Wed, 25 Jun 2014 14:41:53 +0000 (17:41 +0300)]
TDLS: Update peer STA as soon as full peer info is available

Update the peer STA with full info sending TDLS Setup Response/Confirm
frames instead of after the full setup exchange. This makes it easier
for some drivers to properly negotiate QoS and HT information on the
direct link.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Remove peer from global peer-list on free
Arik Nemtsov [Wed, 25 Jun 2014 14:41:52 +0000 (17:41 +0300)]
TDLS: Remove peer from global peer-list on free

There is no need to keep the peer entry in memory after the link has
been removed.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
Tested-by: Ilan Peer <ilan.peer@intel.com>
9 years agohostapd: Use channel switch fallback on error
Michal Kazior [Fri, 27 Jun 2014 12:19:30 +0000 (14:19 +0200)]
hostapd: Use channel switch fallback on error

It's worth giving a try to fallback to re-starting BSSes at least once
hoping it works out instead of just leaving BSSes disabled.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
9 years agohostapd: Perform multi-BSS CSA for DFS properly
Michal Kazior [Fri, 27 Jun 2014 12:19:29 +0000 (14:19 +0200)]
hostapd: Perform multi-BSS CSA for DFS properly

Currently hostapd data structures aren't ready for multi-channel BSSes,
so make DFS work now at least with single-channel multi-BSS channel
switching.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
9 years agohostapd: Make chan_switch command per-interface not per-BSS
Michal Kazior [Fri, 27 Jun 2014 12:19:28 +0000 (14:19 +0200)]
hostapd: Make chan_switch command per-interface not per-BSS

Currently hostapd data structures aren't ready for multi-channel BSSes,
so make the command work now at least with single-channel multi-BSS
channel switching.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
9 years agohostapd: Move CSA parameters to hostapd_data
Michal Kazior [Fri, 27 Jun 2014 12:19:27 +0000 (14:19 +0200)]
hostapd: Move CSA parameters to hostapd_data

This prepares CSA structure and logic in hostapd for multi-BSS channel
switching.

Signed-hostap: Michal Kazior <michal.kazior@tieto.com>

9 years agoeapol_test: Fix -R option to not replace -s option value
Dmitry Shmidt [Mon, 23 Jun 2014 19:13:20 +0000 (12:13 -0700)]
eapol_test: Fix -R option to not replace -s option value

Commit e9852462d58750e2ec4be498e82db0e0a2dfaf7f ('eapol_test: Add PC/SC
reader and PIN command line arguments') did not add break to the switch
statement for the new -R command line option.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agoChange channel before IBSS associations
Christopher Wiley [Thu, 26 Jun 2014 20:13:07 +0000 (13:13 -0700)]
Change channel before IBSS associations

Fix a bug where changing the mode of the interface to IBSS
fails because the interface is sitting on a channel where IBSS is
disallowed because of a previous association.

Signed-off-by: Christopher Wiley <wiley@chromium.org>
9 years agonl80211: Refactor mode switch logic
Christopher Wiley [Thu, 26 Jun 2014 20:13:06 +0000 (13:13 -0700)]
nl80211: Refactor mode switch logic

In preparation for another wrinkle around switching into IBSS mode,
refactor existing mode switch logic for simplicity at the expense
of some brevity.

Signed-off-by: Christopher Wiley <wiley@chromium.org>
9 years agonl80211: Improve debug output by printing SA and DA in frames
Pontus Fuchs [Tue, 3 Jun 2014 08:24:54 +0000 (10:24 +0200)]
nl80211: Improve debug output by printing SA and DA in frames

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
9 years agoPrint frame type name in debug output
Pontus Fuchs [Tue, 3 Jun 2014 08:24:53 +0000 (10:24 +0200)]
Print frame type name in debug output

"stype=4" becomes "stype=4 (WLAN_FC_STYPE_PROBE_REQ)" etc.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
9 years agonl80211: Use low-priority scan for OBSS scan
Johannes Berg [Wed, 4 Jun 2014 09:21:40 +0000 (11:21 +0200)]
nl80211: Use low-priority scan for OBSS scan

Some drivers may support low-priority scans, if they do then
use that for OBSS scanning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agotests: P2P passphrase length configuration
Jouni Malinen [Sat, 21 Jun 2014 21:17:18 +0000 (00:17 +0300)]
tests: P2P passphrase length configuration

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Allow passphrase length to be configured
Jouni Malinen [Sat, 21 Jun 2014 21:15:53 +0000 (00:15 +0300)]
P2P: Allow passphrase length to be configured

Previously, eight character random passphrase was generated
automatically for P2P GO. The new p2p_passphrase_len parameter can be
used to increase this length to generate a stronger passphrase for cases
where practicality of manual configuration of legacy devices is not a
concern.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoeapol_test: Add PC/SC reader and PIN command line arguments
Jouni Malinen [Sat, 21 Jun 2014 19:46:28 +0000 (22:46 +0300)]
eapol_test: Add PC/SC reader and PIN command line arguments

The new command line arguments -R<reader> and -P<PIN> can now be used to
specify which PC/SC reader (prefix match) and PIN are to be used.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoUse pcsc_reader configuration in one for scard_init() call
Jouni Malinen [Sat, 21 Jun 2014 19:45:31 +0000 (22:45 +0300)]
Use pcsc_reader configuration in one for scard_init() call

This allows PC/SC reader to be identified with the pcsc_reader
configuration parameter.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: EAP-SIM/AKA/AKA' protocol tests
Jouni Malinen [Fri, 20 Jun 2014 17:58:54 +0000 (20:58 +0300)]
tests: EAP-SIM/AKA/AKA' protocol tests

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: EAP-SIM external_sim error cases
Jouni Malinen [Sat, 21 Jun 2014 16:26:04 +0000 (19:26 +0300)]
tests: EAP-SIM external_sim error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-SIM': Fix AT_KDF parser to avoid infinite loop
Jouni Malinen [Sat, 21 Jun 2014 09:18:56 +0000 (12:18 +0300)]
EAP-SIM': Fix AT_KDF parser to avoid infinite loop

Hitting maximum number of AT_KDF attributes could result in an infinite
loop due to the attribute parser not incrementing the current position
properly when skipping the extra KDF.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: EAP-AKA external_sim error cases
Jouni Malinen [Sat, 21 Jun 2014 08:21:12 +0000 (11:21 +0300)]
tests: EAP-AKA external_sim error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-SIM/AKA: Remove unused RESULT_FAILURE state
Jouni Malinen [Fri, 20 Jun 2014 21:25:40 +0000 (00:25 +0300)]
EAP-SIM/AKA: Remove unused RESULT_FAILURE state

This was not set anywhere, so remove the unnecessary code trying to
handle the unused state.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: EAP-SIM/AKA invalid Milenage key configuration
Jouni Malinen [Fri, 20 Jun 2014 07:54:22 +0000 (10:54 +0300)]
tests: EAP-SIM/AKA invalid Milenage key configuration

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: SA Query rate limiting on burst of unprotected Deauth
Jouni Malinen [Thu, 19 Jun 2014 17:59:46 +0000 (20:59 +0300)]
tests: SA Query rate limiting on burst of unprotected Deauth

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoRate limit SA Query procedure initiation on unprotected disconnect
Jouni Malinen [Thu, 19 Jun 2014 17:56:32 +0000 (20:56 +0300)]
Rate limit SA Query procedure initiation on unprotected disconnect

There is no need to trigger new SA Query procedure to check the state of
the connection immediately after having performed such a check. Limit
the impact of burst of unprotected Deauth/Disassoc frames by starting a
new SA Query procedure only once at least 10 seconds has passed from the
previous SA Query that was triggered by reception of an unprotected
disconnection. The first SA Query procedure for each association does
not follow this rule to avoid issues with test cases that expect to see
an SA Query every time.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoEAP-GPSK: Clean up CSuite_List length validation (CID 62854)
Jouni Malinen [Wed, 18 Jun 2014 14:14:59 +0000 (17:14 +0300)]
EAP-GPSK: Clean up CSuite_List length validation (CID 62854)

Use a local variable and size_t in length comparison to make this easier
for static analyzers to understand. In addition, set the return list and
list_len values at the end of the function, i.e., only in success case.
These do not change the actual behavior of the only caller for this
function, but clarifies what the helper function is doing.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-FAST: Clean up TLV length validation (CID 62853)
Jouni Malinen [Wed, 18 Jun 2014 13:42:15 +0000 (16:42 +0300)]
EAP-FAST: Clean up TLV length validation (CID 62853)

Use size_t instead of int for storing and comparing the TLV length
against the remaining buffer length to make this easier for static
analyzers to understand.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoVHT: Remove useless validation code from Operating Mode Notification
Jouni Malinen [Tue, 17 Jun 2014 21:45:48 +0000 (00:45 +0300)]
VHT: Remove useless validation code from Operating Mode Notification

This was added by commit 8a45811638d3d5c913175c4b8fc17a9bff0178e1
('hostapd: Add Operating Mode Notification support'), but the validation
steps cannot be true either for the channel width (which is a two-bit
subfield that cannot encode more than the list four values) or Rx NSS
(which cannot encode a value larger 7). Furthermore, the VHT_CHANWIDTH_*
defines do not match the definition of the Channel Width subfield
values.

Since this check cannot ever match, it is better to remove it to make
the code easier to understand and to avoid getting complaints about dead
code from static analyzers.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: EAP-PSK protocol test cases
Jouni Malinen [Tue, 17 Jun 2014 21:13:56 +0000 (00:13 +0300)]
tests: EAP-PSK protocol test cases

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoTDLS: Do not bail when failing to process IEs in Discovery Request
Arik Nemtsov [Tue, 10 Jun 2014 18:19:10 +0000 (21:19 +0300)]
TDLS: Do not bail when failing to process IEs in Discovery Request

Some APs (Cisco) may tack on a weird IE to the end of a TDLS Discovery
Request packet. This needn't fail the response, since the required IEs
are verified separately.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Do not reject TPK M3 when failing to process IEs
Arik Nemtsov [Tue, 10 Jun 2014 18:19:07 +0000 (21:19 +0300)]
TDLS: Do not reject TPK M3 when failing to process IEs

Some APs (Cisco) may tack on a weird IE to the end of the TDLS confirm
packet, which can fail negotiation. As an interoperability workaround,
ignore IE parser failures and reject the frame only if any of the
mandatory IEs are not included.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Fix TPK M1 error case (CID 68214)
Jouni Malinen [Mon, 16 Jun 2014 22:55:36 +0000 (01:55 +0300)]
TDLS: Fix TPK M1 error case (CID 68214)

Commit 342bce63cdb375bc64ce1cbcdb9e6f48acdea1e3 introduced a possibility
of a NULL pointer dereference on the error path if a new peer entry
fails to get added (i.e., memory allocation failure). Fix that by
skipping the wpa_tdls_peer_free() call if necessary.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Fix non-hostapd interface addition to not call add_ifidx()
Jithu Jance [Mon, 16 Jun 2014 21:40:55 +0000 (00:40 +0300)]
nl80211: Fix non-hostapd interface addition to not call add_ifidx()

Commit b36935be1a14341771b0fd5491808c3f6fdcb603 ('nl80211: Fix EAPOL
frames not being delivered') and commit
147848ec4d26613d5a117d4b35dbc7ff98dd65d1 ('nl80211: Do not add all
virtual interfaces to drv->if_indices') were not fully in sync and it
was possible for some non-hostapd use cases to end up adding undesired
ifindexes into the list of interfaces from which events and EAPOL frames
are processed on the parent interface. This could result, e.g., in P2P
Device management interface on getting unexpected events, including
RTM_NEWLINK event that could end up getting interpreted as an
indication of the interface being down and unavailable.

Make both add_ifidx() calls use the same criteria for adding interfaces
to the local list. This is not really a complete solution, but it is
good enough for now to fix the most visible side effects of this issue.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
9 years agoTDLS: Add ctrl_iface option for flushing all TDLS peers
Arik Nemtsov [Tue, 10 Jun 2014 18:19:08 +0000 (21:19 +0300)]
TDLS: Add ctrl_iface option for flushing all TDLS peers

"TDLS_TEARDOWN *" can now be used to tear down the direct links to all
TDLS peers. This is useful for debugging purposes.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Bail on STA add failure in tpk_m1 processing
Arik Nemtsov [Tue, 10 Jun 2014 18:19:05 +0000 (21:19 +0300)]
TDLS: Bail on STA add failure in tpk_m1 processing

The driver might not be able to add the TDLS STA. Fail if this happens.
Also fix the error path to always reset the TDLS peer data.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Handle unreachable link teardown for external setup
Arik Nemtsov [Tue, 10 Jun 2014 18:19:04 +0000 (21:19 +0300)]
TDLS: Handle unreachable link teardown for external setup

If a link is unreachable, the specification mandates we should send a
teardown packet via the AP with a specific teardown reason. Force this
by first disabling the link and only then sending the teardown packet
for the LOW_ACK event.

Rename the TDLS LOW_ACK event handler to better reflect its purpose.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agotests: Make concurrent_grpform_while_connecting2 more robust
Jouni Malinen [Mon, 16 Jun 2014 14:07:25 +0000 (17:07 +0300)]
tests: Make concurrent_grpform_while_connecting2 more robust

It was possible for this test case to fail due to PBC overlap that was
detected based on previous test case having used PBC. Make that false
positive less likely to happen by explicitly clearing the scan cache on
dev[1].

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agohostapd: Configure driver ACL even if MAC address list is empty
Amarnath Hullur Subramanyam [Mon, 16 Jun 2014 13:22:36 +0000 (16:22 +0300)]
hostapd: Configure driver ACL even if MAC address list is empty

Earlier commit related to MAC address based access control list
offloaded to the driver was not sending ACL configuration to the driver
if the MAC address list was empty. Remove this check as empty access
control list is a valid use case and sending ACL parameters should not
be dependent on whether the list is empty.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoFix CONFIG_MODULE_TESTS=y build without CONFIG_P2P=y
Jouni Malinen [Sun, 15 Jun 2014 16:35:22 +0000 (19:35 +0300)]
Fix CONFIG_MODULE_TESTS=y build without CONFIG_P2P=y

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Clean up by moving ifdef CONFIG_P2P to p2p_suppplicant.h
Jouni Malinen [Sun, 15 Jun 2014 16:31:53 +0000 (19:31 +0300)]
P2P: Clean up by moving ifdef CONFIG_P2P to p2p_suppplicant.h

This removes number of unnecessary #ifdef CONFIG_P2P blocks from generic
code by hiding the conditional build into p2p_supplicant.h with empty
inline functions.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: EAP protocol test cases
Jouni Malinen [Sun, 15 Jun 2014 16:01:59 +0000 (19:01 +0300)]
tests: EAP protocol test cases

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: EAP-PAX protocol test cases
Jouni Malinen [Sun, 15 Jun 2014 14:36:53 +0000 (17:36 +0300)]
tests: EAP-PAX protocol test cases

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: GO configured preferred channels are disallowed
Avraham Stern [Tue, 10 Jun 2014 17:50:38 +0000 (20:50 +0300)]
tests: GO configured preferred channels are disallowed

Verify that when all configured preferred channels are disallowed,
the GO is instantiated on a random channel.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
9 years agoP2P: Use another interface operating channel as listen channel
Ilan Peer [Mon, 19 May 2014 07:05:39 +0000 (10:05 +0300)]
P2P: Use another interface operating channel as listen channel

Performing a P2P Device flow such as p2p_listen or
p2p_find, can degrade the performance of an active interface
connection, if the listen frequency is different than the
frequency used by that interface.

To reduce the effect of P2P Device flows on other interfaces,
try changing the listen channel of the P2P Device to match the
operating channel of one of the other active interfaces. This change
will be possible only in case that the listen channel is not forced
externally, and will be delayed to a point where the P2P Device
state machine is idle.

The optimization can be configured in the configuration file and
is disabled by default.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>