]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
6 years agotests: PEAP/GTC key lifetime in memory
Jouni Malinen [Tue, 5 Feb 2019 19:26:49 +0000 (21:26 +0200)] 
tests: PEAP/GTC key lifetime in memory

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agonl80211: Clear PMKID add command message buffer
Jouni Malinen [Tue, 5 Feb 2019 18:36:28 +0000 (20:36 +0200)] 
nl80211: Clear PMKID add command message buffer

This command has now been extended to include PMK for offload needs, so
the message buffer needs to be cleared explicitly after use to avoid
leaving such material in heap memory unnecessarily.

Fixes: 061a3d3d5300 ("nl80211: Add support for FILS Cache Identifier in add/remove_pmkid()")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agonl80211: Clear connect command message buffer
Jouni Malinen [Tue, 5 Feb 2019 18:34:34 +0000 (20:34 +0200)] 
nl80211: Clear connect command message buffer

This command can include keys (WEP or PSK for offload), so the message
buffer needs to be cleared explicitly after use to avoid leaving such
material in heap memory unnecessarily.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agonl80211: Request kernel to trim off payload of netlink requests from acks
Jouni Malinen [Tue, 5 Feb 2019 18:30:08 +0000 (20:30 +0200)] 
nl80211: Request kernel to trim off payload of netlink requests from acks

We do not need such payload in the acknowledgment, so adding it uses
resources unnecessarily. Furthermore, the original request can include
key material (e.g., NL80211_ATTR_PMK). libnl does not explicitly clear
this received message buffer and it would be inconvenient for
wpa_supplicant/hostapd to try to clear it with the current libnl design
where a duplicated buffer is actually passed to the callback. This means
that keys might be left unnecessarily in heap memory. Avoid this by
requesting the kernel not to copy back the request payload.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agoEAP peer: Clear temporary message buffers before freeing
Jouni Malinen [Tue, 5 Feb 2019 18:26:50 +0000 (20:26 +0200)] 
EAP peer: Clear temporary message buffers before freeing

These buffers in TLS-based EAP methods might contain keys or password
(e.g., when using TTLS-PAP or PEAP-GTC), so clear them explicitly to
avoid leaving such material into heap memory unnecessarily.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agoClear config item writing buffer before freeing it
Jouni Malinen [Tue, 5 Feb 2019 18:25:21 +0000 (20:25 +0200)] 
Clear config item writing buffer before freeing it

This buffer may be used to store items like passwords, so better clean
it explicitly to avoid possibility of leaving such items in heap memory
unnecessarily.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agotests: Fix EAP-FAST protocol testing with python3
Jouni Malinen [Tue, 5 Feb 2019 13:50:45 +0000 (15:50 +0200)] 
tests: Fix EAP-FAST protocol testing with python3

This was hit on Ubuntu 18.04 (newer python3 and OpenSSL library versions
compared to earlier tests).

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Optionally start telnet server inside VMs
Johannes Berg [Tue, 5 Feb 2019 11:26:58 +0000 (12:26 +0100)] 
tests: Optionally start telnet server inside VMs

If telnetd is installed and --telnet <port> is passed on the
vm-run.sh command line, start a telnet server (directly connected
to bash, no login) inside the VM(s) to be able to look into them
when something is wrong. Use a user network in qemu with a single
host forward from the specified port for this, listening only on
'localhost'.

Please note that this provides unauthenticated access to the guest
system from anything that can open a TCP connection on the host system.
The guess system does have access to reading all files on the host that
the user account running kvm has access to (and even write access if the
default ROTAG ,readonly parameter is cleared). In other words, this
option should not be used on any multiuser systems where kvm is run
under user accounts that are not dedicated for testing purposes (i.e.,
do not have access to any files that should not be readable to
everyone).

This needs CONFIG_VIRTIO_NET=y in the guest kernel.

For parallel-vm.py, the --telnet argument specifies the base port
and each VM index (0, 1, ...) is added to it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
6 years agotests: Suppress annoying console reset from VMs
Johannes Berg [Tue, 5 Feb 2019 11:26:46 +0000 (12:26 +0100)] 
tests: Suppress annoying console reset from VMs

Recently, qemu/seabios grew an annoying console/terminal reset,
which also causes my terminal to be left in a state where long
lines don't work well and less gets confused because of this.

Suppress this by suppressing all output from qemu before a new
magic string printed from inside.sh.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
6 years agotests: Support python3 in multi-ocsp test cases
Jouni Malinen [Tue, 5 Feb 2019 01:04:56 +0000 (03:04 +0200)] 
tests: Support python3 in multi-ocsp test cases

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Fix multi-ocsp response conents
Jouni Malinen [Tue, 5 Feb 2019 01:01:38 +0000 (03:01 +0200)] 
tests: Fix multi-ocsp response conents

These were not updated when the server certificates were updated the
last time (or the previous time).

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Create radio for p2ps_channel_active_go_and_station_different_mcc
Jouni Malinen [Tue, 5 Feb 2019 00:12:00 +0000 (02:12 +0200)] 
tests: Create radio for p2ps_channel_active_go_and_station_different_mcc

Instead of relying on existing configuration (which may conflict
with other tests) and skipping otherwise, create a new radio with
two channels in this test and use it.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Create radio for p2ps_channel_both_connected_different_mcc
Johannes Berg [Sat, 2 Feb 2019 23:04:31 +0000 (00:04 +0100)] 
tests: Create radio for p2ps_channel_both_connected_different_mcc

Instead of relying on existing configuration (which may conflict
with other tests) and skipping otherwise, create a new radio with
two channels in this test and use it.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
6 years agotests: Multi-BSSID test cases with python3
Jouni Malinen [Mon, 4 Feb 2019 18:01:48 +0000 (20:01 +0200)] 
tests: Multi-BSSID test cases with python3

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Encode Disconnect-Request attributes in sorted order for python3
Jouni Malinen [Mon, 4 Feb 2019 17:27:57 +0000 (19:27 +0200)] 
tests: Encode Disconnect-Request attributes in sorted order for python3

This is needed to fix issues with dict iteration resulting in different
order of attributes when trying to calculate Message-Authenticator
externally to pyrad.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Clean up pyrad test cases for python3 compatibility
Jouni Malinen [Mon, 4 Feb 2019 16:26:53 +0000 (18:26 +0200)] 
tests: Clean up pyrad test cases for python3 compatibility

All other test cases seem to work, but radius_das_disconnect_time_window
is still failing due to incorrect authenticator or Message-Authenticator
in Disconnect-Request.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoD-Bus: Fix P2P DeleteService dict iteration
Jouni Malinen [Mon, 4 Feb 2019 15:13:54 +0000 (17:13 +0200)] 
D-Bus: Fix P2P DeleteService dict iteration

The previous implementation assumed the first entry coming out from the
dict is always service_type. That may not be the case, so properly
iterate over all dict entries in one loop instead of assuming what the
first entry is.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Decode sigma_dut output for python3
Jouni Malinen [Mon, 4 Feb 2019 14:48:22 +0000 (16:48 +0200)] 
tests: Decode sigma_dut output for python3

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Read sigma_dut-ap.conf as binary data for python3 compatibility
Jouni Malinen [Mon, 4 Feb 2019 14:46:31 +0000 (16:46 +0200)] 
tests: Read sigma_dut-ap.conf as binary data for python3 compatibility

Sending UTF-8 encoded data to logger file is currently not working
properly, so create a separate binary file with a copy of
sigma_dut-ap.conf instead to work with both python2 and python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Replace file() with open() to work with python3
Jouni Malinen [Mon, 4 Feb 2019 14:11:42 +0000 (16:11 +0200)] 
tests: Replace file() with open() to work with python3

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: MAC address ASCII string generation in python3 compatible manner
Jouni Malinen [Mon, 4 Feb 2019 10:23:45 +0000 (12:23 +0200)] 
tests: MAC address ASCII string generation in python3 compatible manner

Use struct.unpack() to get a list of int and then generate a list of
hexstr octets from it for ':'.join() to get consistent behavior for both
python2 and python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoD-Bus: Fix a memory leak in DeleteService handler
Jouni Malinen [Mon, 4 Feb 2019 01:02:25 +0000 (03:02 +0200)] 
D-Bus: Fix a memory leak in DeleteService handler

If the service_type string entry is not included, the dict entry was not
cleared.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Replace dict.has_key() with the in operator for python3
Masashi Honma [Mon, 4 Feb 2019 00:56:53 +0000 (02:56 +0200)] 
tests: Replace dict.has_key() with the in operator for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Use binary mode for writing WPS attributes
Masashi Honma [Mon, 4 Feb 2019 00:41:19 +0000 (02:41 +0200)] 
tests: Use binary mode for writing WPS attributes

This is needed for python3.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Decode StreamRequestHandler read for python3
Masashi Honma [Mon, 4 Feb 2019 00:39:10 +0000 (02:39 +0200)] 
tests: Decode StreamRequestHandler read for python3

WPSAPHTTPServer class needs to explicitly decode the read value from
a bytes object to a str object.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Decode upnp_soap_action() response for python3
Masashi Honma [Mon, 4 Feb 2019 00:32:52 +0000 (02:32 +0200)] 
tests: Decode upnp_soap_action() response for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: ElementTree string representation in python3 compatible manner
Masashi Honma [Mon, 4 Feb 2019 00:30:15 +0000 (02:30 +0200)] 
tests: ElementTree string representation in python3 compatible manner

Use ET.tostring() to avoid implicit bytes/str conversion issues within
ET implementation. Add XML declaration separately to match previous
behavior.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: urlopen() compatibility for python3
Masashi Honma [Mon, 4 Feb 2019 00:13:31 +0000 (02:13 +0200)] 
tests: urlopen() compatibility for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Extend build_wsc_attr() to accept both bytes and str objects
Jouni Malinen [Sun, 3 Feb 2019 23:48:43 +0000 (01:48 +0200)] 
tests: Extend build_wsc_attr() to accept both bytes and str objects

This is needed for python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Fix struct.unpack() call for a single octet with python3
Jouni Malinen [Sun, 3 Feb 2019 23:46:32 +0000 (01:46 +0200)] 
tests: Fix struct.unpack() call for a single octet with python3

python3 needs this to be a bytes object, not the first octet of that
object.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Remove forgotten development time print
Jouni Malinen [Sun, 3 Feb 2019 23:22:45 +0000 (01:22 +0200)] 
tests: Remove forgotten development time print

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Open Hotspot 2.0 icon files in binary modes for python3
Masashi Honma [Sun, 3 Feb 2019 23:15:36 +0000 (01:15 +0200)] 
tests: Open Hotspot 2.0 icon files in binary modes for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Encode/decode base64 operations for python3
Masashi Honma [Sun, 3 Feb 2019 16:33:00 +0000 (18:33 +0200)] 
tests: Encode/decode base64 operations for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: python3 compatible way of importing gobject for D-Bus testing
Jouni Malinen [Sun, 3 Feb 2019 15:16:28 +0000 (17:16 +0200)] 
tests: python3 compatible way of importing gobject for D-Bus testing

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Use floor division (//) to avoid issues with python3
Jouni Malinen [Sun, 3 Feb 2019 13:06:05 +0000 (15:06 +0200)] 
tests: Use floor division (//) to avoid issues with python3

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Decode Popen output in wmediumd test sets for python3
Masashi Honma [Thu, 31 Jan 2019 08:16:12 +0000 (17:16 +0900)] 
tests: Decode Popen output in wmediumd test sets for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: python3 compatible str/bytes ord()
Jouni Malinen [Sun, 3 Feb 2019 10:44:17 +0000 (12:44 +0200)] 
tests: python3 compatible str/bytes ord()

Need to skip ord() for python3 when going through bytes object (instead
of str object in python2).

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Replace str.translate() with str.replace()
Jouni Malinen [Sun, 3 Feb 2019 10:24:49 +0000 (12:24 +0200)] 
tests: Replace str.translate() with str.replace()

This is needed for python3 since the two argument version of
str.translate() is not available for unicode. Furthermore, these cases
of delete colons from the string are simple enough for replace.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Fix erp_home_realm_oom error on python3
Masashi Honma [Thu, 31 Jan 2019 08:15:55 +0000 (17:15 +0900)] 
tests: Fix erp_home_realm_oom error on python3

Only python3 warns to this bug.

TypeError: '>' not supported between instances of 'type' and 'int'
Exception: '>' not supported between instances of 'type' and 'int'

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Explicit str/bytes conversion for key_lifetime_in_memory
Jouni Malinen [Sat, 2 Feb 2019 16:50:13 +0000 (18:50 +0200)] 
tests: Explicit str/bytes conversion for key_lifetime_in_memory

This is needed for python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Explicit str/bytes conversion in sigma_dut_venue_url
Jouni Malinen [Sat, 2 Feb 2019 16:29:11 +0000 (18:29 +0200)] 
tests: Explicit str/bytes conversion in sigma_dut_venue_url

This is needed for python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Replace str.decode('hex') with binascii.unhexlify() for python3
Masashi Honma [Sat, 2 Feb 2019 16:01:41 +0000 (18:01 +0200)] 
tests: Replace str.decode('hex') with binascii.unhexlify() for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Replace str.encode('hex') with binascii.hexlify() for python3
Masashi Honma [Sat, 2 Feb 2019 16:19:35 +0000 (18:19 +0200)] 
tests: Replace str.encode('hex') with binascii.hexlify() for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Decode Popen() output for python3
Masashi Honma [Thu, 31 Jan 2019 08:16:02 +0000 (17:16 +0900)] 
tests: Decode Popen() output for python3

Need to do this to avoid issues with following operations that assume
the output to be a str object.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Use 'b' prefix to mark Bytes literals explicitly for python3
Masashi Honma [Sat, 2 Feb 2019 15:52:25 +0000 (17:52 +0200)] 
tests: Use 'b' prefix to mark Bytes literals explicitly for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Decode subprocess.check_output() return value for python3
Masashi Honma [Thu, 31 Jan 2019 08:15:42 +0000 (17:15 +0900)] 
tests: Decode subprocess.check_output() return value for python3

Explicit conversion to str is needed here for python3 compatibility.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: rfkill with python3 compatible version
Masashi Honma [Thu, 31 Jan 2019 08:15:43 +0000 (17:15 +0900)] 
tests: rfkill with python3 compatible version

Update rfkill helpers to not depend on python2 implicit conversions.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: nl80211 attr with python3 compatible version
Masashi Honma [Thu, 31 Jan 2019 08:15:43 +0000 (17:15 +0900)] 
tests: nl80211 attr with python3 compatible version

Update nl80211 attribute building helpers to not depend on
python2 implicit conversions.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: HWSimController class with python3 compatible version
Masashi Honma [Thu, 31 Jan 2019 08:15:43 +0000 (17:15 +0900)] 
tests: HWSimController class with python3 compatible version

Update class HWSimController and netlink helpers to not depend on
python2 implicit conversions.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Explicitly encode str to bytes when needed for python3
Masashi Honma [Sat, 2 Feb 2019 14:25:57 +0000 (16:25 +0200)] 
tests: Explicitly encode str to bytes when needed for python3

Avoid implicit conversion errors when constructing bytes objects or
passing a str object to a function that needs a bytes object.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Fix failure for WPA-EAP-SUITE-B-192 key_mgmt
Masashi Honma [Thu, 31 Jan 2019 08:16:14 +0000 (17:16 +0900)] 
tests: Fix failure for WPA-EAP-SUITE-B-192 key_mgmt

The wpas_config_file_key_mgmt fails with this error if wpa_supplicant is
built without CONFIG_SUITEB192=y:

Exception: SET_NETWORK failed
Exception: SET_NETWORK failed

Skip the WPA-EAP-SUITE-B-192 case if it is not supported in
wpa_supplicant so that the rest of the key_mgmt test coverage is
included.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Explicit str/bytes conversion for socket operations for python3
Masashi Honma [Thu, 31 Jan 2019 08:16:15 +0000 (17:16 +0900)] 
tests: Explicit str/bytes conversion for socket operations for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Read binary file in add_log_file() for python3
Jouni Malinen [Sat, 2 Feb 2019 11:08:08 +0000 (13:08 +0200)] 
tests: Read binary file in add_log_file() for python3

python3 requires sqlite3.Binary() input to be bytes instead of str, so
open the files for binary mode reading.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Convert tshark output to string object for python3
Jouni Malinen [Sat, 2 Feb 2019 11:05:16 +0000 (13:05 +0200)] 
tests: Convert tshark output to string object for python3

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Convert binascii.hexlify() output to a string object for python3
Masashi Honma [Sat, 2 Feb 2019 11:01:36 +0000 (13:01 +0200)] 
tests: Convert binascii.hexlify() output to a string object for python3

This is needed in cases the hexlify() output is used to concatenate with
a string or used in string comparisons.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agowpaspy: Convert to/from str to bytes as needed for python3
Jouni Malinen [Sat, 2 Feb 2019 10:49:23 +0000 (12:49 +0200)] 
wpaspy: Convert to/from str to bytes as needed for python3

The control interface commands use mostly ASCII or UTF-8 strings, so
convert input/output to strings/bytes as needed for the socket
operations with python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Decode Popen() output values for python3
Masashi Honma [Sun, 3 Feb 2019 15:57:21 +0000 (17:57 +0200)] 
tests: Decode Popen() output values for python3

Explicit conversion to str is needed here for python3 compatibility.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Decode command execution output to a str for python3
Jouni Malinen [Sat, 2 Feb 2019 10:48:30 +0000 (12:48 +0200)] 
tests: Decode command execution output to a str for python3

Need to convert from bytes to str to allow the following string
operations to work with python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Remove trailing semicolons from python code
Jouni Malinen [Sat, 2 Feb 2019 10:10:53 +0000 (12:10 +0200)] 
tests: Remove trailing semicolons from python code

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Use python3 compatible libraries
Masashi Honma [Thu, 31 Jan 2019 08:15:41 +0000 (17:15 +0900)] 
tests: Use python3 compatible libraries

This patch is made by using 2to3 command with some modifications.

$ find . -name *.py | xargs 2to3 -f imports -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Remove unused import statements
Jouni Malinen [Sat, 2 Feb 2019 09:35:13 +0000 (11:35 +0200)] 
tests: Remove unused import statements

These were not used at all and caused unnecessary operations and in some
cases, compatibility issues with python3.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: python3 requires a raw string due to the backslash
Masashi Honma [Thu, 31 Jan 2019 08:15:40 +0000 (17:15 +0900)] 
tests: python3 requires a raw string due to the backslash

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Enable ERP testing with PEAP
Jouni Malinen [Fri, 1 Feb 2019 22:06:04 +0000 (00:06 +0200)] 
tests: Enable ERP testing with PEAP

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoPEAP: Explicitly clear temporary keys from memory when using CMK
Jouni Malinen [Fri, 1 Feb 2019 22:01:29 +0000 (00:01 +0200)] 
PEAP: Explicitly clear temporary keys from memory when using CMK

The case of PEAPv0 with crypto binding did not clear some of the
temporary keys from stack/heap when those keys were not needed anymore.
Clear those explicitly to avoid unnecessary caching of keying material.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoEAP-PEAP: Derive EMSK and use 128-octet derivation for MSK
Jouni Malinen [Fri, 1 Feb 2019 21:52:28 +0000 (23:52 +0200)] 
EAP-PEAP: Derive EMSK and use 128-octet derivation for MSK

Derive EMSK when using EAP-PEAP to enable ERP. In addition, change the
MSK derivation for EAP-PEAP to always derive 128 octets of key material
instead of the 64 octets to cover just the MSK. This is needed with the
PRF used in TLS 1.3 since the output length is mixed into the PRF
context.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: wpasupplicant: Refactor code duplication in wait_global_event()
Johannes Berg [Fri, 1 Feb 2019 20:31:59 +0000 (21:31 +0100)] 
tests: wpasupplicant: Refactor code duplication in wait_global_event()

This code is identical to the wait_event() code, except for the
mon/global_mon instance. Create a _wait_event() function that
encapsulates this, and use it for both.

While at it, fix the bug in wait_global_event() where in the case
of not having a global_mon it always returns None.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
6 years agotests: vm-run: Create a symlink to the latest logs
Johannes Berg [Fri, 1 Feb 2019 20:04:01 +0000 (21:04 +0100)] 
tests: vm-run: Create a symlink to the latest logs

This is useful when running a test multiple times, looking at
log output etc. to not have to pick out the right directory
each and every time.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
6 years agoDPP: Clear dpp_listen_freq on remain-on-channel failure
Jouni Malinen [Wed, 30 Jan 2019 10:28:43 +0000 (12:28 +0200)] 
DPP: Clear dpp_listen_freq on remain-on-channel failure

If the DPP_LISTEN command failed due to the driver rejecting the
remain-on-channel request, wpa_s->dpp_listen_freq was left set to the
requested listen frequency and this resulted in the next DPP_LISTEN for
the same frequency reporting "DPP: Already listening on .." even when
the driver was not really listening on that frequency. Fix this by
clearing wpa_s->dpp_listen_freq in the error case.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agoP2P: Allow the avoid channels for P2P discovery/negotiation
Purushottam Kushwaha [Fri, 28 Dec 2018 12:42:00 +0000 (18:12 +0530)] 
P2P: Allow the avoid channels for P2P discovery/negotiation

The avoid channels are notified through
QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY allow minimal traffic, so
enhance the P2P behavior accordingly by considering these avoid
frequencies for P2P discovery/negotiation as long as they are not in
disallowed frequencies list.

Additionally, do not return failure when none of social channels are
available as operation channel, rather, mark the op_channel/op_reg_class
to 0 as this would anyway get selected during the group formation in
p2p_prepare_channel.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agotests: WNM-Sleep Mode Request bounds checking for empty contents
Jouni Malinen [Mon, 29 Oct 2018 19:10:27 +0000 (21:10 +0200)] 
tests: WNM-Sleep Mode Request bounds checking for empty contents

The wnm_sleep_mode_proto test case was already covering number of
invalid WNM-Sleep Mode Request frame cases, but it was missing the
shortest possible case with a missing Dialog Token field. Add that as a
regression test case for bounds checking in
ieee802_11_rx_wnmsleep_req().

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agoWNM: Fix WNM-Sleep Mode Request bounds checking
Jouni Malinen [Mon, 29 Oct 2018 18:48:07 +0000 (20:48 +0200)] 
WNM: Fix WNM-Sleep Mode Request bounds checking

ieee802_11_rx_wnmsleep_req() might have been called for a short frame
that has no more payload after the Public Action field, i.e., with len
== 0. The bounds checking for the payload length was done only for the
information elements while the one octet Dialog Token field was read
unconditionally. In the original implementation, this could have
resulted in reading one octet beyond the end of the received frame data.

This case has not been reachable after the commit e0785ebbbd18 ("Use
more consistent Action frame RX handling in both AP mode paths"), but it
is better to address the specific issue in ieee802_11_rx_wnmsleep_req()
as well for additional protection against accidential removal of the
check and also to have something that can be merged into an older
version (pre-v2.7) if desired. The comments below apply for such older
versions where the case could have been reachable.

Depending on driver interface specific mechanism used for fetching the
frame, this could result in reading one octet beyond the end of a
stack/hash buffer or reading an uninitialized octet from within a
buffer. The actual value that was read as the Dialog Token field is not
used since the function returns immediately after having read this value
when there is no information elements following the field.

This issue was initially added in commit d32d94dbf47a ("WNM: Add
WNM-Sleep Mode implementation for AP") (with CONFIG_IEEE80211V=y build
option) and it remained in place during number of cleanup and fix
changes in this area and renaming of the build parameter to
CONFIG_WNM=y. The impacted function was not included in any default
build without one of the these optional build options being explicitly
enabled. CONFIG_WNM=y is still documented as "experimental and not
complete implementation" in hostapd/defconfig. In addition, commit
114f2830d2c2 ("WNM: Ignore WNM-Sleep Mode Request in wnm_sleep_mode=0
case") made this function exit before the impact read if WNM-Sleep Mode
support was not explicitly enabled in runtime configuration
(wnm_sleep_mode=1 in hostapd.conf). Commit e0785ebbbd18 ("Use more
consistent Action frame RX handling in both AP mode paths") made this
code unreachable in practice.

Add an explicit check that the frame has enough payload before reading
the Dialog Token field in ieee802_11_rx_wnmsleep_req().

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agotests: EAP-TLS and server reloading CRL from ca_cert
Jouni Malinen [Sun, 27 Jan 2019 16:48:16 +0000 (18:48 +0200)] 
tests: EAP-TLS and server reloading CRL from ca_cert

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agocrl_reload_interval: Add CRL reloading support
Jared Bents [Wed, 16 Jan 2019 15:15:01 +0000 (09:15 -0600)] 
crl_reload_interval: Add CRL reloading support

This patch adds a new flag 'crl_reload_interval' to reload CRL
periodically. This can be used to reload ca_cert file and the included
CRL information on every new TLS session if difference between the last
reload and the current time in seconds is greater than
crl_reload_interval.

This reloading is used for cases where check_crl is 1 or 2 and the CRL
is included in the ca_file.

Signed-off-by: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
Signed-off-by: Jared Bents <jared.bents@rockwellcollins.com>
6 years agotests: WPA2-PSK AP with PSK from a file (keyid and reload)
Jouni Malinen [Sat, 26 Jan 2019 15:42:15 +0000 (17:42 +0200)] 
tests: WPA2-PSK AP with PSK from a file (keyid and reload)

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoAP: Add wpa_psk_file reloading in runtime
Michal Kazior [Wed, 16 Jan 2019 12:35:20 +0000 (13:35 +0100)] 
AP: Add wpa_psk_file reloading in runtime

The wpa_psk_file can now be modified and hostapd can be told to re-read
it with the control interface RELOAD_WPA_PSK command:

 $ hostapd_cli reload_wpa_psk

It must be noted special care must be taken if WPS is configured
(wps_state=2, eap_server=1) because WPS appends PMKs to the
wpa_psk_file.

Signed-off-by: Michal Kazior <michal@plume.com>
6 years agoAP: Allow identifying which passphrase station used with wpa_psk_file
Michal Kazior [Wed, 16 Jan 2019 12:35:19 +0000 (13:35 +0100)] 
AP: Allow identifying which passphrase station used with wpa_psk_file

It is now possible to optionally specify keyid for
each wpa_psk_file entry:

 keyid=something 00:00:00:00:00:00 secretpassphrase

When station connects and the passphrase it used
has an associated keyid it will be appended to the
AP-STA-CONNECTED event string:

 wlan0: AP-STA-CONNECTED 00:36:76:21:dc:7b keyid=something

It's also possible to retrieve it through the control interface:

 $ hostapd_cli all_sta
 Selected interface 'ap0'
 00:36:76:21:dc:7b
 ...
 keyid=something

New hostapd is able to read old wpa_psk_file. However, old hostapd will
not be able to read the new wpa_psk_file if it includes keyids.

Signed-off-by: Michal Kazior <michal@plume.com>
6 years agoAP: Expose PMK outside of wpa_auth module
Michal Kazior [Wed, 16 Jan 2019 12:35:18 +0000 (13:35 +0100)] 
AP: Expose PMK outside of wpa_auth module

This doesn't change any behavior on its own. It's going to be used to
expose per-station keyids and allow reloading passphrases in runtime.

Signed-off-by: Michal Kazior <michal@plume.com>
6 years agotests: Modify pmksa_cache test sets for python3
Masashi Honma [Thu, 24 Jan 2019 07:46:19 +0000 (16:46 +0900)] 
tests: Modify pmksa_cache test sets for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Modify ocv test sets for python3
Masashi Honma [Thu, 24 Jan 2019 07:46:15 +0000 (16:46 +0900)] 
tests: Modify ocv test sets for python3

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: ap_eap test requires more memory in VM
Masashi Honma [Thu, 24 Jan 2019 07:45:54 +0000 (16:45 +0900)] 
tests: ap_eap test requires more memory in VM

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Python3 does not allow mixed indentation
Masashi Honma [Thu, 24 Jan 2019 07:45:49 +0000 (16:45 +0900)] 
tests: Python3 does not allow mixed indentation

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Remove deprecated statement for python3 compatibility
Masashi Honma [Thu, 24 Jan 2019 07:45:48 +0000 (16:45 +0900)] 
tests: Remove deprecated statement for python3 compatibility

This patch is made by using 2to3 command.

find . -name *.py | xargs 2to3 -f future -w -n

This was not really needed in this file for python2 compatibility.

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Use int instead of long for python3 compatibility
Masashi Honma [Thu, 24 Jan 2019 07:45:47 +0000 (16:45 +0900)] 
tests: Use int instead of long for python3 compatibility

This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f long -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Use python3 compatible raise statement
Masashi Honma [Thu, 24 Jan 2019 07:45:46 +0000 (16:45 +0900)] 
tests: Use python3 compatible raise statement

This patch is made by using 2to3 command.

find . -name *.py | xargs 2to3 -f raise -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Use python3 compatible function attribute
Masashi Honma [Thu, 24 Jan 2019 07:45:45 +0000 (16:45 +0900)] 
tests: Use python3 compatible function attribute

This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f funcattrs -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Use python3 compatible range operation
Masashi Honma [Thu, 24 Jan 2019 07:45:44 +0000 (16:45 +0900)] 
tests: Use python3 compatible range operation

This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f xrange -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Use python3 compatible dict operation
Masashi Honma [Thu, 24 Jan 2019 07:45:43 +0000 (16:45 +0900)] 
tests: Use python3 compatible dict operation

This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f dict -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Use python3 compatible print statement
Masashi Honma [Thu, 24 Jan 2019 07:45:42 +0000 (16:45 +0900)] 
tests: Use python3 compatible print statement

This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f print -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agotests: Use python3 compatible "except" statement
Masashi Honma [Thu, 24 Jan 2019 07:45:41 +0000 (16:45 +0900)] 
tests: Use python3 compatible "except" statement

This patch is made by using 2to3 command.

$ find . -name *.py | xargs 2to3 -f except -w -n

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agoWrite multi_ap_backhaul_sta to wpa_supplicant config
Daniel Golle [Wed, 23 Jan 2019 05:18:25 +0000 (06:18 +0100)] 
Write multi_ap_backhaul_sta to wpa_supplicant config

The network configration option multi_ap_backhaul_sta was added without
adding it to wpa_config_write_network(). Hence the value of this option
was not included when writing the configuration file. Fix this by
including it in wpa_config_write_network().

Fixes: 5abc7823b ("wpa_supplicant: Add Multi-AP backhaul STA support")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
6 years agodbus: Document more possible BSS/RSA/KeyMgmt values
Lubomir Rintel [Wed, 23 Jan 2019 09:38:49 +0000 (10:38 +0100)] 
dbus: Document more possible BSS/RSA/KeyMgmt values

This is probably not ideal, since it would be better if it ended up
being autogenerated somehow, but at least it's somewhat of an
improvement.

Also added a comment that encourages keeping the docs in sync.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
6 years agoCheck supported types in wpas_mac_addr_rand_scan_set()
Lior David [Mon, 21 Jan 2019 16:28:42 +0000 (18:28 +0200)] 
Check supported types in wpas_mac_addr_rand_scan_set()

When setting scan with randomized MAC, check the requested scan type
against supported types, to ensure callers will not set an unsupported
type, since this can cause scan/connect failures later. It is better to
do this in wpas_mac_addr_rand_scan_set() instead of control interface
specific code to apply the constraint on all possible interfaces using
this setting.

Signed-off-by: Lior David <liord@codeaurora.org>
6 years agoFix test compilation error related to sme_event_unprot_disconnect()
Lior David [Tue, 22 Jan 2019 15:24:35 +0000 (17:24 +0200)] 
Fix test compilation error related to sme_event_unprot_disconnect()

sme_event_unprot_disconnect() is only defined with CONFIG_IEEE80211W, so
the CONFIG_TESTING_OPTIONS command UNPROT_DEAUTH can be defined only
with builds that enable IEEE 802.11w support.

Signed-off-by: Lior David <liord@codeaurora.org>
6 years agotests: SAE and password identifier (exclusively)
Jouni Malinen [Wed, 23 Jan 2019 22:01:17 +0000 (00:01 +0200)] 
tests: SAE and password identifier (exclusively)

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agoSAE: Advertise Password Identifier use
Jouni Malinen [Wed, 23 Jan 2019 22:00:28 +0000 (00:00 +0200)] 
SAE: Advertise Password Identifier use

Support the new Extended Capabilities field bits 81 and 82 to indicate
whether SAe Password Identifiers are in use.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agoHS 2.0 server: Command line option to fetch the version information
Jouni Malinen [Wed, 23 Jan 2019 10:34:57 +0000 (12:34 +0200)] 
HS 2.0 server: Command line option to fetch the version information

This can be used to report automatically generated version strings from
the SPP server.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agoHS 2.0 server: Alternative subrem updateNode for certificate credentials
Jouni Malinen [Tue, 22 Jan 2019 23:03:46 +0000 (01:03 +0200)] 
HS 2.0 server: Alternative subrem updateNode for certificate credentials

The new subrem field in the users database can now be used to issue an
alternative subscription remediation updateNode for clients using
certificate credentials. The data file for this case is similar to the
policy update files, but it starts with the managementTreeURI value in
the first line.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agoHS 2.0 server: Use noMOUpdate in client certificate subrem
Jouni Malinen [Tue, 22 Jan 2019 21:31:06 +0000 (23:31 +0200)] 
HS 2.0 server: Use noMOUpdate in client certificate subrem

There is no point in trying to update the Credential node with the
existing contents in case of subscription remediation using a client
certificate instead of a username/password credential, so use the
noMOUpdate in that case.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
6 years agoFILS: Remove notes about experimental implementation
Jouni Malinen [Tue, 22 Jan 2019 11:33:48 +0000 (13:33 +0200)] 
FILS: Remove notes about experimental implementation

The standard amendment has been published and there has been sufficient
amount of interoperability testing for FILS to expect the protocol not
to be changed anymore, so remove the notes claiming this to be
experimental and not suitable for production use.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Update README to refer to parallel-vm.py
Jouni Malinen [Tue, 22 Jan 2019 11:27:31 +0000 (13:27 +0200)] 
tests: Update README to refer to parallel-vm.py

parallel-vm.sh was removed earlier.

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