]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
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>
5 years agoUBSan: Avoid size_t variable overflow in control interface
Jouni Malinen [Sat, 23 Feb 2019 10:49:17 +0000 (12:49 +0200)] 
UBSan: Avoid size_t variable overflow in control interface

The loop "if (i-- == 0) break" style construction works in practice fine
since the check against 0 is done before decrementation. However, this
hits an UBSan warning, so split that decrementation to happen as a
separate step after the check and break from the loop.

ctrl_iface.c:5086:9: 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 is throughput estimation
Jouni Malinen [Sat, 23 Feb 2019 10:42:20 +0000 (12:42 +0200)] 
UBSan: Avoid unsigned integer overflow is throughput estimation

wpa_scan_result_compar() would return wb->est_throughput -
wa->est_throughput in case the comparison is done based on the
throughput estimates. While the return value from this function is a
signed integer, these est_throughput values are unsigned integers and
need to be explicitly typecast to avoid an UBSan warning.

scan.c:1996:30: runtime error: unsigned integer overflow: 54000 - 135000 cannot be represented in type 'unsigned int'

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoModify dl_list_for_each() to not use unaligned access with WPA_TRACE
Jouni Malinen [Sat, 23 Feb 2019 10:07:21 +0000 (12:07 +0200)] 
Modify dl_list_for_each() to not use unaligned access with WPA_TRACE

UBSan testing with WPA_TRACE=y ended up hitting an unaligned access for
struct os_alloc_trace in os_program_deinit() because of the
dl_list_for_each() design that looked like dereferencing the member
element of the list head which is something that does not exist.

Get the first entry from the list using dl_list_first() so that the
empty list special case is covefred and compare item pointers instead of
struct dl_list pointers to check whether the end of the loop has been
reached.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoMulti-AP: Avoid memcpy(ptr, NULL, 0) in WPS Registrar initialization
Jouni Malinen [Sat, 23 Feb 2019 09:37:20 +0000 (11:37 +0200)] 
Multi-AP: Avoid memcpy(ptr, NULL, 0) in WPS Registrar initialization

This can result in compiler warnings due to the unexpected NULL pointer
as a source memory even when the length of the copied data is 0.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoFix cipher suite selector default value in RSNE for DMG
Lior David [Wed, 6 Feb 2019 10:33:35 +0000 (12:33 +0200)] 
Fix cipher suite selector default value in RSNE for DMG

According to IEEE Std 802.11-2016, 9.4.2.25 when fields of an RSNE are
not included, the default values are used. The cipher suite defaults
were hardcoded to CCMP in the previous implementation, but the default
is actually different for DMG: GCMP (per 9.4.2.25.2).

It is not possible to find out from the RSNE if the network is non-DMG
or DMG, so callers of wpa_parse_wpa_ie_rsn() need to handle this case
based on context, which can be different for each caller.

In order to fix this issue, add flags to the wpa_ie_data indicating
whether pairwise/group ciphers were included in the RSNE. Callers can
check these flags and fill in the appropriate ciphers. The
wpa_parse_wpa_ie_rsn() function still initializes the ciphers to CCMP by
default so existing callers will not break. This change also fixes some
callers which need to handle the DMG network case.

Signed-off-by: Lior David <liord@codeaurora.org>
5 years agoAdd new QCA vendor attributes for coex configuration
Jiani Liu [Mon, 18 Feb 2019 05:39:49 +0000 (13:39 +0800)] 
Add new QCA vendor attributes for coex configuration

Signed-off-by: Jiani Liu <jianil@codeaurora.org>
5 years agoAdd a vendor attribute for specifying ethernet protocol type
Arun Kumar Khandavalli [Tue, 19 Feb 2019 07:13:59 +0000 (12:43 +0530)] 
Add a vendor attribute for specifying ethernet protocol type

This new QCA vendor attribute adds provision to specify the
ethernet protocol id from userspace to the packets which are
offloaded to the driver/firmware (e.g., IPv4, IPv6).

Signed-off-by: Arun Kumar Khandavalli <akhandav@codeaurora.org>
5 years agotests: Multi-AP WPS provisioning
Arnout Vandecappelle (Essensium/Mind) [Tue, 12 Feb 2019 14:35:28 +0000 (15:35 +0100)] 
tests: Multi-AP WPS provisioning

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
5 years agohostapd: Add README-MULTI-AP
Arnout Vandecappelle (Essensium/Mind) [Tue, 12 Feb 2019 14:35:27 +0000 (15:35 +0100)] 
hostapd: Add README-MULTI-AP

Document what hostapd and wpa_supplicant do for Multi-AP.

This is only included in hostapd, since a Multi-AP device is always an
access point so it should have hostapd.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
5 years agohostapd: Support Multi-AP backhaul STA onboarding with WPS
Davina Lu [Tue, 12 Feb 2019 14:35:26 +0000 (15:35 +0100)] 
hostapd: Support Multi-AP backhaul STA onboarding with WPS

The Wi-Fi Alliance Multi-AP Specification v1.0 allows onboarding of a
backhaul STA through WPS. To enable this, the WPS Registrar offers a
different set of credentials (backhaul credentials instead of fronthaul
credentials) when the Multi-AP subelement is present in the WFA vendor
extension element of the WSC M1 message.

Add new configuration options to specify the backhaul credentials for
the hostapd internal registrar: multi_ap_backhaul_ssid,
multi_ap_backhaul_wpa_psk, multi_ap_backhaul_wpa_passphrase. These are
only relevant for a fronthaul SSID, i.e., where multi_ap is set to 2 or
3. When these options are set, pass the backhaul credentials instead of
the normal credentials when the Multi-AP subelement is present.

Ignore the Multi-AP subelement if the backhaul config options are not
set. Note that for an SSID which is fronthaul and backhaul at the same
time (i.e., multi_ap == 3), this results in the correct credentials
being sent anyway.

The security to be used for the backaul BSS is fixed to WPA2PSK. The
Multi-AP Specification only allows Open and WPA2PSK networks to be
configured. Although not stated explicitly, the backhaul link is
intended to be always encrypted, hence WPA2PSK.

To build the credentials, the credential-building code is essentially
copied and simplified. Indeed, the backhaul credentials are always
WPA2PSK and never use per-device PSK. All the options set for the
fronthaul BSS WPS are simply ignored.

Signed-off-by: Davina Lu <ylu@quantenna.com>
Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Marianna Carrera <marianna.carrera.so@quantenna.com>
5 years agowpa_supplicant: Support Multi-AP backhaul STA onboarding with WPS
Davina Lu [Tue, 12 Feb 2019 14:35:25 +0000 (15:35 +0100)] 
wpa_supplicant: Support Multi-AP backhaul STA onboarding with WPS

The Wi-Fi Alliance Multi-AP Specification v1.0 allows onboarding of a
backhaul STA through WPS. To enable this, the backhaul STA needs to add
a Multi-AP IE to the WFA vendor extension element in the WSC M1 message
that indicates it supports the Multi-AP backhaul STA role. The Registrar
(if it support Multi-AP onboarding) will respond to that with a WSC M8
message that also contains the Multi-AP IE, and that contains the
credentials for the backhaul SSID (which may be different from the SSID
on which WPS is performed).

Introduce a new parameter to wpas_wps_start_pbc() and allow it to be
set via control interface's new multi_ap=1 parameter of WPS_PBC call.
multi_ap_backhaul_sta is set to 1 in the automatically created SSID.
Thus, if the AP does not support Multi-AP, association will fail and
WPS will be terminated.

Only wps_pbc is supported.

This commit adds the multi_ap argument only to the control socket
interface, not to the D-Bus interface.

Since WPS associates with the fronthaul BSS instead of the backhaul BSS,
we should not drop association if the AP announces fronthaul-only BSS.
Still, we should only do that in the specific case of WPS. Therefore,
add a check to multi_ap_process_assoc_resp() to allow association with a
fronthaul-only BSS if and only if key_mgmt contains WPS.

Signed-off-by: Davina Lu <ylu@quantenna.com>
Signed-off-by: Igor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Cc: Marianna Carrera <marianna.carrera.so@quantenna.com>
5 years agoWPS: Add multi_ap_subelem to wps_build_wfa_ext()
Arnout Vandecappelle (Essensium/Mind) [Tue, 12 Feb 2019 14:35:24 +0000 (15:35 +0100)] 
WPS: Add multi_ap_subelem to wps_build_wfa_ext()

The Multi-AP specification adds a new subelement to the WFA extension
element in the WPS exchange. Add an additional parameter to
wps_build_wfa_ext() to add this subelement. The subelement is only added
if the parameter is nonzero. Note that we don't reuse the existing
MULTI_AP_SUB_ELEM_TYPE definition here, but rather define a new
WFA_ELEM_MULTI_AP, to make sure the enum of WFA subelement types for WPS
vendor extension remains complete.

For now, all callers set the multi_ap_subelem parameter to 0.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
5 years agotests: Update multi_ap_fronthaul_on_ap to match implementation
Arnout Vandecappelle (Essensium/Mind) [Tue, 12 Feb 2019 14:35:23 +0000 (15:35 +0100)] 
tests: Update multi_ap_fronthaul_on_ap to match implementation

Now that the backhaul STA Multi-AP association is not rejected anymore
by the AP, update the test case to expect disconnection to be triggered
by the STA.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
5 years agoMulti-AP: Don't reject backhaul STA on fronthaul BSS
Arnout Vandecappelle (Essensium/Mind) [Tue, 12 Feb 2019 14:35:23 +0000 (15:35 +0100)] 
Multi-AP: Don't reject backhaul STA on fronthaul BSS

The Multi-AP specification only specifies that information elements have
to be added to the Association Request and Association Response frame;
it doesn't specify anything about what should be done in case they are
missing. Previously, we rejected non-backhaul associations on a
backhaul-only BSS, and non-fronthaul associations on a fronthaul-only
BSS.

However, this makes WPS fail when fronthaul and backhaul are separate
SSIDs. Indeed, WPS for the backhaul link is performed on the *fronthaul*
SSID. Thus, the Association Request frmae used for WPS *will* contain
the Multi-AP IE indicating a backhaul STA. Rejecting that association
makes WPS fail.

Therefore, accept a multi-AP backhaul STA Association Request frame on a
fronthaul-only BSS. Still issue a warning about it, but only at level
DEBUG intead of INFO. Also change the condition checking to make it
clearer.

While we're at it, also fix the handling of unexpected bits in the
Multi-AP IE. 4 bits are reserved in the specification, so these
certainly have to be ignored. The specification also doesn't say that
setting one of the other bits is not allowed. Therefore, only report
unexpected values in the Multi-AP IE, don't reject because of it. Note
that a malformed IE (containing more than one byte) still triggers a
rejection.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
5 years agotests: Refactor test_multi_ap
Arnout Vandecappelle (Essensium/Mind) [Tue, 12 Feb 2019 14:35:22 +0000 (15:35 +0100)] 
tests: Refactor test_multi_ap

With just one additional argument, the run_multi_ap_association()
function can be used for all tests.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
5 years agoHS 2.0: Make hs20-osu-client SP and <FQDN> directories group writable
Purushottam Kushwaha [Sat, 16 Feb 2019 06:43:12 +0000 (12:13 +0530)] 
HS 2.0: Make hs20-osu-client SP and <FQDN> directories group writable

This updates SP/<FQDN> directory with following permissions on Android
to allow moving certificate at runtime from Cert/ to SP/<FQDN> folder:
 - user:read/write/exec
 - group:read/write/exec
(i.e., add group write permission)

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agomesh: More consistent checking of wpa_s->ifmsh in completion handler
Jouni Malinen [Mon, 18 Feb 2019 16:46:40 +0000 (18:46 +0200)] 
mesh: More consistent checking of wpa_s->ifmsh in completion handler

It does not look like wpa_s->ifmsg could be NULL here, but better be
more consistent anyway to keep static analyzers happier by avoiding
dereference of wpa_s->ifmsh in the function before the NULL check for
it.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Empty token in wpa_psk_file
Jouni Malinen [Mon, 18 Feb 2019 16:41:43 +0000 (18:41 +0200)] 
tests: Empty token in wpa_psk_file

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoFix wpa_psk_file parser error case handling
Jouni Malinen [Mon, 18 Feb 2019 16:24:52 +0000 (18:24 +0200)] 
Fix wpa_psk_file parser error case handling

str_token() can return NULL for the name if the remaining token contains
only the delimiter. Fix this to avoid NULL pointer dereference with a
corner case of an invalid value used in the configuration.

Fixes: ec5c39a5574d ("AP: Allow identifying which passphrase station used with wpa_psk_file")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Mark log files to use utf-8 encoding
Jouni Malinen [Mon, 18 Feb 2019 16:19:06 +0000 (18:19 +0200)] 
tests: Mark log files to use utf-8 encoding

This seems to be needed when using python3 in VM for the ssid_utf8 test
case debug prints from the control interface requests. This breaks
python2 support for the same logging entries, but there does not seem to
be any easy way of addressing this in a manner that works for both
python versions, so move ahead with the python3-only support from now
on.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Switch default python version to 3
Masashi Honma [Tue, 12 Feb 2019 08:59:40 +0000 (17:59 +0900)] 
tests: Switch default python version to 3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: AP VLAN based on SAE Password Identifier
Jouni Malinen [Sun, 17 Feb 2019 15:22:28 +0000 (17:22 +0200)] 
tests: AP VLAN based on SAE Password Identifier

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoSAE: VLAN assignment based on SAE Password Identifier
Jouni Malinen [Sun, 17 Feb 2019 15:22:37 +0000 (17:22 +0200)] 
SAE: VLAN assignment based on SAE Password Identifier

The new sae_password parameter [|vlanid=<VLAN ID>] can now be used to
assign stations to a specific VLAN based on which SAE Password
Identifier they use. This is similar to the WPA2-Enterprise case where
the RADIUS server can assign stations to different VLANs and the
WPA2-Personal case where vlanid parameter in wpa_psk_file is used.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Force diff chan in p2ps_channel_active_go_and_station_different_mcc
Jouni Malinen [Sun, 17 Feb 2019 14:55:50 +0000 (16:55 +0200)] 
tests: Force diff chan in p2ps_channel_active_go_and_station_different_mcc

This test case was failing pretty frequently due to an issue in being
able to send out the Provision Discovery Response frame on the operating
channel. Now that wpa_supplicant has a fix for that issue, modify this
test case to hit this error condition every time. In addition, make sure
the possible exception from p2ps_exact_seek() does not get hidden with a
failing remove_group() call in the finally section.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoP2P: Stop listen state if Action frame TX is needed on another channel
Jouni Malinen [Sun, 17 Feb 2019 14:53:03 +0000 (16:53 +0200)] 
P2P: Stop listen state if Action frame TX is needed on another channel

This speeds up P2P responses to frames received on an operating channel
in case there is an ongoing P2P listen operation on another channel.
This is applicable to drivers that support multiple channels in
concurrently.

This addresses an issue showing up in the
p2ps_channel_active_go_and_station_different_mcc test case where the
Provision Discovery Request frame can be received on the operating
channel of a group instead of the Listen channel. The response was
delayed until the listen operation timed out and this took too long time
for the peer to receive the response.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoP2P: Fix a typo in a debug message
Jouni Malinen [Sun, 17 Feb 2019 14:24:34 +0000 (16:24 +0200)] 
P2P: Fix a typo in a debug message

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: OpenSSL ECDH curve configuration
Jouni Malinen [Sun, 17 Feb 2019 12:01:30 +0000 (14:01 +0200)] 
tests: OpenSSL ECDH curve configuration

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agohostapd: Document openssl_ecdh_curves configuration parameter
Hristo Venev [Thu, 20 Apr 2017 13:44:31 +0000 (14:44 +0100)] 
hostapd: Document openssl_ecdh_curves configuration parameter

Signed-off-by: Hristo Venev <hristo@venev.name>
5 years agotests: EAP-PEAP/EAP-GTC
Jouni Malinen [Fri, 15 Feb 2019 10:03:45 +0000 (12:03 +0200)] 
tests: EAP-PEAP/EAP-GTC

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoAdd QCA vendor subcmd/attribute to check wlan firmware state
Qun Zhang [Wed, 13 Feb 2019 02:35:26 +0000 (10:35 +0800)] 
Add QCA vendor subcmd/attribute to check wlan firmware state

Allow user space applications to check whether wlan firmware is alive
through an nl80211 vendor command.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: Wi-Fi generation indication for HT and VHT
Jouni Malinen [Thu, 14 Feb 2019 20:36:40 +0000 (22:36 +0200)] 
tests: Wi-Fi generation indication for HT and VHT

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoIndicate wifi_generation in wpa_supplicant STATUS output
Jouni Malinen [Thu, 14 Feb 2019 20:24:16 +0000 (22:24 +0200)] 
Indicate wifi_generation in wpa_supplicant STATUS output

This adds a wifi_generation=4/5/6 line to the STATUS output if the
driver reports (Re)Association Request frame and (Re)Association
Response frame information elements in the association or connection
event. Only the generations 4 (HT = 802.11n), 5 (VHT = 802.11ac), and 6
(HE = 802.11ax) are reported.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoAdd HE Capabilities into ieee802_11_parse_elems()
Jouni Malinen [Thu, 14 Feb 2019 20:23:05 +0000 (22:23 +0200)] 
Add HE Capabilities into ieee802_11_parse_elems()

This is needed to determine whether an association negotiated use of HE.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agonl80211: (Re)Association Request frame IEs from association event
Jouni Malinen [Thu, 14 Feb 2019 20:01:20 +0000 (22:01 +0200)] 
nl80211: (Re)Association Request frame IEs from association event

Process NL80211_ATTR_REQ_IE from the NL80211_CMD_ASSOCIATE event to
allow request IEs to be made available for the SME-in-wpa_supplicant
case similarly to how this is done with SME-in-driver with
NL80211_CMD_CONNECT.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: ap_wpa_ie_parsing to allow EAPOL-Key msg 2/4 rejection
Jouni Malinen [Fri, 15 Feb 2019 00:06:46 +0000 (02:06 +0200)] 
tests: ap_wpa_ie_parsing to allow EAPOL-Key msg 2/4 rejection

Once mac80211 starts reporting the used Association Request frame IEs in
the association event, wpa_supplicant will update RSN supplicant IE
information based on that and that will make the AP reject EAPOL-Key msg
2/4 in this particular test scenario due to the hack of including two
RSN IEs in the Association Request frame. Accept this sequence as a
valid test execution in addition to the previously expected connection
to avoid reporting incorrect failures.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: AP VLAN based on PSK/passphrase
Jouni Malinen [Thu, 14 Feb 2019 11:34:17 +0000 (13:34 +0200)] 
tests: AP VLAN based on PSK/passphrase

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoVLAN assignment based on used WPA/WPA2 passphrase/PSK
Jouni Malinen [Thu, 14 Feb 2019 11:34:33 +0000 (13:34 +0200)] 
VLAN assignment based on used WPA/WPA2 passphrase/PSK

Extend wpa_psk_file to allow an optional VLAN ID to be specified with
"vlanid=<VLAN ID>" prefix on the line. If VLAN ID is specified and the
particular wpa_psk_file entry is used for a station, that station is
bound to the specified VLAN. This can be used to operate a single
WPA2-Personal BSS with multiple VLANs based on the used passphrase/PSK.
This is similar to the WPA2-Enterprise case where the RADIUS server can
assign stations to different VLANs.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoHS 2.0 server: Add X-WFA-Hotspot20-Filtering header line to T&C
Jouni Malinen [Thu, 14 Feb 2019 10:09:09 +0000 (12:09 +0200)] 
HS 2.0 server: Add X-WFA-Hotspot20-Filtering header line to T&C

When filtering is successfully disabled at the end of the terms and
conditions acceptance sequence, add the "X-WFA-Hotspot20-Filtering:
remove" header line to the HTTP response.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: DPP and two initiators
Jouni Malinen [Thu, 14 Feb 2019 09:50:40 +0000 (11:50 +0200)] 
tests: DPP and two initiators

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoHE: Fix set_he_cap() parsing of config options for MU EDCA Params
Jouni Malinen [Mon, 11 Feb 2019 23:16:13 +0000 (01:16 +0200)] 
HE: Fix set_he_cap() parsing of config options for MU EDCA Params

When I replaced the POS() function with ffs() when applying relevant
parts from the original patch, this ended up breaking the frame
construction since the POS() function was supposed to count the bit
offset for the mask with 0 being the LSB instead of 1 returned by ffs().
Furthermore, ffs() is not available in all C libraries (e.g., not
directly exposed by strings.h on Android), so better not depend on that
or compiler builtins for this since there is no need for this to be as
fast as possible in configuration parsing.

Fix this with a simple function to determine the number of bits the
value needs to be shifted left to align with the mask.

Fixes: 11ce7a1bc3e2 ("HE: Add MU EDCA Parameter Set element (AP)")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agotests: AP not receiving Authentication frame ACK
Jouni Malinen [Mon, 11 Feb 2019 15:41:13 +0000 (17:41 +0200)] 
tests: AP not receiving Authentication frame ACK

Verify that the not-associated STA gets deauthenticated, not
disassociated, on inactivity timeout.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoDo not disassociate not-associated STA on timeout
Jouni Malinen [Mon, 11 Feb 2019 15:37:08 +0000 (17:37 +0200)] 
Do not disassociate not-associated STA on timeout

If the ap_handle_timer() timeout is reached for a not-associated STA, do
not default to disassociating that STA first since Disassociation frame
is not really appropriate to send to a STA that is not in associated
state. Instead, skip directly to deauthentication and STA entry removal.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
5 years agoOpenSSL: Fix uninitialized variable in CRL reloading corner case
Jouni Malinen [Mon, 11 Feb 2019 12:00:13 +0000 (14:00 +0200)] 
OpenSSL: Fix uninitialized variable in CRL reloading corner case

The flags variable needs to be initialized to 0 if check_crl is 0 in
the updated configuration.

Fixes: 159a7fbdeafe ("crl_reload_interval: Add CRL reloading support")
Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoUse for_each_element() in ieee802_11_parse_elems()
Jouni Malinen [Mon, 11 Feb 2019 11:51:11 +0000 (13:51 +0200)] 
Use for_each_element() in ieee802_11_parse_elems()

Use the new iteration macro to simplify the impelmentation and make it
more consistent with other IE parsers.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agocommon: Use for_each_element_id/_extid for get_ie/get_ie_ext/get_vendor_ie
Johannes Berg [Fri, 8 Feb 2019 16:57:52 +0000 (17:57 +0100)] 
common: Use for_each_element_id/_extid for get_ie/get_ie_ext/get_vendor_ie

Simplifications based on the new iteration macros.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocommon: Use for_each_element_id() in mb_ies_info_by_ies()
Johannes Berg [Fri, 8 Feb 2019 16:57:51 +0000 (17:57 +0100)] 
common: Use for_each_element_id() in mb_ies_info_by_ies()

The change is bigger because here we need to catch the error
condition if the last element doesn't fit.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocommon: Use for_each_element_id() in ieee802_11_vendor_ie_concat()
Johannes Berg [Fri, 8 Feb 2019 16:57:50 +0000 (17:57 +0100)] 
common: Use for_each_element_id() in ieee802_11_vendor_ie_concat()

Simple cleanup using the new iteration helper macro.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocommon: Use for_each_element() in ieee802_11_ie_count()
Johannes Berg [Fri, 8 Feb 2019 16:57:49 +0000 (17:57 +0100)] 
common: Use for_each_element() in ieee802_11_ie_count()

Simple cleanup using the new macros.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agocommon: Add strongly typed element iteration macros
Johannes Berg [Fri, 8 Feb 2019 16:57:48 +0000 (17:57 +0100)] 
common: Add strongly typed element iteration macros

Rather than always iterating elements from frames with pure
u8 pointers, add a type "struct element" that encapsulates
the id/datalen/data format of them.

Then, add the element iteration macros
 * for_each_element
 * for_each_element_id
 * for_each_element_extid

which take, as their first 'argument', such a structure and
iterate through a given u8 array interpreting it as elements.

While at it also add
 * for_each_subelement
 * for_each_subelement_id
 * for_each_subelement_extid

which instead of taking data/length just take an outer element
and use its data/datalen.

Also add for_each_element_completed() to determine if any of
the loops above completed, i.e., it was able to parse all of
the elements successfully and no data remained.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
5 years agotests: Catch only specific exceptions
Masashi Honma [Sun, 10 Feb 2019 08:43:10 +0000 (17:43 +0900)] 
tests: Catch only specific exceptions

This allows unexpected cases to terminate parallel-vm.py without being
hidden by the exception handler.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
5 years agotests: Document some of the test tools
Jouni Malinen [Sun, 10 Feb 2019 15:59:38 +0000 (17:59 +0200)] 
tests: Document some of the test tools

This will hopefully make it easier for others to use these test tools.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: Fix wnm-fuzzer by adding dummy configuration
Jouni Malinen [Sun, 10 Feb 2019 15:55:42 +0000 (17:55 +0200)] 
tests: Fix wnm-fuzzer by adding dummy configuration

Some of the WNM implementation expects configuration to be available
(e.g., ieee802_!1_rx_wnm_coloc_intf_req() dereferences wpa_s->conf), so
add a dummy configuration to allow the fuzzer tool to be used.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: EAPOL-Key fuzzing tool
Jouni Malinen [Sun, 10 Feb 2019 15:02:49 +0000 (17:02 +0200)] 
tests: EAPOL-Key fuzzing tool

Add test-eapol program that can be used for fuzzing the EAPOL-Key
Supplicant and Authenticator implementations. This tool can write
Supplicant or Authenticator messages into a file as an initialization
step and for the fuzzing step, that file (with potential modifications)
can be used to replace the internally generated message contents.

The TEST_FUZZ=y build parameter is used to make a special build where a
hardcoded random number generator and hardcoded timestamp are used to
force deterministic behavior for the EAPOL-Key operations. This will
also make the implementation ignore Key MIC and AES keywrap errors to
allow processing of modified messages to continue further.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoRSN: Do not start preauthentication timer without candidates
Jouni Malinen [Sun, 10 Feb 2019 11:41:10 +0000 (13:41 +0200)] 
RSN: Do not start preauthentication timer without candidates

There is no need to schedule the postponed RSN preauthentication start
if there are no candidates. Avoid wasting eloop resources for this.

This is most useful for fuzz testing of the 4-way handshake
implementation to avoid getting stuck waiting for this unnecessary one
second time when using eloop to coordinate the Authenticator and
Supplicant state machines.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoeap_example: Update expired certificates
Jouni Malinen [Sun, 10 Feb 2019 09:39:05 +0000 (11:39 +0200)] 
eap_example: Update expired certificates

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoJSON: Fix string parsing when \\ escape is at the end of buffer
Jouni Malinen [Sat, 9 Feb 2019 23:40:36 +0000 (01:40 +0200)] 
JSON: Fix string parsing when \\ escape is at the end of buffer

This would have resulted in reading one octet past the end of the buffer
before rejecting the string.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoJSON: Fix parsing of a number from the end of the buffer
Jouni Malinen [Sat, 9 Feb 2019 23:33:42 +0000 (01:33 +0200)] 
JSON: Fix parsing of a number from the end of the buffer

Avoid reading one octet past the end of the buffer when parsing a number
that is at the very end of the buffer.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: JSON parser fuzzer
Jouni Malinen [Sat, 9 Feb 2019 19:38:56 +0000 (21:38 +0200)] 
tests: JSON parser fuzzer

test-json can be used for fuzz testing the JSON parser implementation in
src/utils/json.c.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoTLS: Fix X.509 certificate name conversion into empty string
Jouni Malinen [Sat, 9 Feb 2019 23:51:51 +0000 (01:51 +0200)] 
TLS: Fix X.509 certificate name conversion into empty string

If none of the supported name attributes are present, the name string
was nul terminated only at the end. Add an explicit nul termination at
the end of the last written (or beginning of the buffer, if nothing is
written) to avoid writing uninitialized data to debug log.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoTLS: Fix ASN.1 parsing with no room for the header
Jouni Malinen [Sat, 9 Feb 2019 23:34:24 +0000 (01:34 +0200)] 
TLS: Fix ASN.1 parsing with no room for the header

Explicitly check the remaining buffer length before trying to read the
ASN.1 header values. Attempt to parse an ASN.1 header when there was not
enough buffer room for it would have started by reading one or two
octets beyond the end of the buffer before reporting invalid data at the
following explicit check for buffer room.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agoTLS: Fix AlertDescription for missing partial processing case
Jouni Malinen [Sat, 9 Feb 2019 23:08:07 +0000 (01:08 +0200)] 
TLS: Fix AlertDescription for missing partial processing case

tlsv1_record_receive() did not return error here and as such, &alert was
not set and must not be used. Report internal error instead to avoid use
of uninitialized memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
5 years agotests: TLS fuzzing tool
Jouni Malinen [Sat, 9 Feb 2019 19:07:24 +0000 (21:07 +0200)] 
tests: TLS fuzzing tool

Add test-tls program that can be used for fuzzing the internal TLS
client and server implementations. This tool can write client or server
messages into a file as an initialization step and for the fuzzing step,
that file (with potential modifications) can be used to replace the
internally generated message contents.

The TEST_FUZZ=y build parameter is used to make a special build where a
hardcoded random number generator and hardcoded timestamp are used to
force deterministic behavior for the TLS operations.

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