]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
4 years agoFix WNM-Sleep Mode exit debug print of BIGTK
Jouni Malinen [Wed, 24 Mar 2021 22:30:04 +0000 (00:30 +0200)] 
Fix WNM-Sleep Mode exit debug print of BIGTK

Previous debug print used IGTK instead of BIGTK, so fix that to use the
correct key. Actual generation of the BIGTK subelement itself was using
the correct key, though, so this is only needed to fix the debug print.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Re-enable op class 118-120 tests with new regdb
Jouni Malinen [Tue, 23 Mar 2021 22:51:10 +0000 (00:51 +0200)] 
tests: Re-enable op class 118-120 tests with new regdb

Move from RS to PA country code to allow these test cases to work since
regdb was updated to require DFS for these operating classes in RS.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: hostapd configuration with op_class
Jouni Malinen [Tue, 23 Mar 2021 22:46:57 +0000 (00:46 +0200)] 
tests: hostapd configuration with op_class

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: DPP PFS error cases
Jouni Malinen [Tue, 23 Mar 2021 22:05:05 +0000 (00:05 +0200)] 
tests: DPP PFS error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: MSCS
Jouni Malinen [Mon, 22 Mar 2021 22:38:45 +0000 (00:38 +0200)] 
tests: MSCS

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoMSCS: Fix MSCS Response frame Status field parsing
Jouni Malinen [Mon, 22 Mar 2021 22:30:49 +0000 (00:30 +0200)] 
MSCS: Fix MSCS Response frame Status field parsing

This is a 2 octet field, so need to use WPA_GET_LE16() here instead of
using only the first octet of the value.

Fixes: bbd3178af45b ("MSCS: Add support to process MSCS Response frames")
Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoAdd REGISTER_FRAME hostapd control interface command for testing purposes
Jouni Malinen [Mon, 22 Mar 2021 10:32:16 +0000 (12:32 +0200)] 
Add REGISTER_FRAME hostapd control interface command for testing purposes

This can be used to register reception of new types of Management frames
through nl80211.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoAllow AP mode extended capabilities to be overridden
Jouni Malinen [Mon, 22 Mar 2021 09:29:31 +0000 (11:29 +0200)] 
Allow AP mode extended capabilities to be overridden

The new hostapd configuration parameters ext_capa_mask and ext_capa can
now be used to mask out or add extended capability bits. While this is
not without CONFIG_TESTING_OPTIONS, the main use case for this is for
testing purposes.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoMake hostapd_config_fill() easier to auto indent
Jouni Malinen [Mon, 22 Mar 2021 09:33:16 +0000 (11:33 +0200)] 
Make hostapd_config_fill() easier to auto indent

The conditional compilation block with only the opening brace included
in two variants was messing up auto indentation in emacs. Work around
this by defining the maximum value conditionally while leave the if
block outside any conditional building rules.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoSimplify extended capability determination in AP mode
Jouni Malinen [Mon, 22 Mar 2021 09:12:39 +0000 (11:12 +0200)] 
Simplify extended capability determination in AP mode

There is no need to determine the exact length of the element before
filling in the octets since this function is already capable of
truncated the fields based on what the actual values are.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoPASN: Use a helper function to free radio work data
Jouni Malinen [Sun, 21 Mar 2021 16:33:17 +0000 (18:33 +0200)] 
PASN: Use a helper function to free radio work data

This is safer in avoiding memory leaks now that there is a dynamically
allocated member within the data struct.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoPASN: Mark pubkey/comeback arguments constant for frame construction
Jouni Malinen [Sun, 21 Mar 2021 16:30:52 +0000 (18:30 +0200)] 
PASN: Mark pubkey/comeback arguments constant for frame construction

These parameters are only copied to the frame, so mark them as constant.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Add PASN tests with comeback flow
Ilan Peer [Sun, 21 Mar 2021 11:55:10 +0000 (13:55 +0200)] 
tests: Add PASN tests with comeback flow

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoPASN: Add support for comeback flow to wpa_supplicant
Ilan Peer [Sun, 21 Mar 2021 11:55:09 +0000 (13:55 +0200)] 
PASN: Add support for comeback flow to wpa_supplicant

Process the received comeback cookie and retry automatically if the AP
allows this. Otherwise, provide the cookie to upper layers to allow a
later attempt with the cookie.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoPASN: Add support for comeback flow in AP mode
Ilan Peer [Sun, 21 Mar 2021 11:55:08 +0000 (13:55 +0200)] 
PASN: Add support for comeback flow in AP mode

Reuse the SAE anti-clogging token implementation to support similar
design with the PASN comeback cookie.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agotests: DPP NFC operation failures in hostapd
Jouni Malinen [Sun, 21 Mar 2021 14:55:44 +0000 (16:55 +0200)] 
tests: DPP NFC operation failures in hostapd

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: DPP bootstrapping via NFC URI record (hostapd reading tag)
Jouni Malinen [Sun, 21 Mar 2021 14:39:46 +0000 (16:39 +0200)] 
tests: DPP bootstrapping via NFC URI record (hostapd reading tag)

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: DPP GAS Query error cases with hostapd
Jouni Malinen [Sun, 21 Mar 2021 11:18:00 +0000 (13:18 +0200)] 
tests: DPP GAS Query error cases with hostapd

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoDPP: Fix GAS client error case handling in hostapd
Jouni Malinen [Sun, 21 Mar 2021 09:47:39 +0000 (11:47 +0200)] 
DPP: Fix GAS client error case handling in hostapd

The GAS client processing of the response callback for DPP did not
properly check for GAS query success. This could result in trying to
check the Advertisement Protocol information in failure cases where that
information is not available and that would have resulted in
dereferencing a NULL pointer. Fix this by checking the GAS query result
before processing with processing of the response.

This is similar to the earlier wpa_supplicant fix in commit 931f7ff65609
("DPP: Fix GAS client error case handling").

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoEAP-SIM/AKA: Fix check for anonymous decorated identity
Jouni Malinen [Sat, 20 Mar 2021 14:25:50 +0000 (16:25 +0200)] 
EAP-SIM/AKA: Fix check for anonymous decorated identity

eap_sim_anonymous_username() gets called with an argument that is not a
null terminated C string and as such, os_strrchr() and os_strlen()
cannot be used with it. The previous implementation resulted in use of
uninitialized values and a potential read beyond the end of the buffer.

Credit to OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32277
Fixes: 73d9891bd722 ("EAP-SIM/AKA peer: Support decorated anonymous identity prefix")
Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoDPP: Indicate authentication success on ConfReqRX if needed (hostapd)
Jouni Malinen [Sat, 20 Mar 2021 14:09:19 +0000 (16:09 +0200)] 
DPP: Indicate authentication success on ConfReqRX if needed (hostapd)

It is possible to receive the Configuration Request frame before having
seen TX status for the Authentication Confirm. In that sequence, the
DPP-AUTH-SUCCESS event would not be indicated before processing the
configuration step and that could confuse upper layers that follow the
details of the DPP exchange. As a workaround, indicate DPP-AUTH-SUCCESS
when receiving the Configuration Request since the Enrollee/Responser
has clearly receive the Authentication Confirm even if the TX status for
it has not been received.

This was already done in wpa_supplicant in commit 422e73d623b4 ("DPP:
Indicate authentication success on ConfReqRX if needed") and matching
changes are now added to hostapd.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: PMKSA cache add failure
Jouni Malinen [Sat, 20 Mar 2021 11:38:49 +0000 (13:38 +0200)] 
tests: PMKSA cache add failure

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoFix full EAP authentication after PMKSA cache add failure
Jouni Malinen [Sat, 20 Mar 2021 11:36:55 +0000 (13:36 +0200)] 
Fix full EAP authentication after PMKSA cache add failure

Need to get EAP state machine into a state where it is willing to
proceed with a new EAP-Request/Identity if PMKSA cache addition fails
after a successful EAP authentication before the initial 4-way handshake
can be completed.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: hostapd ctrl_iface SET_NEIGHBOR failures
Jouni Malinen [Sat, 20 Mar 2021 11:13:24 +0000 (13:13 +0200)] 
tests: hostapd ctrl_iface SET_NEIGHBOR failures

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: DPP and hostapd as Enrollee with GAS fragmentation/timeout
Jouni Malinen [Sat, 20 Mar 2021 10:24:50 +0000 (12:24 +0200)] 
tests: DPP and hostapd as Enrollee with GAS fragmentation/timeout

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: DPP connection status - success with hostapd as Configurator
Jouni Malinen [Sat, 20 Mar 2021 10:19:12 +0000 (12:19 +0200)] 
tests: DPP connection status - success with hostapd as Configurator

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoDPP2: Fix connection status result wait in hostapd
Jouni Malinen [Sat, 20 Mar 2021 10:17:58 +0000 (12:17 +0200)] 
DPP2: Fix connection status result wait in hostapd

The waiting_conn_status_result flag was not set which made hostapd
discard the Connection Status Result. Fix this to match the
wpa_supplicant implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: hostapd airtime policy configuration
Jouni Malinen [Fri, 19 Mar 2021 22:22:28 +0000 (00:22 +0200)] 
tests: hostapd airtime policy configuration

Add minimal testing for airtime policy configuration. mac80211_hwsim
does not actually support this functionality, so this is just for
testing coverage of src/ap/airtime_policy.c.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoTesting functionality for airtime policy
Jouni Malinen [Sat, 20 Mar 2021 10:02:18 +0000 (12:02 +0200)] 
Testing functionality for airtime policy

Add a new testing parameter to allow airtime policy implementation to be
tested for more coverage even without kernel driver support.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: DPP with hostapd as configurator/initiator with v1 enrollee
Jouni Malinen [Sat, 20 Mar 2021 09:09:25 +0000 (11:09 +0200)] 
tests: DPP with hostapd as configurator/initiator with v1 enrollee

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: DPP chirp by an AP on 5 GHz
Jouni Malinen [Sat, 20 Mar 2021 09:03:09 +0000 (11:03 +0200)] 
tests: DPP chirp by an AP on 5 GHz

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: AP tracking STA taxonomy (5 GHz)
Jouni Malinen [Fri, 19 Mar 2021 22:44:05 +0000 (00:44 +0200)] 
tests: AP tracking STA taxonomy (5 GHz)

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Debug print error from airtime weight configuration
Jouni Malinen [Fri, 19 Mar 2021 22:15:53 +0000 (00:15 +0200)] 
nl80211: Debug print error from airtime weight configuration

It is better to be able to determine whether the airtime weight
configuration for a STA actually was accepted by the driver or not.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: HE AP spatial reuse parameters
Jouni Malinen [Fri, 19 Mar 2021 21:58:39 +0000 (23:58 +0200)] 
tests: HE AP spatial reuse parameters

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Fix error messages for HE config missing
Jouni Malinen [Fri, 19 Mar 2021 21:34:58 +0000 (23:34 +0200)] 
tests: Fix error messages for HE config missing

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoMore documentation for HE Spatial Reuse Parameter Set configuration
Jouni Malinen [Fri, 19 Mar 2021 21:33:16 +0000 (23:33 +0200)] 
More documentation for HE Spatial Reuse Parameter Set configuration

Add a bit more complete documentation on how he_spr_sr_control parameter
is supposed to be used.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: EAP-SIM with decorated anonymous identity
Jouni Malinen [Fri, 19 Mar 2021 19:12:43 +0000 (21:12 +0200)] 
tests: EAP-SIM with decorated anonymous identity

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoEAP-SIM/AKA peer: Support decorated anonymous identity prefix
Hai Shalom [Fri, 12 Mar 2021 02:42:10 +0000 (18:42 -0800)] 
EAP-SIM/AKA peer: Support decorated anonymous identity prefix

Support decorated anonymous identity prefix as per RFC 7542,
for SIM-based EAP networks.

Signed-off-by: Hai Shalom <haishalom@google.com>
4 years agoIntroduce reason code for TWT teardown due to concurrency
Mohammad Asaad Akram [Wed, 17 Mar 2021 04:12:35 +0000 (09:42 +0530)] 
Introduce reason code for TWT teardown due to concurrency

The firmware sends new reason codes to indicate TWT teardown due to
single channel and multi channel concurrency. Update the enum
qca_wlan_vendor_twt_status to represent new reason code.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Make FT roaming and data connectivity checks more robust
Jouni Malinen [Fri, 19 Mar 2021 18:54:16 +0000 (20:54 +0200)] 
tests: Make FT roaming and data connectivity checks more robust

Dump pending monitor interface messages between each roaming step to
make the test log easier to understand and hostapd wait for the new
connection more robust by ensuring that the processed event if for the
very last reassociation. It looks like at least ap_ft_vlan_over_ds_many
could fail due to the connectivity check being started before the final
roam had been completed on the AP side even though there was an explicit
hapd2ap.wait_sta() wait before the test.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Check update misbehaving MBO AP test to include roam
Matthew Wang [Tue, 16 Mar 2021 20:19:55 +0000 (13:19 -0700)] 
tests: Check update misbehaving MBO AP test to include roam

APs PMF capabilities can differ. wpa_supplicant should be able to
disable and enable MBO when roaming to and from a misbehaving MBO AP
that doesn't support PMF. Verify that this is indeed happening.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
4 years agotests: Fix eap_proto_eke_errors with gcc-10
Jouni Malinen [Wed, 17 Mar 2021 21:38:26 +0000 (23:38 +0200)] 
tests: Fix eap_proto_eke_errors with gcc-10

gcc-10 seems to be inlining eap_eke_prf() and eap_eke_prfplus() which
breaks this test case due to a different backtrace being generated for
triggering the local failures. Point to the functions called by those
instead of these two functions to get this working with both gcc-9 and
gcc-10.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Speed up tshark operations
Jouni Malinen [Wed, 17 Mar 2021 21:36:52 +0000 (23:36 +0200)] 
tests: Speed up tshark operations

Hide /usr/share/wireshark from hostfs to prevent tshark from loading all
the data from there since that can take significant amount of time and
is not really needed for the test cases. In addition, set HOME to point
to local tmpfs to avoid unnecessary references through hostfs.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agotests: Add coverage for PASN deauthentication
Ilan Peer [Tue, 16 Mar 2021 09:43:23 +0000 (11:43 +0200)] 
tests: Add coverage for PASN deauthentication

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoPASN: Add support for deauthentication flow in station
Ilan Peer [Mon, 15 Mar 2021 12:57:12 +0000 (14:57 +0200)] 
PASN: Add support for deauthentication flow in station

The new wpa_supplicant control interface command "PASN_DEAUTH
bssid=<BSSID>" can now be used to flush the local PTKSA cache for the
specified BSS and to notify the AP to request it to drop its PTKSA as
well.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agonl80211: Allow sending Deauthentication frame with off channel for PASN
Ilan Peer [Mon, 15 Mar 2021 12:57:11 +0000 (14:57 +0200)] 
nl80211: Allow sending Deauthentication frame with off channel for PASN

To allow for a PASN station to deauthenticate from an AP to clear any
PTKSA cache entry for it, extend the nl80211 interface to allow sending
a Deauthentication frame with off channel enabled.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoAP: Handle deauthentication frame from PASN station
Ilan Peer [Mon, 15 Mar 2021 12:57:10 +0000 (14:57 +0200)] 
AP: Handle deauthentication frame from PASN station

When a Deauthentication frame is received, clear the corresponding PTKSA
cache entry for the given station, to invalidate previous PTK
information.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoAP: Enable anti clogging handling code in PASN builds without SAE
Ilan Peer [Mon, 15 Mar 2021 12:57:06 +0000 (14:57 +0200)] 
AP: Enable anti clogging handling code in PASN builds without SAE

The anti-clogging code was under CONFIG_SAE. Change this so it can be
used both with CONFIG_SAE and CONFIG_PASN.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoAP: Rename SAE anti clogging variables and functions
Ilan Peer [Mon, 15 Mar 2021 12:57:05 +0000 (14:57 +0200)] 
AP: Rename SAE anti clogging variables and functions

PASN authentication mandates support for comeback flow, which
among others can be used for anti-clogging purposes.

As the SAE support for anti clogging can also be used for PASN,
start modifying the source code so the anti clogging support
can be used for both SAE and PASN.

As a start, rename some variables/functions etc. so that they would not
be SAE specific. The configuration variable is also renamed, but the old
version remains available for backwards compatibility.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agotests: Add test coverage for PASN with MIC errors
Ilan Peer [Mon, 15 Mar 2021 12:57:04 +0000 (14:57 +0200)] 
tests: Add test coverage for PASN with MIC errors

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoPASN: For testing purposes allow to corrupt MIC
Ilan Peer [Mon, 15 Mar 2021 12:57:03 +0000 (14:57 +0200)] 
PASN: For testing purposes allow to corrupt MIC

For testing purposes, add support for corrupting the MIC in PASN
Authentication frames for both wpa_supplicant and hostapd.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agotests: PASN: configure the nid before sending the command
Ilan Peer [Mon, 15 Mar 2021 12:57:02 +0000 (14:57 +0200)] 
tests: PASN: configure the nid before sending the command

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoPASN: Encode the public key properly
Ilan Peer [Mon, 15 Mar 2021 12:57:01 +0000 (14:57 +0200)] 
PASN: Encode the public key properly

When a public key is included in the PASN Parameters element, it should
be encoded using the RFC 5480 conventions, and thus the first octet of
the Ephemeral Public Key field should indicate whether the public key is
compressed and the actual key part starts from the second octet.

Fix the implementation to properly adhere to the convention
requirements for both wpa_supplicant and hostapd.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoPASN: Include PMKID in RSNE in PASN response from AP
Ilan Peer [Mon, 15 Mar 2021 12:57:00 +0000 (14:57 +0200)] 
PASN: Include PMKID in RSNE in PASN response from AP

As defined in IEEE P802.11az/D3.0, 12.12.3.2 for the second PASN frame.
This was previously covered only for the case when the explicit PMKSA
was provided to the helper function. Extend that to cover the PMKID from
SAE/FILS authentication cases.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoPASN: Fix setting frame and data lengths in AP mode PASN response
Ilan Peer [Mon, 15 Mar 2021 12:56:59 +0000 (14:56 +0200)] 
PASN: Fix setting frame and data lengths in AP mode PASN response

Frame length and data length can exceed 256 so need to use size_t
instead of u8.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
4 years agoEAP peer: Make EAP-Success handling more robust against race conditions
Jouni Malinen [Sun, 14 Mar 2021 22:45:20 +0000 (00:45 +0200)] 
EAP peer: Make EAP-Success handling more robust against race conditions

When ERP initialization was moved from the METHOD state to the SUCCESS
state, the conditions for checking against EAP state being cleared was
missed. The METHOD state verified that sm->m is not NULL while the
SUCCESS state did not have such a check. This opened a window for a race
condition where processing of deauthentication event and EAPOL RX events
could end up delivering an EAP-Success to the EAP peer state machine
after the state had been cleared. This issue has now been worked around
in another manner, but the root cause for this regression should be
fixed as well.

Check that the EAP state machine is properly configured before trying to
initialize ERP in the SUCCESS state.

Fixes: 2a71673e27e9 ("ERP: Derive ERP key only after successful EAP authentication")
Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Enable HE overrides in wpa_supplicant build
Jouni Malinen [Sun, 14 Mar 2021 17:12:07 +0000 (19:12 +0200)] 
tests: Enable HE overrides in wpa_supplicant build

This is needed for the recently added he_disabled_on_sta test case.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: DPP Authentication Confirm timeout in hostapd
Jouni Malinen [Sun, 14 Mar 2021 16:52:54 +0000 (18:52 +0200)] 
tests: DPP Authentication Confirm timeout in hostapd

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoDPP: Add init/respond retries parameter configuration to hostapd
Jouni Malinen [Sun, 14 Mar 2021 16:51:43 +0000 (18:51 +0200)] 
DPP: Add init/respond retries parameter configuration to hostapd

These parameters were already defined in struct hostapd_data, but there
was no way of setting them. Add these to hostapd control interface
similarly to the wpa_supplicant implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: OCV without PMF
Jouni Malinen [Sun, 14 Mar 2021 16:27:47 +0000 (18:27 +0200)] 
tests: OCV without PMF

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: WEP and HE
Jouni Malinen [Sun, 14 Mar 2021 16:21:47 +0000 (18:21 +0200)] 
tests: WEP and HE

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: HE AP and 6 GHz security parameter validation
Jouni Malinen [Sun, 14 Mar 2021 16:17:33 +0000 (18:17 +0200)] 
tests: HE AP and 6 GHz security parameter validation

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Automatic channel selection for VHT 80+80
Jouni Malinen [Sun, 14 Mar 2021 16:07:19 +0000 (18:07 +0200)] 
tests: Automatic channel selection for VHT 80+80

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: RADIUS Accounting and interim updates failing
Jouni Malinen [Sun, 14 Mar 2021 15:59:52 +0000 (17:59 +0200)] 
tests: RADIUS Accounting and interim updates failing

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Fix ap_wpa2_eap_tls_ocsp_multi_revoked
Jouni Malinen [Sun, 14 Mar 2021 11:46:03 +0000 (13:46 +0200)] 
tests: Fix ap_wpa2_eap_tls_ocsp_multi_revoked

The index-revoked.txt file had not been updated when the server
certificate was updated.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoTLS: Fix highest TLS version disabling with internal TLS client
Jouni Malinen [Sun, 14 Mar 2021 10:48:19 +0000 (12:48 +0200)] 
TLS: Fix highest TLS version disabling with internal TLS client

The highest supported TLS version for pre_master_secret needs to be
limited based on the local configuration for the case where the highest
version number is being explicitly disabled. Without this, the server
would likely detect a downgrade attack.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Check SAE capability for couple of forgotten sigma_dut cases
Jouni Malinen [Sat, 13 Mar 2021 23:23:32 +0000 (01:23 +0200)] 
tests: Check SAE capability for couple of forgotten sigma_dut cases

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Check DPP capability in couple of forgotten cases
Jouni Malinen [Sat, 13 Mar 2021 23:05:08 +0000 (01:05 +0200)] 
tests: Check DPP capability in couple of forgotten cases

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Skip ap_cipher_wpa_sae without SAE support
Jouni Malinen [Sat, 13 Mar 2021 22:55:06 +0000 (00:55 +0200)] 
tests: Skip ap_cipher_wpa_sae without SAE support

Even though the STA in this test case does not actually use SAE, it
needs to recognize the "SAE H2E only "BSS membership selector.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Fix check_sae_pk_capab() with non-SAE builds
Jouni Malinen [Sat, 13 Mar 2021 22:51:23 +0000 (00:51 +0200)] 
tests: Fix check_sae_pk_capab() with non-SAE builds

dev.get_capability() returns None in such a case.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoDPP2: Use ASN.1 helper functions
Jouni Malinen [Fri, 12 Mar 2021 21:24:54 +0000 (23:24 +0200)] 
DPP2: Use ASN.1 helper functions

Simplify ASN.1 parser operations by using the shared helper functions.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoTLS: Use ASN.1 helper functions
Jouni Malinen [Fri, 12 Mar 2021 21:24:54 +0000 (23:24 +0200)] 
TLS: Use ASN.1 helper functions

Simplify ASN.1 parser operations by using the shared helper functions.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoX509: Use ASN.1 helper functions
Jouni Malinen [Fri, 12 Mar 2021 21:24:54 +0000 (23:24 +0200)] 
X509: Use ASN.1 helper functions

Simplify ASN.1 parser operations by using the shared helper functions.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoRSA: Use ASN.1 helper functions
Jouni Malinen [Fri, 12 Mar 2021 21:24:54 +0000 (23:24 +0200)] 
RSA: Use ASN.1 helper functions

Simplify ASN.1 parser operations by using the shared helper functions.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoPKCS: Use ASN.1 helper functions
Jouni Malinen [Fri, 12 Mar 2021 21:24:54 +0000 (23:24 +0200)] 
PKCS: Use ASN.1 helper functions

Simplify ASN.1 parser operations by using the shared helper functions.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Validate DigestAlgorithmIdentifier parameters
Jouni Malinen [Sat, 13 Mar 2021 16:19:31 +0000 (18:19 +0200)] 
ASN.1: Validate DigestAlgorithmIdentifier parameters

The supported hash algorithms do not use AlgorithmIdentifier parameters.
However, there are implementations that include NULL parameters in
addition to ones that omit the parameters. Previous implementation did
not check the parameters value at all which supported both these cases,
but did not reject any other unexpected information.

Use strict validation of digest algorithm parameters and reject any
unexpected value when validating a signature. This is needed to prevent
potential forging attacks.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Fix AlgorithmInfo parsing for signatures
Jouni Malinen [Sat, 13 Mar 2021 16:00:55 +0000 (18:00 +0200)] 
ASN.1: Fix AlgorithmInfo parsing for signatures

Digest is within the DigestInfo SEQUENCE and as such, parsing for it
should use the end of that data instead of the end of the decrypted
signature as the end point. Fix this in the PKCS #1 and X.509
implementations to avoid accepting invalid digest data that is
constructed to get the hash value from after the actual DigestInfo
container.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Reject invalid definite long form length values in DER encoding
Jouni Malinen [Sat, 13 Mar 2021 15:26:54 +0000 (17:26 +0200)] 
ASN.1: Reject invalid definite long form length values in DER encoding

The definite long form for the length is allowed only for cases where
the definite short form cannot be used, i.e., if the length is 128 or
greater. This was not previously enforced and as such, multiple
different encoding options for the same length could have been accepted.

Perform more strict checks to reject invalid cases for the definite long
form for the length. This is needed for a compliant implementation and
this is especially important for the case of verifying DER encoded
signatures to prevent potential forging attacks.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Reject invalid extended tags in DER encoding
Jouni Malinen [Sat, 13 Mar 2021 14:49:07 +0000 (16:49 +0200)] 
ASN.1: Reject invalid extended tags in DER encoding

The extended tag case is allowed only for tag values that are 31 or
larger (i.e., the ones that would not fit in the single octet identifier
case with five bits). Extended tag format was previously accepted even
for the values 0..31 and this would enable multiple different encodings
for the same tag value. That is not allowed for DER.

Perform more strict checks to reject invalid extended tag values. This
is needed for a compliant implementation and this is especially
important for the case of verifying DER encoded signatures to prevent
potential forging attacks.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Explicitly validate constructed bit while parsing DER
Jouni Malinen [Sat, 13 Mar 2021 21:11:41 +0000 (23:11 +0200)] 
ASN.1: Explicitly validate constructed bit while parsing DER

The identifier octet in DER encoding includes three components. Only two
of these (Class and Tag) were checked in most cases when looking for a
specific data type. Also check the Primitive/Constructed bit to avoid
accepting invalid encoding.

This is needed for correct behavior in DER parsing and especially
important for the case of verifying DER encoded signatures to prevent
potential forging attacks.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Use the helper functions for recognizing tags and debug prints
Jouni Malinen [Sat, 13 Mar 2021 21:13:05 +0000 (23:13 +0200)] 
ASN.1: Use the helper functions for recognizing tags and debug prints

Simplify the core ASN.1 parser implementation by using the helper
functions.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Add helper functions for recognizing tag values
Jouni Malinen [Sat, 13 Mar 2021 21:14:23 +0000 (23:14 +0200)] 
ASN.1: Add helper functions for recognizing tag values

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Verify that NULL value has zero length
Jouni Malinen [Sat, 13 Mar 2021 21:09:28 +0000 (23:09 +0200)] 
ASN.1: Verify that NULL value has zero length

This value is required to contain no octets, so verify that its length
octet agrees with that.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Add helper functions for debug printing identifier/length info
Jouni Malinen [Sat, 13 Mar 2021 21:02:44 +0000 (23:02 +0200)] 
ASN.1: Add helper functions for debug printing identifier/length info

These can be helpful in cleaning up implementation of more or less
identical debug printing operations.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Define tag value for TIME
Jouni Malinen [Sat, 13 Mar 2021 21:15:02 +0000 (23:15 +0200)] 
ASN.1: Define tag value for TIME

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoASN.1: Fix a typo in a not-used tag name
Jouni Malinen [Sat, 13 Mar 2021 21:00:45 +0000 (23:00 +0200)] 
ASN.1: Fix a typo in a not-used tag name

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Allow test-rsa-sig-ver data files to be set on command line
Jouni Malinen [Fri, 12 Mar 2021 21:24:29 +0000 (23:24 +0200)] 
tests: Allow test-rsa-sig-ver data files to be set on command line

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Work around race conditions in OWE test cases
Jouni Malinen [Fri, 12 Mar 2021 17:59:07 +0000 (19:59 +0200)] 
tests: Work around race conditions in OWE test cases

Need to explicitly wait for hostapd to report STA connection before
starting the traffic test to avoid the potential race condition when
testing with UML and time travel mode.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agotests: Make INTERWORKING_SELECT test cases more reliable
Jouni Malinen [Fri, 12 Mar 2021 09:46:22 +0000 (11:46 +0200)] 
tests: Make INTERWORKING_SELECT test cases more reliable

These could fail if a scan entry from a previous test case was still
present in the BSS table, e.g., by wpa_supplicant selecting the SSID
from that old entry instead of the new SSID. Try to avoid that by
explicitly flushing the scan results before starting these tests.

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Restore station mode on deinit only if station when started
Peter Åstrand [Thu, 11 Mar 2021 20:58:48 +0000 (21:58 +0100)] 
nl80211: Restore station mode on deinit only if station when started

With the earlier code, a mesh interface was changed to station after
deinit.

Signed-off-by: Peter Astrand <peter.astrand@etteplan.com>
4 years agotests: TWT_SETUP with the control argument
Jouni Malinen [Fri, 12 Mar 2021 08:54:14 +0000 (10:54 +0200)] 
tests: TWT_SETUP with the control argument

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agoTWT: Allow specifying Control field value in TWT Request
Ben Greear [Wed, 10 Mar 2021 17:28:12 +0000 (09:28 -0800)] 
TWT: Allow specifying Control field value in TWT Request

See IEEE P802.11ax/D8.0, Figure 9-687 (Control field format) for
details.

Signed-off-by: Ben Greear <greearb@candelatech.com>
4 years agotests: Disabling HE support in STA
Jouni Malinen [Fri, 12 Mar 2021 08:47:50 +0000 (10:47 +0200)] 
tests: Disabling HE support in STA

Signed-off-by: Jouni Malinen <j@w1.fi>
4 years agonl80211: Support disabling HE in infrastructure BSS as station
Ben Greear [Wed, 10 Mar 2021 17:27:54 +0000 (09:27 -0800)] 
nl80211: Support disabling HE in infrastructure BSS as station

Send a flag to the kernel when user has specified disable_he=1 in the
network configuration block. This extends the functionality added in
commit 7c8f540ee0a8 ("wpa_supplicant: Add HE override support") to cover
the cases that need kernel functionality.

Signed-off-by: Ben Greear <greearb@candelatech.com>
4 years agoP2P: Clear pending_listen_freq when stopping listen
Andrei Otcheretianski [Sun, 7 Mar 2021 21:40:02 +0000 (23:40 +0200)] 
P2P: Clear pending_listen_freq when stopping listen

If listen work never started, pending_listen_freq might be left
uncleared, preventing the subsequent listen to start. This could happen
in p2p_timeout_wait_peer_idle() after the commit 13256b8cf ("P2P: Stop
old listen radio work before go to WAIT_PEER_IDLE state") added a
stop_listen() call there.

Fixes: 13256b8cf3ed ("P2P: Stop old listen radio work before go to WAIT_PEER_IDLE state")
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
4 years agowpa_supplicant: Don't process EAPOL frames while disconnecting
Andrei Otcheretianski [Sun, 7 Mar 2021 21:40:01 +0000 (23:40 +0200)] 
wpa_supplicant: Don't process EAPOL frames while disconnecting

An EAPOL frame may be pending when wpa_supplicant requests to
deauthenticate. At this stage the EAP SM cache is already cleaned by
calling eapol_sm_invalidate_cached_session(). Since at this stage the
wpa_supplicant's state is still set to associated, the EAPOL frame is
processed and results in a crash due to NULL dereference.

This wasn't seen previously as nl80211 wouldn't process the
NL80211_CMD_CONTROL_PORT_FRAME, since wpa_driver_nl80211_mlme() would
set the valid_handler to NULL. This behavior was changed in commit
ab89291928fa exposing this race.

Fix it by ignoring EAPOL frames while the deauthentication is in
progress.

Fixes: ab89291928fa ("nl80211: Use process_bss_event() for the nl_connect handler")
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
4 years agoeapol_test: Add address family for IPv4 in Windows build
Stefan Paetow [Thu, 11 Mar 2021 18:47:36 +0000 (18:47 +0000)] 
eapol_test: Add address family for IPv4 in Windows build

Add the address family when manually constructing IPv4 addresses in
eapol_test on Windows. Otherwise other functions, like hostapd_ip_txt()
in src/utils/ip_addr.c, that rely on addr->af being set fail miserably.
The non-Windows option uses hostapd_parse_ip_addr() which does this as
part of the helper function.

Signed-off-by: Stefan Paetow <oss@eons.net>
4 years agoAdd support to return bandwidth for channel 2 of the 6 GHz band
Swarn Singh [Fri, 5 Mar 2021 05:10:04 +0000 (10:40 +0530)] 
Add support to return bandwidth for channel 2 of the 6 GHz band

The 6 GHz band operating class 136 is defined to use 20 MHz bandwidth.
Return the value accordingly from center_idx_to_bw_6ghz() to cover this
special case.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agoNew vendor attribute to configure TWT mantissa in microseconds
Mohammad Asaad Akram [Mon, 1 Mar 2021 09:04:38 +0000 (14:34 +0530)] 
New vendor attribute to configure TWT mantissa in microseconds

Define the following additional TWT attribute for
qca_wlan_vendor_attr_twt_setup:
QCA_WLAN_VENDOR_ATTR_TWT_SETUP_WAKE_INTVL2_MANTISSA to configure the
mantissa in microseconds.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
4 years agowlantest: Skip Mesh Control field from the beginning of payload
Jouni Malinen [Tue, 9 Mar 2021 18:20:24 +0000 (20:20 +0200)] 
wlantest: Skip Mesh Control field from the beginning of payload

This allows correct processing of Data frames with Mesh Control field by
finding the LLC/SNAP header after that field.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>