mech_eap.git
9 years agoTDLS: Decline Setup Request with status code 37 if BSSID does not match
Sunil Dutt [Tue, 2 Sep 2014 13:13:54 +0000 (18:43 +0530)]
TDLS: Decline Setup Request with status code 37 if BSSID does not match

TDLS Setup Request frame has to be rejected with status code 37 ("The
request has been declined"), if the BSSID in the received Link
Identifier does not match the current BSSID per IEEE Std 802.11-2012,
10.22.4 ('TDLS direct-link establishment') step (b). The previously used
status code 7 ('Not in same BSS') is described to used only when
processing TPK Handshake Message 2 in TDLS Setup Response frame.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoTDLS: Add RSN and Timeout interval IEs in TDLS Discovery Response frame
Mahesh A Saptasagar [Thu, 28 Aug 2014 09:22:25 +0000 (14:52 +0530)]
TDLS: Add RSN and Timeout interval IEs in TDLS Discovery Response frame

If RSN is enabled, add RSN and Timeout interval elements in TDLS
Discovery Response frames.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Do not add P2P IEs on P2P disabled interface
Edhar, Mahesh Kumar [Tue, 2 Sep 2014 05:03:44 +0000 (10:33 +0530)]
P2P: Do not add P2P IEs on P2P disabled interface

While building Association Request frame IEs we should consider adding
P2P IEs only on interface where P2P functionality is enabled. Consider
per interface p2p_disabled parameter before adding P2P IEs to complete
the checks for this.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: P2P GO netdev in a bridge
Jouni Malinen [Mon, 1 Sep 2014 13:27:27 +0000 (16:27 +0300)]
tests: P2P GO netdev in a bridge

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Add more RTM_NEWLINK/DELLINK debug messages
Jouni Malinen [Mon, 1 Sep 2014 13:18:01 +0000 (16:18 +0300)]
nl80211: Add more RTM_NEWLINK/DELLINK debug messages

This makes it easier to figure out what operations are generating each
RTM_DELLINK message.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Fix RTM_DELLINK processing for bridge events
Jouni Malinen [Mon, 1 Sep 2014 13:14:07 +0000 (16:14 +0300)]
nl80211: Fix RTM_DELLINK processing for bridge events

When a netdev is removed from a bridge, RTM_DELLINK message is received
with ifname (IFLA_IFNAME) pointing to the main netdev event though that
netdev is not deleted. This was causing issues with P2P GO interface
getting disabled when the netdev was removed from a bridge. Fix this by
filtering RTM_DELLINK events that are related to the bridge when
indicating interface status changes.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: WPS mixed-WPA/WPA2 credential merging
Jouni Malinen [Fri, 29 Aug 2014 17:13:35 +0000 (20:13 +0300)]
tests: WPS mixed-WPA/WPA2 credential merging

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoWPS: Merge mixed-WPA/WPA2 credentials if received in same session
Hu Wang [Fri, 29 Aug 2014 17:11:13 +0000 (20:11 +0300)]
WPS: Merge mixed-WPA/WPA2 credentials if received in same session

Some deployed APs send two credentials when in mixed-WPA/WPA2
configuration; one for the WPA-Personal/TKIP and the other for
WPA2-Personal/CCMP. Previously, this would result in two network blocks
getting added for the single AP. This can be somewhat confusing and
unnecessary, so merge such credentials into a single one that allows
both WPA and WPA2 to be used.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd printf NULL checks to silence static analyzer
Srinivas Girigowda [Thu, 28 Aug 2014 15:25:32 +0000 (18:25 +0300)]
Add printf NULL checks to silence static analyzer

Add NULL checks to take care of issues reported by static analyzer tool
on potentially using NULL with printf format %s (which has undefined
behavior even though many compilers end up printing "(null)").

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Verify that sec_dev_type gets reported for P2P peer
Jouni Malinen [Wed, 27 Aug 2014 13:22:53 +0000 (16:22 +0300)]
tests: Verify that sec_dev_type gets reported for P2P peer

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Overwrite pending interface only after verifying BSS entry
Chandrasekaran, Manishekar [Thu, 14 Aug 2014 11:14:32 +0000 (16:44 +0530)]
P2P: Overwrite pending interface only after verifying BSS entry

Previously, the P2P Interface Address of the peer gets updated in the
peer table every time based on the scan results.

For example, in a two port concurrency scenario, where the peer device
has two interfaces with unique P2P Interface Addresses and with same P2P
Device Address, based on the Probe Response/Beacon frames from these two
interfaces, their peer table gets updated, but each of these updates
happens in the peer table only based on the P2P Device Address. So, the
same peer's P2P Interface address is updated every time and hence, at
any instant, only one P2P Device Address to P2P Interface Address
mapping entry exist in the peer table for the peer which has two
interfaces.

When we try to join a group operated by the peer, lookup happens in the
peer table and when an interface entry is not available, the pending
interface address gets overwritten with the P2P Device Address and hence
the P2P connection can fail. Since the BSS table is the one that is
up-to-date, this fix will ensure that the interface overwriting will
happen only when there is no BSS entry for the pending P2P Interface
Address as well.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: P2P GO channel preference and regulatory rule mismatch
Jouni Malinen [Tue, 26 Aug 2014 14:57:26 +0000 (17:57 +0300)]
tests: P2P GO channel preference and regulatory rule mismatch

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agohostapd: Check that EVENT_ASSOC data is present before using it
Jouni Malinen [Tue, 26 Aug 2014 14:23:02 +0000 (17:23 +0300)]
hostapd: Check that EVENT_ASSOC data is present before using it

While hostapd should not really receive the EVENT_ASSOC message for
IBSS, driver_nl80211.c could potentially generate that if something
external forces the interface into IBSS mode and the IBSS case does not
provide the struct assoc_info data. Avoid the potential NULL pointer
dereference by explicitly verifying for the event data to be present.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agowpa_supplicant: Use freq_list scan filtar in sched_scan
Bojan Prtvar [Mon, 11 Aug 2014 10:25:03 +0000 (12:25 +0200)]
wpa_supplicant: Use freq_list scan filtar in sched_scan

Global freq_list scan filtar was taken into account only by
req_scan and not by req_sched_scan. We want to allow the user
to limit the channels that wpa_supplicant will scan in req_sched_scan
requests as well.

Signed-off-by: Bojan Prtvar <bojan.prtvar@rt-rk.com>
9 years agodbus: Close dbus dict just after appending data
Eduardo Abinader [Sun, 3 Aug 2014 22:48:15 +0000 (18:48 -0400)]
dbus: Close dbus dict just after appending data

Before fixing this issue, calling wpas_dbus_getter_p2p_device_config
was causing early termination of dbus connection, due to writing
values to an already closed dict.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
9 years agonl80211: Disable Probe Request reporting for static AP during deinit
Avinash Patil [Tue, 5 Aug 2014 07:20:53 +0000 (12:50 +0530)]
nl80211: Disable Probe Request reporting for static AP during deinit

Disable Probe Request reporting for statically created AP interfaces
during de-initialization. We will enable it again while starting AP
operations.

Signed-off-by: Avinash Patil <avinashapatil@gmail.com>
9 years agonl80211: Do not change iftype for static AP interface
Avinash Patil [Tue, 5 Aug 2014 07:19:46 +0000 (12:49 +0530)]
nl80211: Do not change iftype for static AP interface

Some devices have limitations which do not allow changing virtual
interface mode from AP to station or vice versa. To work around this,
check if such AP interface is not dynamic. If such an interface is
enumarated, just set ifmode to AP and avoid setting nlmode to default
station mode on deinit.

Signed-off-by: Avinash Patil <avinashapatil@gmail.com>
9 years agowext: Add signal_poll callback
Jean-Marie Lemetayer [Fri, 8 Aug 2014 08:45:00 +0000 (10:45 +0200)]
wext: Add signal_poll callback

Add a basic implementation of a signal_poll callback for wext drivers.

Signed-off-by: Jean-Marie Lemetayer <jeanmarie.lemetayer@gmail.com>
9 years agoP2P: Use ssid instead of wpa_ssid to find GO iface
Eduardo Abinader [Fri, 8 Aug 2014 10:51:23 +0000 (06:51 -0400)]
P2P: Use ssid instead of wpa_ssid to find GO iface

In order to find a GO interface, there has to be a
comparison among two SSIDs, instead of a wpa_ssid and
a ssid.

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
9 years agoAdd RSN cipher/AKM suite attributes into RADIUS messages
Jouni Malinen [Thu, 31 Jul 2014 16:53:25 +0000 (19:53 +0300)]
Add RSN cipher/AKM suite attributes into RADIUS messages

This adds hostapd support for the new WLAN-Pairwise-Cipher,
WLAN-Group-Cipher, WLAN-AKM-Suite, and WLAN-Group-Mgmt-Pairwise-Cipher
attributes defined in RFC 7268. These attributes are added to RADIUS
messages when the station negotiates use of WPA/RSN.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd WLAN-HESSID into RADIUS messages
Jouni Malinen [Thu, 31 Jul 2014 16:11:31 +0000 (19:11 +0300)]
Add WLAN-HESSID into RADIUS messages

This adds hostapd support for the new WLAN-HESSID attribute defined in
RFC 7268. This attribute contains the HESSID and it is added whenever
Interworking is enabled and HESSID is configured.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd Mobility-Domain-Id into RADIUS messages
Jouni Malinen [Thu, 31 Jul 2014 16:00:37 +0000 (19:00 +0300)]
Add Mobility-Domain-Id into RADIUS messages

This adds hostapd support for the new Mobility-Domain-Id attribute
defined in RFC 7268. This attribute contains the mobility domain id and
it is added whenever the station negotiates use of FT.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agodbus: Declare and implement GroupFinished as for GroupStarted
Tomasz Bursztyka [Tue, 8 Jul 2014 12:56:11 +0000 (15:56 +0300)]
dbus: Declare and implement GroupFinished as for GroupStarted

First for better concistancy but also to tell about the group_object
that is getting removed, thus the client will know about it and will be
able to act accordingly.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agoP2P: Cancel pending action TX radio work on p2p_cancel
Jithu Jance [Tue, 29 Jul 2014 13:04:32 +0000 (18:34 +0530)]
P2P: Cancel pending action TX radio work on p2p_cancel

When p2p_cancel is invoked while the GO Negotiation Action TX was
pending, the p2p_send_action_work was not getting cleared.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
9 years agoFix writing of the wowlan_triggers parameter
Philippe Nunes [Wed, 23 Jul 2014 10:16:41 +0000 (12:16 +0200)]
Fix writing of the wowlan_triggers parameter

The parameter wowlan_triggers is a global string and is not recognised
if it is embraced with double-quotes.

Signed-off-by: Philippe Nunes <philippe.nunes@linux.intel.com>
9 years agoAndroid: Always #include <sys/...>, not <linux/...>
Elliott Hughes [Sat, 19 Jul 2014 00:45:49 +0000 (17:45 -0700)]
Android: Always #include <sys/...>, not <linux/...>

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agoEAP-FAST server: Fix potential read-after-buffer (by one byte)
Jouni Malinen [Sat, 26 Jul 2014 18:12:49 +0000 (21:12 +0300)]
EAP-FAST server: Fix potential read-after-buffer (by one byte)

The special PAC_OPAQUE_TYPE_PAD case did not skip incrementing of the
pos pointer and could result in one octet read-after-buffer when parsing
the PAC-Opaque data.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoInterworking: Remove unnecessary placeholder for PAME-BI
Jouni Malinen [Sat, 26 Jul 2014 17:28:03 +0000 (20:28 +0300)]
Interworking: Remove unnecessary placeholder for PAME-BI

The PAME-BI bit in the Advertisement Protocol element is reserved for
non-AP STA, so this function will never set that bit to one and as such,
there is not much point in maintaining the placeholder dead code for
this either. (CID 68107)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: No EAP fast session resumption between network blocks
Jouni Malinen [Sat, 26 Jul 2014 16:31:10 +0000 (19:31 +0300)]
tests: No EAP fast session resumption between network blocks

Verify that EAP fast session resumption is skipped if the connection
uses a different network configuration than the last EAP connection.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP: Do not allow fast session resumption with different network block
Jouni Malinen [Sat, 26 Jul 2014 16:35:02 +0000 (19:35 +0300)]
EAP: Do not allow fast session resumption with different network block

This forces EAP peer implementation to drop any possible fast resumption
data if the network block for the current connection is not the same as
the one used for the previous one. This allows different network blocks
to be used with non-matching parameters to enforce different rules even
if the same authentication server is used. For example, this allows
different CA trust rules to be enforced with different ca_cert
parameters which can prevent EAP-TTLS Phase 2 from being used based on
TLS session resumption.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Remove PSK/passphrase from P2P-GROUP-STARTED debug log entry
Jouni Malinen [Sat, 26 Jul 2014 10:11:34 +0000 (13:11 +0300)]
P2P: Remove PSK/passphrase from P2P-GROUP-STARTED debug log entry

The PSK/passphrase are needed for the control interface events since the
upper layer UI component is required by the specification to be able to
make this available for manual configuration. However, this is not
needed in the INFO verbosity level debug entry, so split the event
generation into two parts.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Use a helper function for P2P_EVENT_GROUP_STARTED events
Jouni Malinen [Sat, 26 Jul 2014 10:09:17 +0000 (13:09 +0300)]
P2P: Use a helper function for P2P_EVENT_GROUP_STARTED events

This makes it easier to change the event message message for indication
when P2P group has stated and removes some duplicated code.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd wpa_msg_global_ctrl()
Jouni Malinen [Sat, 26 Jul 2014 10:04:03 +0000 (13:04 +0300)]
Add wpa_msg_global_ctrl()

This is similar to wpa_msg_global() in the same way as wpa_msg_ctrl() is
to wpa_msg(). In other words, wpa_msg_global_ctrl() is used to send
global control interface events without printing them into the debug
log.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-pwd: Clear identity string and temporary buffer explicitly
Jouni Malinen [Thu, 24 Jul 2014 16:55:15 +0000 (19:55 +0300)]
EAP-pwd: Clear identity string and temporary buffer 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 agoEAP-pwd: Verify BN_rand_range return code
Florent Daigniere [Fri, 27 Jun 2014 10:24:30 +0000 (12:24 +0200)]
EAP-pwd: Verify BN_rand_range return code

This makes the EAP-pwd server and peer implementations more robust
should OpenSSL fail to derive random number for some reason. While this
is unlikely to happen in practice, the implementation better be prepared
for this should something unexpected ever happen. See
http://jbp.io/2014/01/16/openssl-rand-api/#review-of-randbytes-callers
for more details.

Signed-off-by: Florent Daigniere <nextgens@freenetproject.org>
9 years agoEAP-pwd: Use os_memcmp_const() for hash comparisons
Florent Daigniere [Fri, 27 Jun 2014 10:05:47 +0000 (12:05 +0200)]
EAP-pwd: Use os_memcmp_const() for hash 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: Florent Daigniere <nextgens@freenetproject.org>
9 years agoOpenSSL: Use EC_POINT_clear_free instead of EC_POINT_free
Florent Daigniere [Fri, 27 Jun 2014 09:59:45 +0000 (11:59 +0200)]
OpenSSL: Use EC_POINT_clear_free instead of EC_POINT_free

This changes OpenSSL calls to explicitly clear the EC_POINT memory
allocations when freeing them. This adds an extra layer of security by
avoiding leaving potentially private keys into local memory after they
are not needed anymore. While some of these variables are not really
private (e.g., they are sent in clear anyway), the extra cost of
clearing them is not significant and it is simpler to just clear these
explicitly rather than review each possible code path to confirm where
this does not help.

Signed-off-by: Florent Daigniere <nextgens@freenetproject.org>
9 years agoOpenSSL: Use BN_clear_free instead of BN_free
Florent Daigniere [Fri, 27 Jun 2014 09:58:10 +0000 (11:58 +0200)]
OpenSSL: Use BN_clear_free instead of BN_free

This changes OpenSSL calls to explicitly clear the bignum memory
allocations when freeing them. This adds an extra layer of security by
avoiding leaving potentially private keys into local memory after they
are not needed anymore. While some of these variables are not really
private (e.g., they are sent in clear anyway), the extra cost of
clearing them is not significant and it is simpler to just clear these
explicitly rather than review each possible code path to confirm where
this does not help.

Signed-off-by: Florent Daigniere <nextgens@freenetproject.org>
9 years agoHS 2.0R2: Keep backward compatibility with old icu
Dmitry Shmidt [Wed, 16 Jul 2014 17:25:41 +0000 (10:25 -0700)]
HS 2.0R2: Keep backward compatibility with old icu

This allows hs20-osu-client to be build with additional Android
versions.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agoEAP-TTLS: Remove FreeRADIUS workaround for EAP-TTLS/MSCHAPv2
Dmitry Shmidt [Wed, 16 Jul 2014 18:01:26 +0000 (11:01 -0700)]
EAP-TTLS: Remove FreeRADIUS workaround for EAP-TTLS/MSCHAPv2

FreeRADIUS releases before 1.1.4 did not send MS-CHAP2-Success in
EAP-TTLS/MSCHAPv2. A wpa_supplicant workaround for that was added in
2005 and it has been enabled by default to avoid interoperability
issues. This could be disabled with all other EAP workarounds
(eap_workaround=0). However, that will disable some workarounds that are
still needed with number of authentication servers.

Old FreeRADIUS versions should not be in use anymore, so it makes sense
to remove this EAP-TTLS/MSCHAPv2 workaround completely to get more
complete validation of server behavior. This allows MSCHAPv2 to verify
that the server knows the password instead of relying only on the TLS
certificate validation.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agonl80211: Ensure nl_preq unregistration on driver deinit
Cedric IZOARD [Tue, 8 Jul 2014 07:50:32 +0000 (09:50 +0200)]
nl80211: Ensure nl_preq unregistration on driver deinit

When driver interface is destroyed (via wpa_driver_nl80211_deinit) the
"preq" nl socket isn't always deleted but the callback struct associated
is. After the interface is destroyed we may still get event on the
socket but as the callback has been freed this will cause wpa_supplicant
to crash.

This patch ensures that the "preq" socket is destroyed when destroying
the interface.

Signed-off-by: Cedric IZOARD <cedricx.izoard@intel.com>
9 years agotests: P2P vendor specific extensions
Jouni Malinen [Fri, 4 Jul 2014 17:33:01 +0000 (20:33 +0300)]
tests: P2P vendor specific extensions

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Make unrecognized vendor elements available in P2P_PEER
Jouni Malinen [Fri, 4 Jul 2014 17:14:19 +0000 (20:14 +0300)]
P2P: Make unrecognized vendor elements available in P2P_PEER

This allows external programs to use vendor specific information from
P2P peers without wpa_supplicant having to be able to parse and
understand all such vendor specific elements.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd generic mechanism for adding vendor elements into frames
Jouni Malinen [Fri, 4 Jul 2014 15:23:43 +0000 (18:23 +0300)]
Add generic mechanism for adding vendor elements into frames

This adds following new control interface commands to allow arbitrary
vendor elements to be added into number of frames:

VENDOR_ELEM_ADD <frame id> <hexdump of elem(s)>
VENDOR_ELEM_GET <frame id>
VENDOR_ELEM_REMOVE <frame id> <hexdump of elem(s)>
VENDOR_ELEM_REMOVE <frame id> *

The following frames are supported in this commit (additional frames can
be added in the future):

0 = Probe Request frame in P2P device discovery
1 = Probe Response frame from P2P Device role
2 = Probe Response frame from P2P GO
3 = Beacon frame from P2P GO
4 = PD Req
5 = PD Resp
6 = GO Neg Req
7 = GO Neg Resp
8 = GO Neg Conf
9 = Invitation Request
10 = Invitation Response
11 = P2P Association Request
12 = P2P Association Response

One or more vendor element can be added/removed with the commands. The
hexdump of the element(s) needs to contain the full element (id, len,
payload) and the buffer needs to pass IE parsing requirements to be
accepted.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoPNO: Send Probe Request frames only for hidden SSIDs
Dmitry Shmidt [Wed, 2 Jul 2014 19:31:38 +0000 (12:31 -0700)]
PNO: Send Probe Request frames only for hidden SSIDs

Previously, offloaded scanning (PNO) on Android was including SSIDs from
all enabled networks regardless of the scan_ssid parameter which
resulted in different behavior for the offloaded case when comparing to
wpa_supplicant initiated scans.

Use the sched_scan match filter to allow broadcast SSID to be used for
scan_ssid=1 networks also with PNO to avoid running active scans for
SSIDs that have not been explicitly marked as requiring an SSID-specific
scan. This reduces exposure of configured network names on the device
when running offloaded scans while the host device is in sleep.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agoP2P: Add explicit check for ssid->p2p_client_list != NULL
Jouni Malinen [Wed, 2 Jul 2014 21:53:13 +0000 (00:53 +0300)]
P2P: Add explicit check for ssid->p2p_client_list != NULL

This would not really be needed since these functions check the pointer
above. However, this seems to be too difficult for some static analyzer,
so add the extra check to avoid false reports.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoDFS: Remove dead assignment
Jouni Malinen [Wed, 2 Jul 2014 21:51:47 +0000 (00:51 +0300)]
DFS: Remove dead assignment

set_dfs_state() return value is not currently checked anywhere, so
remove the dead assignment to avoid static analyzer complaints.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: update_identifier in network block
Jouni Malinen [Wed, 2 Jul 2014 12:51:20 +0000 (15:51 +0300)]
tests: update_identifier in network block

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoHS 2.0R2: Add update_identifier field to network
Dmitry Shmidt [Mon, 30 Jun 2014 16:59:17 +0000 (09:59 -0700)]
HS 2.0R2: Add update_identifier field to network

This can be used to configure a Hotspot 2.0 Release 2 network externally
for a case where wpa_supplicant-based Interworking network selection is
not used and the update_identifier cannot be copied directly from a
cred.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agoFix some sparse warnings about u16 vs. le16
Jouni Malinen [Wed, 2 Jul 2014 10:12:36 +0000 (13:12 +0300)]
Fix some sparse warnings about u16 vs. le16

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Fix wpas_ctrl_country to match the fixed event data
Jouni Malinen [Wed, 2 Jul 2014 10:33:24 +0000 (13:33 +0300)]
tests: Fix wpas_ctrl_country to match the fixed event data

This test case for enforcing the incorrect init=DRIVER instead of
init=CORE for the event due to bug in the event message.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoFix CTRL-EVENT-REGDOM-CHANGE event init= value
Jouni Malinen [Wed, 2 Jul 2014 10:09:00 +0000 (13:09 +0300)]
Fix CTRL-EVENT-REGDOM-CHANGE event init= value

Incorrect field was used to determine the init=<value> in the regulatory
domain changed control interface event.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoMark function static
Jouni Malinen [Wed, 2 Jul 2014 10:07:44 +0000 (13:07 +0300)]
Mark function static

This function is not used outside this file.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agodbus: Fix indentation level to match code logic
Jouni Malinen [Wed, 2 Jul 2014 10:03:45 +0000 (13:03 +0300)]
dbus: Fix indentation level to match code logic

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoMark functions static
Jouni Malinen [Wed, 2 Jul 2014 10:03:22 +0000 (13:03 +0300)]
Mark functions static

These functions are not used outside this file.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: SCAN scan_id
Jouni Malinen [Tue, 1 Jul 2014 20:57:57 +0000 (23:57 +0300)]
tests: SCAN scan_id

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
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>