]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
3 years agowolfSSL: Fix TLS 1.3 session handling
Juliusz Sosinowicz [Mon, 25 Apr 2022 14:18:49 +0000 (16:18 +0200)] 
wolfSSL: Fix TLS 1.3 session handling

Uses the changes to wolfSSL found in
https://github.com/wolfSSL/wolfssl/pull/5078

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Check for the too-short-password error in pbkdf2_sha1()
Juliusz Sosinowicz [Fri, 29 Apr 2022 14:11:54 +0000 (16:11 +0200)] 
wolfSSL: Check for the too-short-password error in pbkdf2_sha1()

This may fail with FIPS builds because the FIPS requirement is that the
password must be at least 14 characters.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agoCheck the return of pbkdf2_sha1() for errors
Juliusz Sosinowicz [Fri, 29 Apr 2022 14:11:54 +0000 (16:11 +0200)] 
Check the return of pbkdf2_sha1() for errors

pbkdf2_sha1() may return errors and this should be checked in calls.
This is especially an issue with FIPS builds because the FIPS
requirement is that the password must be at least 14 characters.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Fixes for FIPS builds
Juliusz Sosinowicz [Fri, 29 Apr 2022 14:18:00 +0000 (16:18 +0200)] 
wolfSSL: Fixes for FIPS builds

Some API is not available when using FIPS. We need to allocate memory
and initialize the structs directly.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Register a FIPS callback
Juliusz Sosinowicz [Fri, 29 Apr 2022 14:18:00 +0000 (16:18 +0200)] 
wolfSSL: Register a FIPS callback

Register a callback with wolfCrypt_SetCb_fips to inform the user of
errors in the wolfCrypt FIPS module.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agotests: Add a note for wolfSSL testing with Brainpool curves
Juliusz Sosinowicz [Mon, 25 Apr 2022 14:18:15 +0000 (16:18 +0200)] 
tests: Add a note for wolfSSL testing with Brainpool curves

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Implement crypto_ec_key wrappers
Juliusz Sosinowicz [Mon, 25 Apr 2022 14:18:15 +0000 (16:18 +0200)] 
wolfSSL: Implement crypto_ec_key wrappers

These are needed to support SAEK-PK with the wolfSSL backend.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Add missing free calls for wolfSSL structs
Juliusz Sosinowicz [Thu, 28 Apr 2022 12:16:36 +0000 (14:16 +0200)] 
wolfSSL: Add missing free calls for wolfSSL structs

In some configurations the wc_Init*() functions may either allocate
memory or other system resources. These resources need to be freed.

Co-authored-by: JacobBarthelmeh <jacob@wolfssl.com>
Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Support both DER and PEM blobs
Juliusz Sosinowicz [Fri, 29 Apr 2022 14:18:38 +0000 (16:18 +0200)] 
wolfSSL: Support both DER and PEM blobs

Add support for loading private keys and certificates in both PEM and
DER formats with wolfSSL.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agotests: IMSI privacy with imsi_privacy_key on peer
Jouni Malinen [Sun, 1 May 2022 10:01:46 +0000 (13:01 +0300)] 
tests: IMSI privacy with imsi_privacy_key on peer

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoEAP-SIM/AKA peer: IMSI privacy
Jouni Malinen [Sun, 1 May 2022 08:34:49 +0000 (11:34 +0300)] 
EAP-SIM/AKA peer: IMSI privacy

Add support for IMSI privacy in the EAP-SIM/AKA peer implementation. If
the new wpa_supplicant network configuration parameter imsi_privacy_key
is used to specify an RSA public key in a form of a PEM encoded X.509v3
certificate, that key will be used to encrypt the permanent identity
(IMSI) in the transmitted EAP messages.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agotests: IMSI privacy with imsi_identity
Jouni Malinen [Sat, 30 Apr 2022 13:28:33 +0000 (16:28 +0300)] 
tests: IMSI privacy with imsi_identity

Add RSA public key (in an X.509v3 certificate) and private key for IMSI
privacy. These were generated with
openssl req -new -x509 -sha256 -newkey rsa:2048 -nodes -days 7500 \
-keyout imsi-privacy-key.pem -out imsi-privacy-cert.pem

Test the case where wpa_supplicant side RSA-OAEP operation for IMSI
privacy is done in an external component while the hostapd (EAP server)
processing of the encrypted identity is internal.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoEAP-SIM/AKA server: IMSI privacy
Jouni Malinen [Sat, 30 Apr 2022 13:56:10 +0000 (16:56 +0300)] 
EAP-SIM/AKA server: IMSI privacy

Add support for IMSI privacy in the EAP-SIM/AKA server implementation.
If the new hostapd configuration parameter imsi_privacy_key is used to
specify an RSA private key, that key will be used to decrypt encrypted
permanent identity.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoOpenSSL: RSA-OAEP-SHA-256 encryption/decryption
Jouni Malinen [Sat, 30 Apr 2022 10:34:00 +0000 (13:34 +0300)] 
OpenSSL: RSA-OAEP-SHA-256 encryption/decryption

Add new crypto wrappers for performing RSA-OAEP-SHA-256 encryption and
decryption. These are needed for IMSI privacy.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoEHT: Channel switch command support
Muna Sinada [Tue, 19 Apr 2022 18:04:17 +0000 (11:04 -0700)] 
EHT: Channel switch command support

Add option to hostapd control interface CHAN_SWITCH command to allow
switch in EHT mode.

Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Additions to hostapd_set_freq_params()
Muna Sinada [Tue, 19 Apr 2022 18:04:16 +0000 (11:04 -0700)] 
EHT: Additions to hostapd_set_freq_params()

Modify hostapd_set_freq_params() to include EHT parameters and update
the calling functions to match.

Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Indicate EHT support in Neighbor Report element
Aloka Dixit [Tue, 19 Apr 2022 18:04:15 +0000 (11:04 -0700)] 
EHT: Indicate EHT support in Neighbor Report element

Set bit 21 in the neighbor report for an EHT AP as described in IEEE
P802.11be/D1.5, 9.4.2.36. Also move the check for HE outside the check
for HT as neither HT nor VHT are enabled in the 6 GHz band.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Provide EHT capabilities in STA addition path
Aloka Dixit [Tue, 19 Apr 2022 18:04:13 +0000 (11:04 -0700)] 
EHT: Provide EHT capabilities in STA addition path

Add support for EHT capabilities in the addition of a new station entry
to the driver.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Process (Re)Association Request frame capabilities
Aloka Dixit [Tue, 19 Apr 2022 18:04:12 +0000 (11:04 -0700)] 
EHT: Process (Re)Association Request frame capabilities

Parse EHT capabilities sent by a non-AP STA in (Re)Association Request
frames. Validate the length of the element, matching MCS rates between
AP TX and STA RX. Store the capabilities in the station info structure.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Parse elements received in Management frames
Aloka Dixit [Tue, 19 Apr 2022 18:04:11 +0000 (11:04 -0700)] 
EHT: Parse elements received in Management frames

Parse and store pointers to EHT Capabilities and Operation elements
received in Management frames.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Add operation element in AP mode Management frames
Aloka Dixit [Tue, 19 Apr 2022 18:04:09 +0000 (11:04 -0700)] 
EHT: Add operation element in AP mode Management frames

Add EHT Operation element in Beacon, Probe Response, and (Re)Association
Response frames using the format described in IEEE P802.11be/D1.5,
9.4.2.311.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Add capabilities element in AP mode Management frames
Aloka Dixit [Tue, 19 Apr 2022 18:04:08 +0000 (11:04 -0700)] 
EHT: Add capabilities element in AP mode Management frames

Add EHT Capabilities element in Beacon, Probe Response, and
(Re)Association Response frames.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Add configuration options for beamforming capabilities
Aloka Dixit [Tue, 19 Apr 2022 18:04:05 +0000 (11:04 -0700)] 
EHT: Add configuration options for beamforming capabilities

Add configuration options to set EHT SU/MU beamforming capabilities.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Add operating channel width configuration
Aloka Dixit [Tue, 19 Apr 2022 18:04:04 +0000 (11:04 -0700)] 
EHT: Add operating channel width configuration

Add new configuration options to configure EHT operating channel
width and center frequency.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: AP mode configuration options to enable/disable the support
Aloka Dixit [Tue, 19 Apr 2022 18:04:03 +0000 (11:04 -0700)] 
EHT: AP mode configuration options to enable/disable the support

Add compilation support for IEEE 802.11be along with options to enable
EHT support per radio and disable per interface.

Enabling HE is mandatory to enable EHT mode.

Tested-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agonl80211: Pass station's EHT capabilities to the driver in sta_add()
Aloka Dixit [Tue, 19 Apr 2022 18:04:14 +0000 (11:04 -0700)] 
nl80211: Pass station's EHT capabilities to the driver in sta_add()

Pass non-AP STA's EHT capabilities to the driver using the
NL80211_ATTR_EHT_CAPABILITY attribute.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agonl80211: Parse EHT capabilities from the driver
Aloka Dixit [Tue, 19 Apr 2022 18:04:10 +0000 (11:04 -0700)] 
nl80211: Parse EHT capabilities from the driver

Add nl80211 support to parse the EHT capabilities passed by the kernel
using new attributes added in NL80211_BAND_ATTR_IFTYPE_DATA.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agoEHT: Define EHT elements
Aloka Dixit [Tue, 19 Apr 2022 18:04:02 +0000 (11:04 -0700)] 
EHT: Define EHT elements

Define the following fields described in IEEE P802.11be/D1.5:
- 9.4.2.311 EHT Operation element
- 9.4.2.313 EHT Capabilities element

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
Signed-off-by: Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>
3 years agodefconfig: Document IEEE 802.11ax as a published amendment
Jouni Malinen [Fri, 29 Apr 2022 10:30:48 +0000 (13:30 +0300)] 
defconfig: Document IEEE 802.11ax as a published amendment

The comment about the IEEE 802.11ax functionality being experimental and
based on a not yet finalized standard is not accurate anymore since IEEE
Std 802.11ax-2021 has already been published. Remove that comment and
add the entry for wpa_supplicant as well.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agotests: HE with 20 MHz channel width on 6 GHz
Jouni Malinen [Thu, 28 Apr 2022 20:58:03 +0000 (23:58 +0300)] 
tests: HE with 20 MHz channel width on 6 GHz

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agotests: Update regulatory database to VMs
Jouni Malinen [Thu, 28 Apr 2022 20:56:35 +0000 (23:56 +0300)] 
tests: Update regulatory database to VMs

Update the wireless-regdb database to the wireless-regdb.git version of
2022-04-08.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoSet hostapd hw_mode automatically based on 6 GHz op_class
Jouni Malinen [Fri, 29 Apr 2022 08:18:34 +0000 (11:18 +0300)] 
Set hostapd hw_mode automatically based on 6 GHz op_class

Allow hostapd configuration to specify use of the 6 GHz band with the
specific op_class values without having to set the hw_mode=a parameter
explicitly.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agonl80211: Increase the buffer length for debug printing channels
Jouni Malinen [Thu, 28 Apr 2022 18:15:41 +0000 (21:15 +0300)] 
nl80211: Increase the buffer length for debug printing channels

The previously used buffer was not large enough to be able to print out
all 6 GHz channels, so use a larger buffer to avoid leaving out
supported channels from the debug print.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoQCA vendor attribute to allow eMLSR HW mode
Gururaj Pandurangi [Mon, 25 Apr 2022 11:38:40 +0000 (04:38 -0700)] 
QCA vendor attribute to allow eMLSR HW mode

Add QCA_WLAN_VENDOR_ATTR_WIFI_TEST_CONFIG_11BE_EMLSR_MODE value to allow
or disallow eMLSR hardware mode for IEEE 802.11be MLO capable devices.
If this attribute is set to 1, and if the firmware supports this
capability too, the STA advertises this capability to the AP over
Association Request frame. This attribute will not have any effect on
legacy devices with no IEEE 802.11be support.

Signed-off-by: Gururaj Pandurangi <quic_panduran@quicinc.com>
3 years agoOpenSSL: Track SSL_SESSION ex data separately
Jouni Malinen [Wed, 27 Apr 2022 14:04:28 +0000 (17:04 +0300)] 
OpenSSL: Track SSL_SESSION ex data separately

It looks like the OpenSSL callbacks for SSL_SESSION can end up calling
the remove callback for multiple SSL_SESSION entries that share the same
ex data. This could result in double freeing the session data on the
server side.

Track the SSL_SESSION ex data in a separate list and free the
allocations only if they are pointing to a valid allocated wpabuf
pointer.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agotests: MBO and dynamic association disallowed change with passive scanning
Jouni Malinen [Sun, 24 Apr 2022 08:46:52 +0000 (11:46 +0300)] 
tests: MBO and dynamic association disallowed change with passive scanning

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoMBO: Check association disallowed in Beacon frames, if newer
Kuan-Chung Chen [Fri, 28 Jan 2022 09:25:46 +0000 (17:25 +0800)] 
MBO: Check association disallowed in Beacon frames, if newer

When a station receives either a Beacon frame or a Probe Response frame
from an AP that contains an MBO element with the Association Disallowed
attribute, the station should prevent association to that AP. When using
passive scanning, it is possible for the scan results to contain the
latest information in the Beacon frame elements instead of the Probe
Response frame elements. That could result in using old information and
not noticing the AP having changed its state to disallowing new
associations.

Make it more likely to follow the AP's change to disallow associations
by checking the Beacon frame elements instead of Probe Response frame
elements if the scan results are known to contain newer information for
the Beacon frame.

Signed-off-by: Kuan-Chung Chen <damon.chen@realtek.com>
3 years agoDetermine whether Beacon frame information is newer in scan results
Jouni Malinen [Sun, 24 Apr 2022 09:06:56 +0000 (12:06 +0300)] 
Determine whether Beacon frame information is newer in scan results

It can be helpful to know whether the information elements from the
Beacon frame or the Probe Response frame are newer when using BSS table
entries, so make this information known, if available. This allows the
Beacon frame elements to be preferred over the Probe Response frame
elements when desired.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoscan: Print SSID in scan results dump
xinpeng wang [Wed, 20 Apr 2022 09:23:32 +0000 (17:23 +0800)] 
scan: Print SSID in scan results dump

Add printing of SSID into the "Sorted scan reslts" dump for easy reading
and debugging.

Signed-off-by: xinpeng wang <wangxinpeng@uniontech.com>
3 years agoInstall wpa_passphrase when not disabled
Alex Kiernan [Thu, 21 Apr 2022 14:38:42 +0000 (15:38 +0100)] 
Install wpa_passphrase when not disabled

As part of fixing CONFIG_NO_WPA_PASSPHRASE, whilst wpa_passphrase gets
built, its not installed during `make install`.

Fixes: cb41c214b78d ("build: Re-enable options for libwpa_client.so and wpa_passphrase")
Signed-off-by: Alex Kiernan <alexk@zuma.ai>
Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
3 years agohostapd: Allow enabling background radar
Ben Greear [Thu, 21 Apr 2022 23:02:39 +0000 (16:02 -0700)] 
hostapd: Allow enabling background radar

This feature does not work on all radios that advertise this feature
with the current driver implementation, and possibly some users don't
want to use it even if it works fine, so disable it by default for now,
but let users enable it as desired with enable_background_radar=1.

Signed-off-by: Ben Greear <greearb@candelatech.com>
3 years agowolfSSL: Speed up crypto_ec_point_compute_y_sqr()
Jouni Malinen [Sat, 23 Apr 2022 13:12:49 +0000 (16:12 +0300)] 
wolfSSL: Speed up crypto_ec_point_compute_y_sqr()

Optimize the calculation by computing (x^2 + a) first to get rid of one
separate multiplication by x.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agowolfSSL: Fix crypto_ec_point_compute_y_sqr() error case processing
Jouni Malinen [Sat, 23 Apr 2022 13:04:49 +0000 (16:04 +0300)] 
wolfSSL: Fix crypto_ec_point_compute_y_sqr() error case processing

The result (y2) was cleared and freed in error cases, but the pointer
itself was not cleared to NULL, so the error path would have returned a
pointer to freed memory. Fix this by properly clearing the return value
in error cases. In addition, simplify the function to avoid tracking
success case separately.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agowolfSSL: Fix the memory leak of crypto_ec_point_compute_y_sqr()
赵军涛 [Tue, 19 Apr 2022 09:31:35 +0000 (17:31 +0800)] 
wolfSSL: Fix the memory leak of crypto_ec_point_compute_y_sqr()

Local variable "t" needs to be cleared whether "calced" is 0 or 1.

Signed-off-by: 赵军涛 <d2014zjt@163.com>
3 years agowolfSSL: Use wc_HmacInit() to avoid potential use of uninitialized values
Jouni Malinen [Sat, 23 Apr 2022 12:45:31 +0000 (15:45 +0300)] 
wolfSSL: Use wc_HmacInit() to avoid potential use of uninitialized values

wc_HmacSetKey() seems to initialize everything that is needed for the
actual operation, but at least valgrind is reporting use of
uninitialized values when this was done on a data structure that was not
explicitly cleared.

Call wc_HmacInit() before wc_HmacSetKey() to avoid any unexpected
behavior from potentially uninitialized values.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoOpenSSL: Fix build with BoringSSL
Jouni Malinen [Sat, 23 Apr 2022 10:05:49 +0000 (13:05 +0300)] 
OpenSSL: Fix build with BoringSSL

SSL_CTX_set_dh_auto() is not available in BoringSSL even though it
claims to be based on OpenSSL 1.1.1 in OPENSSL_VERSION_NUMBER.

Fixes: ebb3055e1302 ("OpenSSL: Generate DH parameters automatically if not set with dh_file")
Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoOpenSSL: Remove compatibility options for older versions than 1.0.2
Jouni Malinen [Sat, 23 Apr 2022 10:02:37 +0000 (13:02 +0300)] 
OpenSSL: Remove compatibility options for older versions than 1.0.2

Anything older than OpenSSL 1.0.2 should not be used anymore, so drop
the build compatibility options for those old versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoOpenSSL: Drop compatibility options for LibreSSL older than 2.7
Jouni Malinen [Sat, 23 Apr 2022 09:52:27 +0000 (12:52 +0300)] 
OpenSSL: Drop compatibility options for LibreSSL older than 2.7

Compilation was failing even with LibreSSL 2.7 versions, so there is no
point in maintaining these old compatibility options for older versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoOpenSSL: Implement crypto_ecdh routines without EC_KEY for OpenSSL 3.0
Jouni Malinen [Sat, 23 Apr 2022 09:28:18 +0000 (12:28 +0300)] 
OpenSSL: Implement crypto_ecdh routines without EC_KEY for OpenSSL 3.0

OpenSSL 3.0 has deprecated the low-level EC_KEY functionality, so use
the EVP API (EVP_EC_gen() and EV_PKEY_derive()) for the crypto_ecdh
wrappers.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoOpenSSL: Use new name for the EC_POINT set/get coordinate functions
Jouni Malinen [Sat, 23 Apr 2022 08:09:28 +0000 (11:09 +0300)] 
OpenSSL: Use new name for the EC_POINT set/get coordinate functions

OpenSSL 1.1.1 deprecated the function names with the _GFp postfix, so
move to the new function name. Add backwards compatibility wrappers for
older versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoctrl: Print the source address of the received commands
xinpeng wang [Wed, 5 Jan 2022 08:54:59 +0000 (16:54 +0800)] 
ctrl: Print the source address of the received commands

Sometimes there is a program error to send a large number of commands to
wpa_supplicant, and the source address can help quickly find the program
that sends commands.

Signed-off-by: xinpeng wang <wangxinpeng@uniontech.com>
3 years agowpa_ctrl: Wait for a total of 10 seconds, not 10 seconds per iteration
Alan T. DeKok [Fri, 23 Jul 2021 09:57:43 +0000 (05:57 -0400)] 
wpa_ctrl: Wait for a total of 10 seconds, not 10 seconds per iteration

EINTR will cause the loop to restart, which means that the total
time could be significantly longer than 10 seconds.

Signed-off-by: Alan DeKok <aland@deployingradius.com>
3 years agowolfSSL: Fix certificate commonName checking
Jouni Malinen [Mon, 18 Apr 2022 13:45:42 +0000 (16:45 +0300)] 
wolfSSL: Fix certificate commonName checking

wolfSSL_X509_NAME_get_index_by_NID() uses NID_* to identify the entry.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agowolfSSL: Use wolfSSL_export_keying_material() when available
Jouni Malinen [Mon, 18 Apr 2022 13:27:47 +0000 (16:27 +0300)] 
wolfSSL: Use wolfSSL_export_keying_material() when available

This is needed to work with TLS 1.3 key derivation. It looks the needed
functionality was added in wolfSSL 4.7.0.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Fix SAE-PK capability checks for sigma_dut test cases
Jouni Malinen [Mon, 18 Apr 2022 08:20:33 +0000 (11:20 +0300)] 
tests: Fix SAE-PK capability checks for sigma_dut test cases

These were testing only of SAE, not SAE-PK capability, and needs to be
skipped in SAE-PK is not included in the build.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Check DPP in build for couple of missing cases
Jouni Malinen [Mon, 18 Apr 2022 08:11:29 +0000 (11:11 +0300)] 
tests: Check DPP in build for couple of missing cases

These test cases need to be skipped in DPP is not included in the build.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agowolfSSL: Fix crypto_dh_init() and dh5_init()
Jouni Malinen [Mon, 18 Apr 2022 08:01:23 +0000 (11:01 +0300)] 
wolfSSL: Fix crypto_dh_init() and dh5_init()

priv_sz and pub_sz needs to be initialized to the buffer size before the
wc_DhGenerateKeyPair() call. The previous version happened to work in
some cases where a separate handled prime length was used, but not for
the generic case.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agowolfSSL: Fix crypto_ecdh_* with ECC_TIMING_RESISTANT
Jouni Malinen [Sun, 17 Apr 2022 21:54:37 +0000 (00:54 +0300)] 
wolfSSL: Fix crypto_ecdh_* with ECC_TIMING_RESISTANT

It looks like crypto_ecdh_set_peerkey() had started failing at some
point with a wolfSSL update due to ECC_TIMING_RESISTANT from
--enable-harden requiring RNG to be set.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoEAP-EKE server: Fix a memory leak on an error path
Jouni Malinen [Sun, 17 Apr 2022 20:37:50 +0000 (23:37 +0300)] 
EAP-EKE server: Fix a memory leak on an error path

The allocated Response/Commit message was not freed if DH initialization
failed.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Include additional tests for wolfSSL builds
Juliusz Sosinowicz [Thu, 26 Aug 2021 09:25:34 +0000 (11:25 +0200)] 
tests: Include additional tests for wolfSSL builds

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agotests: Include EAP-pwd for wolfSSL builds
Juliusz Sosinowicz [Thu, 26 Aug 2021 09:25:34 +0000 (11:25 +0200)] 
tests: Include EAP-pwd for wolfSSL builds

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: TLS session caching
Juliusz Sosinowicz [Thu, 26 Aug 2021 09:25:34 +0000 (11:25 +0200)] 
wolfSSL: TLS session caching

Add support for EAP server to cache TLS sessions (see hostapd
configuration parameter tls_session_lifetime).

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Add a debug logging callback
Juliusz Sosinowicz [Thu, 26 Aug 2021 09:25:34 +0000 (11:25 +0200)] 
wolfSSL: Add a debug logging callback

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Implement tls_get_tls_unique()
Juliusz Sosinowicz [Thu, 26 Aug 2021 09:25:34 +0000 (11:25 +0200)] 
wolfSSL: Implement tls_get_tls_unique()

This is needed for EAP-TEAP. This needs wolfSSL 5.0.0 or newer.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Implement tls_connection_get_cipher_suite()
Juliusz Sosinowicz [Thu, 26 Aug 2021 09:25:34 +0000 (11:25 +0200)] 
wolfSSL: Implement tls_connection_get_cipher_suite()

This is needed for EAP-TEAP.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Implement tls_connection_get_peer_subject()
Juliusz Sosinowicz [Thu, 26 Aug 2021 09:25:34 +0000 (11:25 +0200)] 
wolfSSL: Implement tls_connection_get_peer_subject()

This is needed for EAP-TEAP server implementation.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Implement tls_connection_get_own_cert_used()
Juliusz Sosinowicz [Thu, 26 Aug 2021 09:25:34 +0000 (11:25 +0200)] 
wolfSSL: Implement tls_connection_get_own_cert_used()

This is needed for EAP-TEAP client implementation. This needs wolfSSL
5.0.0 or newer.

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agowolfSSL: Conditional build for aes_wrap/aes_unwrap()
Juliusz Sosinowicz [Thu, 26 Aug 2021 09:25:34 +0000 (11:25 +0200)] 
wolfSSL: Conditional build for aes_wrap/aes_unwrap()

Signed-off-by: Juliusz Sosinowicz <juliusz@wolfssl.com>
3 years agoeapol_test: Update with src/ap/ieee802_1x.c changes
Jouni Malinen [Sun, 17 Apr 2022 09:04:14 +0000 (12:04 +0300)] 
eapol_test: Update with src/ap/ieee802_1x.c changes

eapol_test.c contains variants of couple of functions from the hostapd
implementation. Those had not been updated for a while and this commit
brings in the main changes to keep the implementations closer to
each other.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoInclude MS_FUNCS=y for EAP-pwd peer build
Jouni Malinen [Sun, 17 Apr 2022 09:30:56 +0000 (12:30 +0300)] 
Include MS_FUNCS=y for EAP-pwd peer build

This is needed to allow wpa_supplicant to be built with EAP-pwd, but
without any other EAP method that pulled in MS_FUNCS.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoInclude HMAC-SHA384/512 KDF for SAE if SHA384/512 is included
Jouni Malinen [Sun, 17 Apr 2022 09:28:41 +0000 (12:28 +0300)] 
Include HMAC-SHA384/512 KDF for SAE if SHA384/512 is included

It was possible to miss the HMAC functions if some other build
configuration parameters ended up setting NEED_SHA384/512=y.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoACS: Honor acs_exclude_dfs with hostapd's ACS implementation
Nicolas Escande [Thu, 24 Mar 2022 12:46:00 +0000 (13:46 +0100)] 
ACS: Honor acs_exclude_dfs with hostapd's ACS implementation

The acs_exclude_dfs parameter is documented as a way to exclude DFS
channels when performing ACS without disabling DFS altogether. The
problem is this parameter is only enforced when ACS is offloaded to the
driver (WPA_DRIVER_FLAGS_ACS_OFFLOAD). So from now on, lets also check
acs_exclude_dfs in the internal ACS implementation to exclude channels
marked with radar detection.

Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
3 years agoeapol_test: Print out names for additional known EAP types
Alan T. DeKok [Sat, 9 Apr 2022 17:47:05 +0000 (13:47 -0400)] 
eapol_test: Print out names for additional known EAP types

And order the names by number.

Signed-off-by: Alan DeKok <aland@freeradius.org>
3 years agoOpenSSL: Unload providers only at process exit
Jouni Malinen [Sat, 16 Apr 2022 15:48:29 +0000 (18:48 +0300)] 
OpenSSL: Unload providers only at process exit

The previous mechanism of unloaded the providers from tls_deinit() did
not work correctly for some cases. In particular, it was possible for
hostapd to end up unloading both providers and not being able to recover
from this if TLS server was not enabled.

Address this more cleanly by introducing a new crypto_unload() function
that will be called when the process is exiting.

Fixes: 097ca6bf0b6f ("OpenSSL: Unload providers on deinit")
Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoBSS coloring: Handle the collision and CCA events coming from the kernel
John Crispin [Mon, 21 Mar 2022 11:10:34 +0000 (12:10 +0100)] 
BSS coloring: Handle the collision and CCA events coming from the kernel

This commit activates the functionality of the previous commits by
handling the actual events that will trigger the CCA process.

Tested-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
3 years agonl80211: Handle driver events for BSS coloring
John Crispin [Mon, 21 Mar 2022 11:10:34 +0000 (12:10 +0100)] 
nl80211: Handle driver events for BSS coloring

Process the color collision and color change related events.

Tested-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
3 years agonl80211: Add the switch_color() handler for BSS color changes
John Crispin [Mon, 21 Mar 2022 11:10:33 +0000 (12:10 +0100)] 
nl80211: Add the switch_color() handler for BSS color changes

To start the CCA process we need to send NL80211_CMD_COLOR_CHANGE to the
kernel. This commit adds the required code.

Tested-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
3 years agoBSS coloring: Disable BSS color during CCA
John Crispin [Mon, 21 Mar 2022 11:10:32 +0000 (12:10 +0100)] 
BSS coloring: Disable BSS color during CCA

While we are doing CCA the BSS Color Disabled field inside the HE
Operation Parameters field needs to be set.

Tested-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
3 years agoBSS coloring: BSS Color Change Announcement element generation
John Crispin [Mon, 21 Mar 2022 11:10:31 +0000 (12:10 +0100)] 
BSS coloring: BSS Color Change Announcement element generation

This information element is similar to the CSA one. It contains a
counter and the target color. Once the counter expired, the change to
the new color happens.

Just note the current implementation is based on CCA counter attributes
that only take Beacon and Probe Response framesinto account.
(Re)Association Response frames do not currently have kernel APIs to
decrement the CCA counter since mediatek mcu firmware does not support
it yet and it will be added in future firmware release.

Tested-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
3 years agoBSS coloring: Handling of collision events and triggering CCA
John Crispin [Mon, 21 Mar 2022 11:10:30 +0000 (12:10 +0100)] 
BSS coloring: Handling of collision events and triggering CCA

Add the core code for handling BSS color collision events and triggering
CCA inside the kernel. The caller of hostapd_switch_color() will be
added in the following commits.

Tested-by: Peter Chiu <chui-hao.chiu@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
3 years agotests: Pretend the RNG is initialized withinthe VM
Johannes Berg [Mon, 11 Apr 2022 09:41:20 +0000 (11:41 +0200)] 
tests: Pretend the RNG is initialized withinthe VM

We don't particularly care about the quality of random numbers
during the test. So far, there hasn't been an issue with the
RNG not being initialized completely, we only get a few prints
about uninitialized reads from urandom. However, if some tool
were to actually use /dev/random, it might get stuck. Call the
RNDADDTOENTCNT ioctl to unblock this.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
3 years agowpa_supplicant: Add the CONFIG_HE_OVERRIDES option to the defconfig
Yegor Yefremov [Tue, 12 Apr 2022 17:08:19 +0000 (19:08 +0200)] 
wpa_supplicant: Add the CONFIG_HE_OVERRIDES option to the defconfig

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
3 years agotests: Update server and user certificates (2022)
Jouni Malinen [Sat, 16 Apr 2022 10:22:16 +0000 (13:22 +0300)] 
tests: Update server and user certificates (2022)

The previous versions are going to be expiring soon, so need to re-sign
these to avoid EAP test case failures. This contains updates from
running tests/hwsim/auth_server/update.sh.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoOpenSSL: Do not use the deprecated RSAPrivateKey function
Jouni Malinen [Sat, 16 Apr 2022 09:45:32 +0000 (12:45 +0300)] 
OpenSSL: Do not use the deprecated RSAPrivateKey function

Comment out the call to SSL_use_RSAPrivateKey_ASN1() function when using
OpenSSL 3.0 since that function was deprecated and there does not seem
to be any significant use case for supporting DER encoded RSAPrivateKey
structure in the private key blob.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoOpenSSL: Generate DH parameters automatically if not set with dh_file
Jouni Malinen [Sat, 16 Apr 2022 08:38:44 +0000 (11:38 +0300)] 
OpenSSL: Generate DH parameters automatically if not set with dh_file

This is the recommended way of using DH in OpenSSL TLS handshake.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoOpenSSL: Convert DH/DSA parameter loading to new API
Jouni Malinen [Sat, 16 Apr 2022 08:32:21 +0000 (11:32 +0300)] 
OpenSSL: Convert DH/DSA parameter loading to new API

OpenSSL 3.0 has deprecated low-level DH/DSA functions. Convert this
loading of the dh_file parameter to use newer API.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoRemove unused dh_blob parameter
Jouni Malinen [Sat, 16 Apr 2022 07:45:17 +0000 (10:45 +0300)] 
Remove unused dh_blob parameter

This was used earlier in the wpa_supplicant configuration, but there was
no real use for that, so remove the now completely unused parameter to
simplify implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoRemove useless DH file configuration from TLS library wrappers
Jouni Malinen [Fri, 15 Apr 2022 20:37:23 +0000 (23:37 +0300)] 
Remove useless DH file configuration from TLS library wrappers

These operations do not really have any effect since
tls_connection_set_params() is used only in the TLS client case and the
client receives the DH parameters from the server instead of local
configuration.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Remove unused DH file from TLS client fuzzer
Jouni Malinen [Fri, 15 Apr 2022 20:37:01 +0000 (23:37 +0300)] 
tests: Remove unused DH file from TLS client fuzzer

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoRemove DH file configuration from TLS client functionality
Jouni Malinen [Fri, 15 Apr 2022 20:30:10 +0000 (23:30 +0300)] 
Remove DH file configuration from TLS client functionality

The DH file parameters are applicable only for the TLS server, so this
parameter did not really have any impact to functionality. Remove it to
get rid of useless code and confusing documentation for the network
block configuration.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Remove test cases for wpa_supplicant dh_file parameter
Jouni Malinen [Fri, 15 Apr 2022 20:41:14 +0000 (23:41 +0300)] 
tests: Remove test cases for wpa_supplicant dh_file parameter

This parameter has no impact to TLS client functionality, so these is
not really any point to maintain these test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoRADIUS attributes for EAPOL-Key message details
Jouni Malinen [Fri, 15 Apr 2022 14:36:25 +0000 (17:36 +0300)] 
RADIUS attributes for EAPOL-Key message details

Use vendor specific RADIUS attributes for sending ANonce and EAPOL-Key
msg 2/4 for the wpa_psk_radius=3 case. The vendor specific attributes
for this are defined in FreeRADIUS as follows:

BEGIN-VENDOR    FreeRADIUS      format=Extended-Vendor-Specific-5
ATTRIBUTE       FreeRADIUS-802.1X-Anonce        1       octets[32]
ATTRIBUTE       FreeRADIUS-802.1X-EAPoL-Key-Msg 2       octets
END-VENDOR      FreeRADIUS

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoRADIUS: Attributes with Extended Types (RFC 6929)
Jouni Malinen [Fri, 15 Apr 2022 14:31:48 +0000 (17:31 +0300)] 
RADIUS: Attributes with Extended Types (RFC 6929)

Supported extended types for RADIUS attributes for the cases defined in
RFC 6929.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Fix ap_wpa2_eap_fast_eap_vendor to check EAP-FAST support in build
Jouni Malinen [Fri, 15 Apr 2022 10:49:19 +0000 (13:49 +0300)] 
tests: Fix ap_wpa2_eap_fast_eap_vendor to check EAP-FAST support in build

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Use group 20 instead of 25 in some SAE test cases
Jouni Malinen [Fri, 15 Apr 2022 10:47:58 +0000 (13:47 +0300)] 
tests: Use group 20 instead of 25 in some SAE test cases

BoringSSL does not support group 25, so replace these cases with a
supported group 20 to meet the real testing need here.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Skip sigma_dut_suite_b_rsa DHE case with BoringSSL
Jouni Malinen [Fri, 15 Apr 2022 10:43:30 +0000 (13:43 +0300)] 
tests: Skip sigma_dut_suite_b_rsa DHE case with BoringSSL

BoringSSL is known not to support this option, so skip it to allow rest
of the test case to be performed without known failures.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Skip sae_pwe_group_25 with BoringSSL
Jouni Malinen [Fri, 15 Apr 2022 10:36:35 +0000 (13:36 +0300)] 
tests: Skip sae_pwe_group_25 with BoringSSL

BoringSSL does not support this 192-bit EC group, so do not try to run
the test case that is known to fail.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoBoringSSL: Use accessor functions for X509 key usage flags
Jouni Malinen [Fri, 15 Apr 2022 09:58:03 +0000 (12:58 +0300)] 
BoringSSL: Use accessor functions for X509 key usage flags

BoringSSL commit dddb60eb9700110835ff6e2b429de40a17006429 ("Make most of
crypto/x509 opaque.") broke the direct access to these variables, so use
the accessor functions instead.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoBoringSSL: Replace stack-allocated X509_STORE_CTX with heap one
Jouni Malinen [Fri, 15 Apr 2022 09:50:51 +0000 (12:50 +0300)] 
BoringSSL: Replace stack-allocated X509_STORE_CTX with heap one

BoringSSL commit dddb60eb9700110835ff6e2b429de40a17006429 ("Make most of
crypto/x509 opaque.") broke the stack-allocated version, so move to
using X509_STORE_CTX_new() to get an opaque pointer to X509_STORE_CTX
instead.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agotests: Build with LibreSSL 3.4
Jouni Malinen [Fri, 15 Apr 2022 09:34:05 +0000 (12:34 +0300)] 
tests: Build with LibreSSL 3.4

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