]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
5 years agoFILS+FT: AP mode processing of PMKR1Name in initial MD association
Jouni Malinen [Wed, 13 Mar 2019 15:24:29 +0000 (17:24 +0200)] 
FILS+FT: AP mode processing of PMKR1Name in initial MD association

Derive PMKR1Name during the FILS authentication step, verify that the
station uses matching PMKR1Name in (Re)Association Request frame, and
add RSNE[PMKR1Name] into (Re)Association Response frame when going
through FT initial mobility domain association using FILS. These steps
were missed from the initial implementation, but are needed to match the
IEEE 802.11ai requirements for explicit confirmation of the FT key
hierarchy (similarly to what is done in FT 4-way handshake when FILS is
not used).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoFILS: Do not try to add PMKSA cache entry if caching is disabled
Jouni Malinen [Wed, 13 Mar 2019 14:34:48 +0000 (16:34 +0200)] 
FILS: Do not try to add PMKSA cache entry if caching is disabled

This gets rid of a confusing error message "FILS: Failed to add PMKSA
cache entry based on ERP" for cases where PMKSA caching is disabled in
hostapd (disable_pmksa_caching=1). Functionality remains unchanged,
i.e., no cache entry was added before this change either.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoVendor attribute to enable or disable TWT request support
Arif Hussain [Tue, 12 Mar 2019 21:59:48 +0000 (14:59 -0700)] 
Vendor attribute to enable or disable TWT request support

Add a new QCA vendor attribute for testing purposes.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Clear keys from heap memory before freeing it for get_seqnum
vamsi krishna [Wed, 13 Mar 2019 07:03:17 +0000 (12:33 +0530)] 
nl80211: Clear keys from heap memory before freeing it for get_seqnum

NL80211_CMD_GET_KEY response may return the actual key in addition to
the last used sequence number that we need. That might result in a key
being left in unused heap memory after the buffer is freed.

Explicitly clear the message payload with the possibly included key
material from heap memory before returning from the handler function
(and having libnl free the nlmsg) when key information is obtained from
the driver using the NL80211_CMD_GET_KEY command.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoP2P: Fix ACS offloading behavior with p2p_no_group_iface=1
Jayachandran Sreekumaran [Fri, 8 Mar 2019 10:30:56 +0000 (16:00 +0530)] 
P2P: Fix ACS offloading behavior with p2p_no_group_iface=1

wpa_s->p2p_go_do_acs was not cleared during P2P group deletion and that
resulted in the case of no separate group interface continuing to assume
ACS was to be used for consecutive GO starts even if they tried to
specify a frequency. Fix this by explicitly clearing
wpa_s->p2p_go_do_acs during P2P group deletion and also clear this when
processing the P2P_GROUP_ADD if the parameters do not request ACS to be
used.

Fixes: 37ed3254de22 ("P2P: ACS offload for the autonomous GO")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: Exclude PMK when sending NL80211_CMD_DEL_PMKSA explicitly
vamsi krishna [Wed, 13 Mar 2019 07:43:38 +0000 (13:13 +0530)] 
nl80211: Exclude PMK when sending NL80211_CMD_DEL_PMKSA explicitly

Add a check in nl80211 driver layer to not include PMK while sending
NL80211_CMD_DEL_PMKSA explicitly. Though it is taken care already in
supplicant layer by setting the pmk_len to zero, it would be good
to have a check in nl80211 layer in order to avoid future accidental
inclusions of keying material in commands that do not need them.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: DPP and duplicated Authentication Response
Jouni Malinen [Wed, 13 Mar 2019 11:00:33 +0000 (13:00 +0200)] 
tests: DPP and duplicated Authentication Response

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoDPP2: Protocol version indication
Jouni Malinen [Wed, 13 Mar 2019 10:18:01 +0000 (12:18 +0200)] 
DPP2: Protocol version indication

Send out the new Protocol Version attribute in Authentication
Request/Response messages and determine the peer version based on this
attribute.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoDPP2: Build configuration flags for DPP version 2 support
Jouni Malinen [Wed, 13 Mar 2019 10:00:09 +0000 (12:00 +0200)] 
DPP2: Build configuration flags for DPP version 2 support

The new CONFIG_DPP2=y build option for hostapd and wpa_supplicant is
used to control whether new functionality defined after the DPP
specification v1.0 is included. All such functionality are considered
experimental and subject to change without notice and as such, not
suitable for production use.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Make sae_anti_clogging_during_attack more robust
Jouni Malinen [Tue, 12 Mar 2019 15:31:40 +0000 (17:31 +0200)] 
tests: Make sae_anti_clogging_during_attack more robust

Accept a smaller number of token responses in second round to avoid
failing this test case as frequently.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Disable fragm/rts_threshold after testing it
Jouni Malinen [Tue, 12 Mar 2019 15:18:38 +0000 (17:18 +0200)] 
tests: Disable fragm/rts_threshold after testing it

The configurated fragmentation/RTS threshold value survives AP mode
interface restarts, so these values need to be explicitly cleared back
to default (disabled). This fixes an issue where some test cases could
not work correctly if fragmentation on the interface was enabled. For
example, this combination used to fail:
ap_fragmentation_open ap_hs20_fetch_osu

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoAllow fragmentation/RTS threshold to be disabled explicitly
Jouni Malinen [Tue, 12 Mar 2019 15:15:08 +0000 (17:15 +0200)] 
Allow fragmentation/RTS threshold to be disabled explicitly

hostapd configuration parameters fragm_threshold and rts_threshold were
documented to disable the threshold with value -1 and not change driver
configuration if the parameter is not included. However, -1 was mapped
into not changing the driver value, so the explicit disabling part did
not work.

Replace the default values for these to be -2 so that explicitly set
configuration value -1 can be distinguished from the case of not
including the parameter. Map the -1 value to a driver request to disable
the threshold. Ignore any error from this operation just in case to
avoid breaking functionality should some drivers not accept the (u32) -1
value as a threshold value request to disable the mechanism.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Fix scan_specific_bssid in case Beacon frame is seen
Jouni Malinen [Tue, 12 Mar 2019 14:36:46 +0000 (16:36 +0200)] 
tests: Fix scan_specific_bssid in case Beacon frame is seen

The first scan for the unknown BSSID could have been timed in a manner
that allows passive scanning to find the real AP even if that AP's
beacon interval was 1000 (e.g., heavy CPU load changed timing so that
the AP beaconing started at suitable time). The check for BSS result
entry not including Probe Response frame was comparing incorrect BSS
entries (bss2 vs. bss1) which resulted in the test case claiming failure
even when there was no unexpected Probe Response frame.

Fix this by comparing the beacon_ie and ie parameters from the same BSS
entry (bss1).

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Make AP discovery more robust in eap_proto test cases
Jouni Malinen [Tue, 12 Mar 2019 14:24:15 +0000 (16:24 +0200)] 
tests: Make AP discovery more robust in eap_proto test cases

Number of these test cases start connection attempt in wpa_supplicant
and then expected a specific failure to happen relatively quickly. This
could result in timeouts if the first scanning round missed to find the
AP (e.g., due to CPU load pushing out the Probe Response frame long
enough for the station having left the channel) and wpa_supplicant then
waiting five seconds before starting a new scan.

Make this more robust by scanning explicitly for the specific BSSID
before starting the connection attempt.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoAdd a vendor subcommand QCA_NL80211_VENDOR_SUBCMD_MPTA_HELPER_CONFIG
stonez [Wed, 6 Mar 2019 06:17:53 +0000 (14:17 +0800)] 
Add a vendor subcommand QCA_NL80211_VENDOR_SUBCMD_MPTA_HELPER_CONFIG

This subcommand is used to update Zigbee state and specified WLAN
durations to enhance success ratio of Zigbee joining network. The
attributes defined in enum qca_mpta_helper_vendor_attr are used to
deliver these parameters to the driver.

Signed-off-by: stonez <stonez@codeaurora.org>
5 years agoAdd QCA vendor command/event and attributes for peer rate statistics
Amir Patel [Fri, 1 Mar 2019 11:13:35 +0000 (16:43 +0530)] 
Add QCA vendor command/event and attributes for peer rate statistics

Peer rate statistics is per-peer cached data in the driver. These
statistics needs to be flushed to a user space application on
synchronous/asynchronous events. This command is used as an event from
the driver to flush per-peer cached statistics to the application.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: SAE group negotiation (no match)
Jouni Malinen [Mon, 11 Mar 2019 13:41:27 +0000 (15:41 +0200)] 
tests: SAE group negotiation (no match)

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSync with mac80211-next.git include/uapi/linux/nl80211.h
Jouni Malinen [Mon, 11 Mar 2019 22:23:45 +0000 (00:23 +0200)] 
Sync with mac80211-next.git include/uapi/linux/nl80211.h

This brings in nl80211 definitions as of 2019-01-25.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: check_cert_subject
Jouni Malinen [Mon, 11 Mar 2019 11:54:30 +0000 (13:54 +0200)] 
tests: check_cert_subject

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoOpenSSL: Add 'check_cert_subject' support for TLS server
Jared Bents [Thu, 28 Feb 2019 19:39:50 +0000 (13:39 -0600)] 
OpenSSL: Add 'check_cert_subject' support for TLS server

This patch added 'check_cert_subject' support to match the value of
every field against the DN of the subject in the client certificate. If
the values do not match, the certificate verification will fail and will
reject the user.

This option allows hostapd to match every individual field in the right
order, also allow '*' character as a wildcard (e.g OU=Development*).

Note: hostapd will match string up to 'wildcard' against the DN of the
subject in the client certificate for every individual field.

Signed-off-by: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
Signed-off-by: Jared Bents <jared.bents@rockwellcollins.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUse char pointers for EAP configuration parameters without length
Jouni Malinen [Mon, 11 Mar 2019 11:17:29 +0000 (13:17 +0200)] 
Use char pointers for EAP configuration parameters without length

These parameters were using the u8*/len style types even though they
were used as char* strings without an explicit length field. Make this
char* instead of u8* to avoid confusion and unnecessary type casting.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoRemove forgotten os_strncpy() implementations
Jouni Malinen [Sun, 10 Mar 2019 13:55:46 +0000 (15:55 +0200)] 
Remove forgotten os_strncpy() implementations

This was replaced with os_strlcpy() long time ago.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoroboswitch: Check some read operation results
Jouni Malinen [Sat, 9 Mar 2019 16:56:48 +0000 (18:56 +0200)] 
roboswitch: Check some read operation results

This gets rid of some static analyzer warnings about uninitialized
variables being used in comparisons or write operations.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agomesh: Check that SAE state initialization succeeded for PMKID check
Jouni Malinen [Sat, 9 Mar 2019 16:55:58 +0000 (18:55 +0200)] 
mesh: Check that SAE state initialization succeeded for PMKID check

mesh_rsn_auth_sae_sta() might fail, so verify that sta->sae got
allocated before dereferencing it for a PMKID check.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agodefconfig: Enable DBus
Lubomir Rintel [Tue, 19 Feb 2019 13:44:08 +0000 (14:44 +0100)] 
defconfig: Enable DBus

Acquire the new name, along with introspection. This is generally useful
for other daemons to integrate with wpa_supplicant, notably
NetworkManager.

Debian and Fedora (and likely any other distro that configured wireless
via NetworkManager) enable this.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agowpa_supplicant: Drop the old D-Bus interface support
Lubomir Rintel [Tue, 26 Feb 2019 11:04:36 +0000 (12:04 +0100)] 
wpa_supplicant: Drop the old D-Bus interface support

This drops support for the fi.epitest.hostap.WPASupplicant D-Bus name
along with the associated CONFIG_CTRL_IFACE_DBUS option. Nothing should
really be using this since 2010.

This is a just a straightforward removal. Perhaps the dbus_common.c and
dbus_new.c can be merged now. Also, the "_NEW" suffix of the config
option seems to make even less sense than it used to.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agotests: Drop testing of the old D-Bus interface
Lubomir Rintel [Tue, 26 Feb 2019 11:04:36 +0000 (12:04 +0100)] 
tests: Drop testing of the old D-Bus interface

This old interface has been obsoleted and should not have been used
since 2010, so remove testing for it in preparation to dropping the
interface completely from wpa_supplicant.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agotests: Use a helper function for DPP_BOOTSTRAP_GEN commands
Jouni Malinen [Sat, 9 Mar 2019 16:13:10 +0000 (18:13 +0200)] 
tests: Use a helper function for DPP_BOOTSTRAP_GEN commands

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Use a helper function for DPP_QR_CODE commands
Jouni Malinen [Sat, 9 Mar 2019 14:50:48 +0000 (16:50 +0200)] 
tests: Use a helper function for DPP_QR_CODE commands

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: DPP provisioning updating wpa_supplicant configuration file
Jouni Malinen [Sat, 9 Mar 2019 14:23:04 +0000 (16:23 +0200)] 
tests: DPP provisioning updating wpa_supplicant configuration file

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoDPP: Update wpa_supplicant configuration file after provisioning
Jouni Malinen [Sat, 9 Mar 2019 14:21:54 +0000 (16:21 +0200)] 
DPP: Update wpa_supplicant configuration file after provisioning

WPS was already doing this if update_config=1 was set and DPP should be
consistent with that behavior. Update the configuration file if
update_config=1 and dpp_config_processing is set to 1 or 2.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoClarify AP mode Action frame handling
Jouni Malinen [Sat, 9 Mar 2019 10:51:34 +0000 (12:51 +0200)] 
Clarify AP mode Action frame handling

Include only one of hostapd_mgmt_rx() and hostapd_action_rx() functions
in the build. Previously, NEED_AP_MLME builds (i.e., cases where hostapd
AP MLME implementation is included) included both of these functions and
both were tried in sequence. In addition to being difficult to
understand, that could result in unexpected behavior if
hostapd_mgmt_rx() rejected a frame and return 0 to allow
hostapd_action_rx() to attempt to process the frame.

All the operations included in hostapd_action_rx() are supposed to be
available through the hostapd_mgmt_rx() call in handle_action() and
those should result in the exact same Category/Action-based handler
function to be called in the end. As such, this should not result in
different behavior. And if there is a difference, that would be pointing
at a hidden bug that would need to be fixed anyway. Furthermore, builds
without NEED_AP_MLME would not have any difference in behavior or
contents of the binary either.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoMinor cleanup to return after WNM Action frame handling
Jouni Malinen [Sat, 9 Mar 2019 10:43:20 +0000 (12:43 +0200)] 
Minor cleanup to return after WNM Action frame handling

There is no need to go through the following handler calls in
hostapd_action_rx() after having found the matching WLAN_ACTION_WNM
handler.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoMove SA Query frame length check to the shared handler function
Jouni Malinen [Sat, 9 Mar 2019 10:40:05 +0000 (12:40 +0200)] 
Move SA Query frame length check to the shared handler function

Check the length in the common handler functions instead of both
callers.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoFix AP MLME in driver handling of FT and SA Query Action frames
Jouni Malinen [Sat, 9 Mar 2019 10:21:27 +0000 (12:21 +0200)] 
Fix AP MLME in driver handling of FT and SA Query Action frames

hostapd_action_rx() was pointing at incorrect field (Action vs.
Category) for the wpa_ft_action_rx() call and the length check for SA
Query Action frames. This resulted in those frames getting dropped as
invalid (FT) or ignored as truncated (SA Query). Fix this by pointing to
the correct place at the beginning of the frame body.

This issue had a long history. These were broken during cleanup in
commit dbfb8e82ff69 ("Remove unnecessary EVENT_RX_ACTION") which
actually fixed the initial reason for the error accidentally. It was
just that that error was needed to cancel out another earlier error..

One of the errors came from misuse of the EVENT_RX_ACTION API in commit
deca6eff7441 ("atheros: Add new IEEE 802.11r driver_ops"). That pointed
struct rx_action data/len to cover the Action frame from the Category
field to the end of the frame body while the API was documented to cover
Action field to the end of the frame body. This error was cancelled by
another error in commit 88b32a99d308 ("FT: Add FT AP support for drivers
that manage MLME internally") that called wpa_ft_action_rx() with the
struct rx_action::data field as the second argument. That argument needs
to point to the Category field, but that struct rx_action field was
supposed to point to the Action field.

Number of the Action frame handlers added into hostapd_action_rx() had
been fixed more or less accidentally after this in various other
commits, but the FT and SA Query handlers had ended up maintaining the
incorrect operations. This is now fixing those.

This seems to fix at least some cases of FT-over-DS with drivers that
use driver-based AP MLME. Such drivers might use internal SA Query
processing, so it is not clear whether that part actually fixes any real
issues.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Add wlantest description for ap_ft_pmf_*_over_ds
Jouni Malinen [Sat, 9 Mar 2019 09:37:02 +0000 (11:37 +0200)] 
tests: Add wlantest description for ap_ft_pmf_*_over_ds

This is convenient to allow easier examination of the FT Action frames.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Use run_ap_ft_pmf_bip_over_ds() for ap_ft_pmf_over_ds
Jouni Malinen [Sat, 9 Mar 2019 09:33:49 +0000 (11:33 +0200)] 
tests: Use run_ap_ft_pmf_bip_over_ds() for ap_ft_pmf_over_ds

No need to duplicate this functionality when all the ap_ft_pmf_*_over_ds
test cases are doing practically the same thing and the
no-specific-cipher-configuration case can be addressed easily with the
same helper function.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Fix ap_ft_pmf_over_ds
Jouni Malinen [Sat, 9 Mar 2019 09:26:38 +0000 (11:26 +0200)] 
tests: Fix ap_ft_pmf_over_ds

The main step of the test case was accidentally removed when adding the
cipher specific versions.

Fixes: ffcaca68d3ed ("tests: FT with different BIP algorithms")
Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoEAP-pwd server: Fix memory leak with salted passwords
Masashi Honma [Sun, 3 Mar 2019 00:52:22 +0000 (09:52 +0900)] 
EAP-pwd server: Fix memory leak with salted passwords

The struct hostapd_eap_user changes with a new allocated variable were
not covered in the RADIUS server code. Fix this by using eap_user_free()
instead of custom memory freeing operation in radius_server.c.

The hwsim tests with salted password (ap_wpa2_eap_pwd_salt_sha1,
ap_wpa2_eap_pwd_salt_sha256, ap_wpa2_eap_pwd_salt_sha512) triggered
these memory leaks.

Fixes: d52ead3db7b2 ("EAP-pwd server: Add support for salted password databases")
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: Report authentication server memory leaks more visible
Jouni Malinen [Fri, 8 Mar 2019 14:52:52 +0000 (16:52 +0200)] 
tests: Report authentication server memory leaks more visible

It was too easy to miss memory leaks in the hostapd-as-AS log.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Add Finite Cyclic Group field in status code 77 response
Jouni Malinen [Fri, 8 Mar 2019 14:21:03 +0000 (16:21 +0200)] 
SAE: Add Finite Cyclic Group field in status code 77 response

Copy the Finite Cyclic Group field value from the request to the
response Authentication frame if we end up rejecting the request due to
unsupported group.

IEEE Std 802.11-2016 has conflicting statements about this behavior.
Table 9-36 (Presence of fields and elements in Authentication frames)
indicates that the Finite Cyclic Group field is only included with
status code values 0 (success) and 76 (anti-clogging token request)
while SAE protocol description implying that the Finite Cyclic Group
field is set to the rejected group (12.4.8.6.3 and 12.4.8.6.4).

The standard language needs to cleaned up to describe this
unambiguously, but since it looks safe to add the field into the
rejection case and since there is desire to have the field present to be
able to implement what exactly is stated in 12.4.8.6.4, it looks
reasonable to move ahead with the AP mode implementation change. There
is no change in wpa_supplicant for now to modify its behavior based on
whether this field is present, i.e., wpa_supplicant will continue to
work with both the old and new hostapd behavior for SAE group
negotiation.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoEAP-pwd: Fix a memory leak in hunting-and-pecking loop
Jouni Malinen [Wed, 6 Mar 2019 22:27:12 +0000 (00:27 +0200)] 
EAP-pwd: Fix a memory leak in hunting-and-pecking loop

tmp2 (y^2) was derived once in each iteration of the loop and only freed
after all the loop iterations. Fix this by freeing the temporary value
during each iteration.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: WPS with PSK+SAE
Jouni Malinen [Wed, 6 Mar 2019 19:45:19 +0000 (21:45 +0200)] 
tests: WPS with PSK+SAE

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoWPS: Allow SAE configuration to be added automatically for PSK
Jouni Malinen [Wed, 6 Mar 2019 19:44:06 +0000 (21:44 +0200)] 
WPS: Allow SAE configuration to be added automatically for PSK

The new wpa_supplicant configuration parameter wps_cred_add_sae=1 can be
used to request wpa_supplicant to add SAE configuration whenever WPS is
used to provision WPA2-PSK credentials and the credential includes a
passphrase (instead of PSK). This can be used to enable WPA3-Personal
transition mode with both SAE and PSK enabled and also with PMF enabled.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoWPS: Allow AP SAE configuration to be added automatically for PSK
Jouni Malinen [Wed, 6 Mar 2019 19:41:44 +0000 (21:41 +0200)] 
WPS: Allow AP SAE configuration to be added automatically for PSK

The new hostapd configuration parameter wps_cred_add_sae=1 can be used
to request hostapd to add SAE configuration whenever WPS is used to
configure the AP to use WPA2-PSK and the credential includes a
passphrase (instead of PSK). This can be used to enable WPA3-Personal
transition mode with both SAE and PSK enabled and PMF enabled for PSK
and required for SAE associations.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoVendor feature capability for TWT (Target Wake Time)
Sunil Dutt [Thu, 28 Feb 2019 09:04:04 +0000 (14:34 +0530)] 
Vendor feature capability for TWT (Target Wake Time)

Add a new QCA vendor specific feature capability indication for the
device to indicate the support of TWT.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoVendor attribute to indicate a set_blacklist of BSSID only as a hint
Sunil Dutt [Thu, 28 Feb 2019 09:39:29 +0000 (15:09 +0530)] 
Vendor attribute to indicate a set_blacklist of BSSID only as a hint

The current/default behavior of set blacklist BSSID QCA vendor command
is a mandate to the driver - do not consider this BSSID for connect/roam
till reset.

There are use cases where this need not be a mandate and thus could
provide the flexibility for the driver to consider this BSSID if there
are no better ones. Such use cases can use this new flag attribute to
only hint the blacklist of a BSSID to the driver.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoVendor attribute to configure HE testbed default capabilities
Kiran Kumar Lokere [Thu, 28 Feb 2019 01:40:51 +0000 (17:40 -0800)] 
Vendor attribute to configure HE testbed default capabilities

Add a new QCA vendor attribute for testing purposes.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoVendor attribute to configure support to enable VHT in 2.4G band
Kiran Kumar Lokere [Wed, 6 Feb 2019 01:04:24 +0000 (17:04 -0800)] 
Vendor attribute to configure support to enable VHT in 2.4G band

Add a new QCA vendor attribute for testing purposes.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoVendor attribute to configure HE OMI UL MU data disable
Kiran Kumar Lokere [Wed, 6 Feb 2019 00:59:27 +0000 (16:59 -0800)] 
Vendor attribute to configure HE OMI UL MU data disable

Add a new QCA vendor attribute for testing purposes.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: SAE anti clogging during an attack
Jouni Malinen [Sun, 3 Mar 2019 15:10:40 +0000 (17:10 +0200)] 
tests: SAE anti clogging during an attack

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Reuse previously generated PWE on a retry with the same STA
Jouni Malinen [Sun, 3 Mar 2019 14:56:14 +0000 (16:56 +0200)] 
SAE: Reuse previously generated PWE on a retry with the same STA

Do not start SAE authentication from scratch if a STA starts a new
attempt for the same group while we still have previously generated PWE
available. Instead, use the previously generated PWE as-is and skip
anti-clogging token exchange since the heavy processing is already
completed. This saves unnecessary processing on the AP side in case the
STA failed to complete authentication on the first attempt (e.g., due to
heavy SAE load on the AP causing a timeout) and makes it more likely for
a valid STA to be able to complete SAE authentication during a DoS
attack.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Reuse previously generated PWE on a retry with the same AP
Jouni Malinen [Sun, 3 Mar 2019 14:23:19 +0000 (16:23 +0200)] 
SAE: Reuse previously generated PWE on a retry with the same AP

Do not start SAE authentication from scratch when the AP requests
anti-clogging token to be used. Instead, use the previously generated
PWE as-is if the retry is for the same AP and the same group. This saves
unnecessary processing on the station side in case the AP is under heavy
SAE authentiation load.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Enforce single use for anti-clogging tokens
Jouni Malinen [Fri, 1 Mar 2019 20:05:52 +0000 (22:05 +0200)] 
SAE: Enforce single use for anti-clogging tokens

Add a 16-bit token index into the anti-clogging token. This can be used
to enforce only a single use of each issued anti-clogging token request.
The token value is now token-index |
last-30-octets-of(HMAC-SHA256(sae_token_key, STA-MAC-address |
token-index)), i.e., the first two octets of the SHA256 hash value are
replaced with the token-index and token-index itself is protected as
part of the HMAC context data.

Track the used 16-bit token index values and accept received tokens only
if they use an index value that has been requested, but has not yet been
used. This makes it a bit more difficult for an attacker to perform DoS
attacks against the heavy CPU operations needed for processing SAE
commit since the attacker cannot simply replay the same frame multiple
times and instead, needs to request each token separately.

While this does not add significant extra processing/CPU need for the
attacker, this can be helpful in combination with the queued processing
of SAE commit messages in enforcing more delay during flooding of SAE
commit messages since the new anti-clogging token values are not
returned before the new message goes through the processing queue.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Process received commit message through a queue
Jouni Malinen [Fri, 1 Mar 2019 17:54:51 +0000 (19:54 +0200)] 
SAE: Process received commit message through a queue

This allows better control of processing new SAE sessions so that other
operations can be given higher priority during bursts of SAE requests,
e.g., during a potential DoS attack. The receive commit messages are
queued (up to maximum of 15 entries) and processed from eloop callback.
If the queue has multiple pending entries, more wait time is used to go
through the each new entry to reduce heavy CPU load from SAE processing.

Enable anti-clogging token use also based on the pending commit message
queue and not only based on the already started sessions.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: More complete group list for sae_groups
Jouni Malinen [Wed, 6 Mar 2019 11:05:23 +0000 (13:05 +0200)] 
tests: More complete group list for sae_groups

Add group 1 for completeness sake and also and Brainpool groups with
OpenSSL 1.1.*.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Enable only groups 19, 20, and 21 in station mode
Jouni Malinen [Tue, 5 Mar 2019 15:23:58 +0000 (17:23 +0200)] 
SAE: Enable only groups 19, 20, and 21 in station mode

Remove groups 25 (192-bit Random ECP Group) and 26 (224-bit Random ECP
Group) from the default SAE groups in station mode since those groups
are not as strong as the mandatory group 19 (NIST P-256).

In addition, add a warning about MODP groups 1, 2, 5, 22, 23, and 24
based on "MUST NOT" or "SHOULD NOT" categorization in RFC 8247. All the
MODP groups were already disabled by default and would have needed
explicit configuration to be allowed.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoSAE: Enable only group 19 by default in AP mode
Jouni Malinen [Tue, 5 Mar 2019 15:18:11 +0000 (17:18 +0200)] 
SAE: Enable only group 19 by default in AP mode

Change the AP mode default for SAE to enable only the group 19 instead
of enabling all ECC groups that are supported by the used crypto library
and the SAE implementations. The main reason for this is to avoid
enabling groups that are not as strong as the mandatory-to-support group
19 (i.e., groups 25 and 26). In addition, this disables heavier groups
by default.

In addition, add a warning about MODP groups 1, 2, 5, 22, 23, and 24
based on "MUST NOT" or "SHOULD NOT" categorization in RFC 8247. All the
MODP groups were already disabled by default and would have needed
explicit configuration to be allowed.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Enable needed SAE groups explicitly in sae_oom_wpas
Jouni Malinen [Tue, 5 Mar 2019 15:13:35 +0000 (17:13 +0200)] 
tests: Enable needed SAE groups explicitly in sae_oom_wpas

Configure the sae_groups parameter for hostapd explicitly in preparation
for the default value change in the implementation.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Enable needed SAE groups explicitly in sigma_dut_sae
Jouni Malinen [Tue, 5 Mar 2019 15:12:44 +0000 (17:12 +0200)] 
tests: Enable needed SAE groups explicitly in sigma_dut_sae

Configure the sae_groups parameter for hostapd explicitly in preparation
for the default value change in the implementation.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoAdd explicit checks for peer's DH public key
Jouni Malinen [Tue, 5 Mar 2019 15:05:03 +0000 (17:05 +0200)] 
Add explicit checks for peer's DH public key

Pass the group order (if known/specified) to crypto_dh_derive_secret()
(and also to OpenSSL DH_generate_key() in case of Group 5) and verify
that the public key received from the peer meets 1 < pubkey < p and
pubkey^q == 1 mod p conditions.

While all these use cases were using only ephemeral DH keys, it is
better to use more explicit checks while deriving the shared secret to
avoid unexpected behavior.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agobignum: Fix documentation for bignum_cmp_d()
Jouni Malinen [Tue, 5 Mar 2019 14:10:33 +0000 (16:10 +0200)] 
bignum: Fix documentation for bignum_cmp_d()

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: FT-SAE with Password Identifier
Jouni Malinen [Tue, 26 Feb 2019 18:39:54 +0000 (20:39 +0200)] 
tests: FT-SAE with Password Identifier

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: More robust connect command testing
Jouni Malinen [Mon, 25 Feb 2019 19:58:28 +0000 (21:58 +0200)] 
tests: More robust connect command testing

Avoid an invalid failure case due to scan results being left behind from
connect_cmd_bssid_hint when executing connect_cmd_reject_assoc by
explicitly clearing the scan results from dev5. This fixes an error case
that happened with the following test case sequence:
connect_cmd_bssid_hint connect_cmd_reject_assoc

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Make MACsec test cases clear monitor socket more thoroughly
Jouni Malinen [Mon, 25 Feb 2019 19:40:23 +0000 (21:40 +0200)] 
tests: Make MACsec test cases clear monitor socket more thoroughly

The wpas (dev5) control interface socket did not always get cleared in
the MACsec test cases and this could result in issues with following
test cases if the dev5 message queue hit the maximum limit.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agodefconfig: Enable IEEE 802.11w management frame protection (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:19 +0000 (14:44 +0100)] 
defconfig: Enable IEEE 802.11w management frame protection (wpa_supplicant)

NetworkManager can use these if available and the distros generally
enable this already.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: enable IEEE 802.11r fast BSS transition (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:18 +0000 (14:44 +0100)] 
defconfig: enable IEEE 802.11r fast BSS transition (wpa_supplicant)

Generally useful. Linux distros already enable these, upcoming
NetworkManager will support it too.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Enable IEEE 802.11n and 802.11ac (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:17 +0000 (14:44 +0100)] 
defconfig: Enable IEEE 802.11n and 802.11ac (wpa_supplicant)

I guess there's no reason anyone with capable hardware wouldn't want to
enable these. Debian and Fedora aleady do.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Enable Hotspot 2.0 (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:16 +0000 (14:44 +0100)] 
defconfig: Enable Hotspot 2.0 (wpa_supplicant)

Generally useful, Debian enables this. Other distros should too.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Enable RSN on IBSS networks (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:15 +0000 (14:44 +0100)] 
defconfig: Enable RSN on IBSS networks (wpa_supplicant)

Fedora and Debian enable this. NetworkManager actually rejects such
configurations citing kernel bugs, but that actually might not be the
right thing to do anymore.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Remove obsolete notes about OpenSSL requirements for EAP-FAST
Jouni Malinen [Mon, 25 Feb 2019 17:29:02 +0000 (19:29 +0200)] 
defconfig: Remove obsolete notes about OpenSSL requirements for EAP-FAST

OpenSSL 0.9.8 reached its end-of-life long time ago, so remove these old
notes about need of a newer OpenSSL version for EAP-FAST since all
current OpenSSL versions include the needed functionality.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agodefconfig: Enable a handful of EAP methods (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:14 +0000 (14:44 +0100)] 
defconfig: Enable a handful of EAP methods (wpa_supplicant)

Fedora uses AKA, FAST, GPSK_SHA256, GPSK, IKEV2, PAX, SAKE and TNC. I
don't know why these in particular. AKA wouldn't work, because
CONFIG_PCSC is off anyways; let's enable all the other ones, and also
PWD (openSUSE enabled it because users demanded it).

Debian enables all of the above uses, but also PWD, AKA_PRIME, SIM, PSK
and EKE.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Enable logging to file and syslog (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:12 +0000 (14:44 +0100)] 
defconfig: Enable logging to file and syslog (wpa_supplicant)

Debian and Fedora enable both and log to syslog. openSUSE seems to log
to a flat file instead.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Enable simple bgscan module (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:11 +0000 (14:44 +0100)] 
defconfig: Enable simple bgscan module (wpa_supplicant)

Generally useful. Linux distros enable this and also utilize it via
NetworkManager.

Debian also enables the learn module. I'm leaving it off as it's marked
experimental.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Enable AP (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:10 +0000 (14:44 +0100)] 
defconfig: Enable AP (wpa_supplicant)

Generally useful. Debian and Fedora enable this and support creating
access points via NetworkManager too.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Enable WPS (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:09 +0000 (14:44 +0100)] 
defconfig: Enable WPS (wpa_supplicant)

WPS is generally useful with consumer hardware, and exposed to desktop
users via NetworkManager.

The Linux distros, including Debian, Fedora, and openSUSE enable it.
Debian also enables external registar support and NFC.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Fix typos in Wi-Fi Display description
Jouni Malinen [Mon, 25 Feb 2019 17:18:32 +0000 (19:18 +0200)] 
defconfig: Fix typos in Wi-Fi Display description

These were supposed to be talking about Wi-Fi Display, not Wi-Fi Direct.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agodefconfig: Enable P2P and Wi-Fi Display (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:07 +0000 (14:44 +0100)] 
defconfig: Enable P2P and Wi-Fi Display (wpa_supplicant)

Generally useful. Debian and Fedora enable this, upcoming NetworkManager
provide some level of support too.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Add SAE (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:06 +0000 (14:44 +0100)] 
defconfig: Add SAE (wpa_supplicant)

Generally useful and the distros (Debian, Fedora) enable this already to
support WPA3-Personal and protected 802.11s mesh BSSs.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agodefconfig: Add DPP (wpa_supplicant)
Lubomir Rintel [Tue, 19 Feb 2019 13:44:05 +0000 (14:44 +0100)] 
defconfig: Add DPP (wpa_supplicant)

Generally useful, already enabled in Debian and Fedora.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agotests: Remove CONFIG_PEERKEY
Lubomir Rintel [Tue, 19 Feb 2019 13:44:04 +0000 (14:44 +0100)] 
tests: Remove CONFIG_PEERKEY

The functionality has been removed in commit a0bf1b68c03 ('Remove all
PeerKey functionality').

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agoUBSan: Avoid a warning on unsigned integer overflow
Jouni Malinen [Mon, 25 Feb 2019 00:57:41 +0000 (02:57 +0200)] 
UBSan: Avoid a warning on unsigned integer overflow

wpa_non_pref_chan_cmp() needs to use explicit typecasts to avoid UBSan
warnings for unsigned integer overflows.

mbo.c:298:26: runtime error: unsigned integer overflow: 1 - 2 cannot be represented in type 'unsigned int'

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: libFuzzer integration for test-json and test-x509
Jouni Malinen [Sun, 24 Feb 2019 16:52:54 +0000 (18:52 +0200)] 
tests: libFuzzer integration for test-json and test-x509

Allow these test tools to be used with libFuzzer in addition to
afl-fuzz.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoFix a regression from VLAN assignment using WPA/WPA2 passphrase/PSK
Jouni Malinen [Sat, 23 Feb 2019 16:54:54 +0000 (18:54 +0200)] 
Fix a regression from VLAN assignment using WPA/WPA2 passphrase/PSK

This extension of VLAN assignment code had a bug in one of the code
paths where vlan_id could have been left uninitialized. This could
result in SAE authentication getting rejected in cases where VLAN
assignment is not used if the uninitialized stack memory had nonzero
value.

Fixes: dbfa691df4dc ("VLAN assignment based on used WPA/WPA2 passphrase/PSK")
Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Avoid a warning on signed left shift
Jouni Malinen [Sat, 23 Feb 2019 16:43:38 +0000 (18:43 +0200)] 
UBSan: Avoid a warning on signed left shift

Use unsigned 1 (1U) instead of signed (1) when doing left shift that
could potentially need to use all bits of the 32-bit unsigned variable.

radius_server.c:2254:14: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Split loop index decrementation into a separate step
Jouni Malinen [Sat, 23 Feb 2019 16:14:29 +0000 (18:14 +0200)] 
UBSan: Split loop index decrementation into a separate step

Avoid an unnecessary unsigned integer overflow warning due to loop index
j-- use.

hostapd.c:661:10: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned int'

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoatheros: Avoid clang compiler warning on address of array check
Jouni Malinen [Sat, 23 Feb 2019 16:02:16 +0000 (18:02 +0200)] 
atheros: Avoid clang compiler warning on address of array check

ie.wps_ie is an array, so there is no point in checking whether it is
NULL.

driver_atheros.c:1221:9: error: address of array 'ie.wps_ie' will
      always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoAvoid compiler warning about potentially unaligned pointer value
Jouni Malinen [Sat, 23 Feb 2019 15:57:23 +0000 (17:57 +0200)] 
Avoid compiler warning about potentially unaligned pointer value

(&mgmt->u.deauth.reason_code + 1) is not exactly clean and now that we
have the u8 variable[] member in the struct after this field, use that
directly to avoid clang compiler warning:
ctrl_iface_ap.c:454:18: error: taking address of packed member
      'reason_code' of class or structure 'ieee80211_mgmt::(anonymous
      union)::(anonymous)' may result in an unaligned pointer value
      [-Werror,-Waddress-of-packed-member]

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Define FST LLT macros without integer overflow
Jouni Malinen [Sat, 23 Feb 2019 15:39:38 +0000 (17:39 +0200)] 
UBSan: Define FST LLT macros without integer overflow

FST_MAX_LLT_MS definition depended on undefined behavior with unsigned
integer overflow. Avoid that and also optimize the
FST_LLT_{MS_TO_VAL,VAL_TO_MS} macros to handle larger values without
overflowing 32-bit unsigned integers.

fst_session.c:1274:52: runtime error: unsigned integer overflow: 4294967295 * 32 cannot be represented in type 'unsigned int'

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Avoid integer overflow in a loop index counter
Jouni Malinen [Sat, 23 Feb 2019 14:28:16 +0000 (16:28 +0200)] 
UBSan: Avoid integer overflow in a loop index counter

Split the check and decrementation into separate steps to avoid an
unnecessary UBSan warning.

hostapd.c:1895:14: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Avoid NULL pointer dereferences on an error path
Jouni Malinen [Sat, 23 Feb 2019 14:24:19 +0000 (16:24 +0200)] 
UBSan: Avoid NULL pointer dereferences on an error path

hapd->conf might be NULL in case initialized failed, so better be
prepared for that when debug printing interface name in the deinit path.

hostapd.c:312:54: runtime error: member access within null pointer of type 'struct hostapd_bss_config'
hostapd.c:351:29: runtime error: member access within null pointer of type 'struct hostapd_bss_config'
hostapd.c:2158:18: runtime error: member access within null pointer of type 'struct hostapd_bss_config'

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Avoid unsigned integer overflow in base64 encoding
Jouni Malinen [Sat, 23 Feb 2019 14:09:31 +0000 (16:09 +0200)] 
UBSan: Avoid unsigned integer overflow in base64 encoding

Add a constraint on the base64 encoded buffer length to avoid an integer
overflow in the output length calculation.

common.c:1087:16: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Avoid unsigned integer overflow in utf8_{,un}escape()
Jouni Malinen [Sat, 23 Feb 2019 14:03:47 +0000 (16:03 +0200)] 
UBSan: Avoid unsigned integer overflow in utf8_{,un}escape()

Split the if/while loop condition into two independent steps so that
in_size-- happens only in the case in_size is nonzero. This gets rid of
unnecessary UBSan warnings.

common.c:1087:16: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
common.c:1076:16: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')
common.c:1119:16: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'size_t' (aka 'unsigned long')

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Avoid unnecessary warning
Jouni Malinen [Sat, 23 Feb 2019 12:03:59 +0000 (14:03 +0200)] 
UBSan: Avoid unnecessary warning

elems->mic might be NULL here, so do not try to decrement it by 2 even
if the result is not used anywhere due to a latter check for elems->mic
being NULL.

mesh_rsn.c:646:20: runtime error: pointer index expression with base 0x000000000000 overflowed to 0xfffffffffffffffe

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Avoid memcpy(ptr, NULL, 0)
Jouni Malinen [Sat, 23 Feb 2019 12:01:25 +0000 (14:01 +0200)] 
UBSan: Avoid memcpy(ptr, NULL, 0)

This results in an UBSan warning that can be avoided easily.

os_unix.c:524:3: runtime error: null pointer passed as argument 2, which is declared to never be null

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Avoid an unsigned integer overflow warning
Jouni Malinen [Sat, 23 Feb 2019 11:57:51 +0000 (13:57 +0200)] 
UBSan: Avoid an unsigned integer overflow warning

ext_supp_rates_len would be 0 here, so decrementing it by 2 will result
in unsigned integer overflow even if that result is not actually used
anywhere. Avoid that to get rid of the UBSan warning.

tdls.c:1597:27: runtime error: unsigned integer overflow: 0 - 2 cannot be represented in type 'unsigned long'

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Pack MACsec peer id structure
Jouni Malinen [Sat, 23 Feb 2019 11:54:33 +0000 (13:54 +0200)] 
UBSan: Pack MACsec peer id structure

This is needed to avoid an UBSan warning and since this struct is used
as part of a message construction, it needs to be packed anyway to
guarantee correct functionality.

ieee802_1x_kay.c:1021:3: runtime error: member access within misaligned address 0x0000031921e2 for type 'struct ieee802_1x_mka_peer_id', which requires 4 byte alignment

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Avoid memcmp(ptr, NULL, 0)
Jouni Malinen [Sat, 23 Feb 2019 11:50:47 +0000 (13:50 +0200)] 
UBSan: Avoid memcmp(ptr, NULL, 0)

Skip the memcmp() call if ssid_len == 0 and entry->ssid might be NULL to
avoid an UBSan warning.

wpa_supplicant.c:3956:9: runtime error: null pointer passed as argument 2, which is declared to never be null

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Use typecast to avoid unsigned integer overflow
Jouni Malinen [Sat, 23 Feb 2019 11:44:20 +0000 (13:44 +0200)] 
UBSan: Use typecast to avoid unsigned integer overflow

iface->num_bss is unsigned integer, so need to explicit typecast it to
unsigned before decrementation by one even when the result is stored in
an unsigned integer.

../src/ap/hostapd.c:2185:26: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned long'

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUBSan: Fix RRM beacon processing attempt without scan_info
Jouni Malinen [Sat, 23 Feb 2019 10:59:10 +0000 (12:59 +0200)] 
UBSan: Fix RRM beacon processing attempt without scan_info

Some driver interfaces (e.g., wext) might not include the
data->scan_info information and data could be NULL here. Do not try to
call the RRM handler in this case since that would dereference the NULL
pointer when determining where scan_info is located and could
potentially result in trying to read from unexpected location if RRM is
enabled with a driver interface that does not support it.

events.c:1907:59: runtime error: member access within null pointer of type 'union wpa_event_data'

Signed-off-by: Jouni Malinen <j@w1.fi>