]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
6 years agoGnuTLS: Implement sha{256,384,512}_vector() using libgcrypt
Jouni Malinen [Wed, 27 Dec 2017 21:19:32 +0000 (23:19 +0200)] 
GnuTLS: Implement sha{256,384,512}_vector() using libgcrypt

Replace the internal SHA256 implementation with the one from libgcrypt
and also add the SHA384 and SHA512 versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoGnuTLS: Use a helper function for hash functions
Jouni Malinen [Wed, 27 Dec 2017 21:13:51 +0000 (23:13 +0200)] 
GnuTLS: Use a helper function for hash functions

Use a shared helper function instead of implementing practically same
sequence separately for each hash function.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Opportunistic Wireless Encryption and group negotiation
Jouni Malinen [Wed, 27 Dec 2017 19:07:05 +0000 (21:07 +0200)] 
tests: Opportunistic Wireless Encryption and group negotiation

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoOWE: Try all supported DH groups automatically on STA
Jouni Malinen [Wed, 27 Dec 2017 19:06:02 +0000 (21:06 +0200)] 
OWE: Try all supported DH groups automatically on STA

If a specific DH group for OWE is not set with the owe_group parameter,
try all supported DH groups (currently 19, 20, 21) one by one if the AP
keeps rejecting groups with the status code 77.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Mixed mode BSS and MFP-enabled AP rejecting TKIP
Jouni Malinen [Wed, 27 Dec 2017 16:39:20 +0000 (18:39 +0200)] 
tests: Mixed mode BSS and MFP-enabled AP rejecting TKIP

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoFix MFP-enabled test for disallowed TKIP
Jouni Malinen [Wed, 27 Dec 2017 16:38:12 +0000 (18:38 +0200)] 
Fix MFP-enabled test for disallowed TKIP

The test against use of TKIP was done only in MFP-required
(ieee80211w=2) configuration. Fix this to check the pairwise cipher for
MFP-enabled (ieee80211w=1) case as well.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Mixed SAE and non-SAE network and MFP required with SAE
Jouni Malinen [Wed, 27 Dec 2017 16:28:07 +0000 (18:28 +0200)] 
tests: Mixed SAE and non-SAE network and MFP required with SAE

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoSAE: Add option to require MFP for SAE associations
Jouni Malinen [Wed, 27 Dec 2017 16:26:31 +0000 (18:26 +0200)] 
SAE: Add option to require MFP for SAE associations

The new hostapd.conf parameter sae_require_pmf=<0/1> can now be used to
enforce negotiation of MFP for all associations that negotiate use of
SAE. This is used in cases where SAE-capable devices are known to be
MFP-capable and the BSS is configured with optional MFP (ieee80211w=1)
for legacy support. The non-SAE stations can connect without MFP while
SAE stations are required to negotiate MFP if sae_require_mfp=1.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Set PMK length in eapol-fuzzer
Jouni Malinen [Wed, 27 Dec 2017 10:27:33 +0000 (12:27 +0200)] 
tests: Set PMK length in eapol-fuzzer

Commit b488a12948751f57871f09baa345e59b23959a41 ('Clear PMK length and
check for this when deriving PTK') started rejecting PTK derivation
based on PMK length. This reduced coverage from the eapol-fuzzer, so set
the default length when initializing the state machine in the fuzzer to
reach the previously used code paths.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: SAE protocol testing - Confirm replay
Jouni Malinen [Wed, 27 Dec 2017 10:13:20 +0000 (12:13 +0200)] 
tests: SAE protocol testing - Confirm replay

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoSAE: Set special Sc value when moving to Accepted state
Jouni Malinen [Wed, 27 Dec 2017 10:17:44 +0000 (12:17 +0200)] 
SAE: Set special Sc value when moving to Accepted state

Set Sc to 2^16-1 when moving to Accepted state per IEEE Std 802.11-2016,
12.4.8.6.5 (Protocol instance behavior - Confirmed state). This allows
the peer in Accepted state to silently ignore unnecessary
retransmissions of the Confirm message.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoSAE: Add Rc variable and peer send-confirm validation
Jouni Malinen [Wed, 27 Dec 2017 10:14:41 +0000 (12:14 +0200)] 
SAE: Add Rc variable and peer send-confirm validation

This implements the behavior described in IEEE Std 802.11-2016,
12.4.8.6.6 (Protocol instance behavior - Accepted state) to silently
discard received Confirm message in the Accepted state if the new
message does not use an incremented send-confirm value or if the special
2^16-1 value is used. This avoids unnecessary processing of
retransmitted Confirm messages.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoSAE: Print state changes in debug log
Jouni Malinen [Tue, 26 Dec 2017 22:07:42 +0000 (00:07 +0200)] 
SAE: Print state changes in debug log

This makes it easier to follow state changes in SAE protocol instances.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoSAE: Make dot11RSNASAESync configurable
Jouni Malinen [Tue, 26 Dec 2017 10:46:22 +0000 (12:46 +0200)] 
SAE: Make dot11RSNASAESync configurable

The new hostapd.conf parameter sae_sync (default: 5) can now be used to
configure the dot11RSNASAESync value to specify the maximum number of
synchronization errors that are allowed to happen prior to
disassociation of the offending SAE peer.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Make dpp_pkex_test_fail and dpp_pkex_alloc_fail more robust
Jouni Malinen [Mon, 25 Dec 2017 16:36:17 +0000 (18:36 +0200)] 
tests: Make dpp_pkex_test_fail and dpp_pkex_alloc_fail more robust

Wait for test/allocation failure for longer than the wait_fail_trigger()
default two seconds to allow DPP (in particular, PKEX) retransmission to
occur. This removes some issues where the previous wait was more or less
exactly the same duration as the retransmission interval and the first
Listen operation not always starting quickly enough to receive the first
frame.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Fix "ocsp: Digest must be before -cert or -serial"
leishaoting [Tue, 19 Dec 2017 06:40:44 +0000 (14:40 +0800)] 
tests: Fix "ocsp: Digest must be before -cert or -serial"

When executing ./start.sh with OpenSSL 1.1.0f, an OCSP operation fails.

Put "-sha256" ahead of "-serial" to fix this.

~# openssl version
OpenSSL 1.1.0f  25 May 2017
~# openssl ocsp -reqout /lkp/benchmarks/hwsim/tests/hwsim/logs/current/ocsp-req.der -issuer /lkp/benchmarks/hwsim/tests/hwsim/auth_serv/ca.pem -serial 0xD8D3E3A6CBE3CD12 -no_nonce -sha256
ocsp: Digest must be before -cert or -serial
ocsp: Use -help for summary.
~# openssl ocsp -reqout /lkp/benchmarks/hwsim/tests/hwsim/logs/current/ocsp-req.der -issuer /lkp/benchmarks/hwsim/tests/hwsim/auth_serv/ca.pem -sha256 -serial 0xD8D3E3A6CBE3CD12 -no_nonce

Signed-off-by: leishaoting <leist.fnst@cn.fujitsu.com>
6 years agoPAE: Remove OpenSSL header dependency
Jouni Malinen [Sun, 24 Dec 2017 15:41:48 +0000 (17:41 +0200)] 
PAE: Remove OpenSSL header dependency

Instead of requiring OpenSSL headers to be available just for the
SSL3_RANDOM_SIZE definition, replace that macro with a fixed length (32)
to simplify dependencies.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoEAP-pwd: Use abstract crypto API
Sean Parkinson [Mon, 16 Oct 2017 05:45:09 +0000 (15:45 +1000)] 
EAP-pwd: Use abstract crypto API

This makes it easier to use EAP-pwd with other crypto libraries than
OpenSSL.

Signed-off-by: Sean Parkinson <sean@wolfssl.com>
6 years agoEAP-EKE: Use abstract crypto API
Sean Parkinson [Mon, 16 Oct 2017 05:45:09 +0000 (15:45 +1000)] 
EAP-EKE: Use abstract crypto API

This makes it easier to use EAP-pwd with other crypto libraries.

Signed-off-by: Sean Parkinson <sean@wolfssl.com>
6 years agoEnhance crypto abstract API for DH
Sean Parkinson [Mon, 16 Oct 2017 05:45:09 +0000 (15:45 +1000)] 
Enhance crypto abstract API for DH

The patch offers alternate implementations of some functions using the
abstract cryptographic API.

This work was done in preparation for the changes to allow hostap to be
compiled with the wolfSSL cryptography and TLS library.

Signed-off-by: Sean Parkinson <sean@wolfssl.com>
6 years agocrypto: Implement new crypto API functions for DH
Jouni Malinen [Sun, 24 Dec 2017 15:25:39 +0000 (17:25 +0200)] 
crypto: Implement new crypto API functions for DH

This implements crypto_dh_init() and crypto_dh_derive_secret() using
os_get_random() and crypto_mod_exp() for all crypto_*.c wrappers that
include crypto_mod_exp() implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoOpenSSL: Implement new crypto API functions
Jouni Malinen [Sat, 23 Dec 2017 15:51:14 +0000 (17:51 +0200)] 
OpenSSL: Implement new crypto API functions

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoEnhance crypto abstract API
Sean Parkinson [Mon, 16 Oct 2017 05:45:09 +0000 (15:45 +1000)] 
Enhance crypto abstract API

Add more crypto_*() wrappers to enable use of other crypto libraries
than OpenSSL.

Signed-off-by: Sean Parkinson <sean@wolfssl.com>
6 years agoFix copy-paste errors in function comments
Sean Parkinson [Mon, 16 Oct 2017 05:45:09 +0000 (15:45 +1000)] 
Fix copy-paste errors in function comments

Use correct function names for the documentation.

Signed-off-by: Sean Parkinson <sean@wolfssl.com>
6 years agoDH: Remove trailing whitespace
Jouni Malinen [Sun, 24 Dec 2017 15:02:53 +0000 (17:02 +0200)] 
DH: Remove trailing whitespace

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoEAP-pwd: Remove trailing empty line
Jouni Malinen [Sat, 23 Dec 2017 15:26:38 +0000 (17:26 +0200)] 
EAP-pwd: Remove trailing empty line

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoAdd new QCA vendor attribute for getting preferred channel
Peng Xu [Tue, 12 Dec 2017 17:00:01 +0000 (09:00 -0800)] 
Add new QCA vendor attribute for getting preferred channel

A new vendor attribute QCA_WLAN_VENDOR_ATTR_GET_WEIGHED_PCL is added for
getting preferred channels with weight value and a flag to indicate how
the channels should be used in P2P negotiation process.

Signed-off-by: Peng Xu <pxu@qti.qualcomm.com>
6 years agoFix couple of QCA_NL80211_VENDOR_SUBCMD_GET_SAR_LIMITS comments
Jouni Malinen [Fri, 22 Dec 2017 16:57:47 +0000 (18:57 +0200)] 
Fix couple of QCA_NL80211_VENDOR_SUBCMD_GET_SAR_LIMITS comments

Copy-paste errors in the command name (set vs. the new get).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoVendor parameter for forcing RSNE override
Sunil Dutt [Fri, 15 Dec 2017 09:28:48 +0000 (14:58 +0530)] 
Vendor parameter for forcing RSNE override

Indicates the driver to use the RSNE as-is from the connect interface.
Exclusively used for the scenarios where the device is used as a testbed
device with special functionality and not recommended for production.
This helps driver to not validate the RSNE passed from user space and
thus allow arbitrary IE data to be used for testing purposes.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agowpa_cli: Add completion for get/set cred commands
Mikael Kanstrup [Mon, 11 Dec 2017 09:50:24 +0000 (10:50 +0100)] 
wpa_cli: Add completion for get/set cred commands

Add command completion support for get_cred and set_cred commands.

Signed-off-by: Mikael Kanstrup <mikael.kanstrup@sony.com>
6 years agodbus: Add FILS key mgmt values into BSS security properties
Masashi Honma [Sun, 10 Dec 2017 01:30:39 +0000 (10:30 +0900)] 
dbus: Add FILS key mgmt values into BSS security properties

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
6 years agoDefine a QCA vendor command to retrieve SAR Power limits
Jeff Johnson [Tue, 7 Nov 2017 19:15:50 +0000 (11:15 -0800)] 
Define a QCA vendor command to retrieve SAR Power limits

Previously commit c79238b6a460ab6bc6ebc5e2453fd94716393105 ('Define a
QCA vendor command to configure SAR Power limits') implemented a vendor
command interface to allow a userspace entity to dynamically control the
SAR power limits. Now implement a command to retrieve the current SAR
power limits.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoFILS: Driver configuration to disable/enable FILS features
vamsi krishna [Thu, 14 Dec 2017 09:44:51 +0000 (15:14 +0530)] 
FILS: Driver configuration to disable/enable FILS features

The new disable_fils parameter can be used to disable FILS functionality
in the driver. This is currently removing the FILS Capability bit in
Extended Capabilities and providing a callback to the driver wrappers.
driver_nl80211.c implements this using a QCA vendor specific command for
now.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: DPP P-521 test vector (mutual auth)
Jouni Malinen [Wed, 13 Dec 2017 14:25:13 +0000 (16:25 +0200)] 
tests: DPP P-521 test vector (mutual auth)

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: chan_util_avg_period
Jouni Malinen [Mon, 11 Dec 2017 21:46:00 +0000 (23:46 +0200)] 
tests: chan_util_avg_period

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agohostapd: Add average channel utilization in STATUS
Bhagavathi Perumal S [Mon, 4 Dec 2017 09:23:33 +0000 (14:53 +0530)] 
hostapd: Add average channel utilization in STATUS

This allows external programs to get the average channel utilization.
The average channel utilization is calculated and reported through
STATUS command. Users need to configure chan_util_avg_period and
bss_load_update_period in hostapd config to get the average channel
utilization.

Signed-off-by: Bhagavathi Perumal S <bperumal@qti.qualcomm.com>
6 years agohostapd: Update BSS load update period dynamically
Bhagavathi Perumal S [Mon, 4 Dec 2017 09:22:20 +0000 (14:52 +0530)] 
hostapd: Update BSS load update period dynamically

Recalculate the timeout value for each event instead of calculating this
once and then not allowing the timeout configuration to be changed
without fully stopping and restarting the interface.

This allows the bss_load_update_period configuration parameter to be
modified while a BSS continues operating.

Signed-off-by: Bhagavathi Perumal S <bperumal@qti.qualcomm.com>
6 years agoFix error handling in bss_load_update_period parser
Jouni Malinen [Mon, 11 Dec 2017 22:42:40 +0000 (00:42 +0200)] 
Fix error handling in bss_load_update_period parser

Do not update the configuration parameter before having verified the
value to be in the valid range.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agohostapd_cli: Add dpp_listen and dpp_stop_listen
Jouni Malinen [Mon, 11 Dec 2017 17:55:57 +0000 (19:55 +0200)] 
hostapd_cli: Add dpp_listen and dpp_stop_listen

Now that hostapd exposes the DPP_LISTEN and DPP_STOP_LISTEN commands
similarly to wpa_supplicant, expose these through proper hostapd_cli
commands as well to match wpa_cli functionality.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: OWE and unsupported group using cfg80211 connect command
Jouni Malinen [Mon, 11 Dec 2017 12:01:45 +0000 (14:01 +0200)] 
tests: OWE and unsupported group using cfg80211 connect command

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoOWE: Allow DH Parameters element overriding with driver SME
Jouni Malinen [Mon, 11 Dec 2017 11:59:55 +0000 (13:59 +0200)] 
OWE: Allow DH Parameters element overriding with driver SME

Commit 265bda34441da14249cb22ce8a459cebe8015a55 ('OWE: Allow DH
Parameters element to be overridden for testing purposes') provided
means for using "VENDOR_ELEM_ADD 13 <IE>" in OWE protocol testing, but
that commit covered only the sme.c case (i.e., drivers that use
wpa_supplicant SME). Extend this to cover drivers that use internal SME
(e.g., use the nl80211 Connect command).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoOWE: Fix error case handling with drivers that implement AP SME
Jouni Malinen [Mon, 11 Dec 2017 11:36:48 +0000 (13:36 +0200)] 
OWE: Fix error case handling with drivers that implement AP SME

owe_auth_req_process() can return NULL in error cases, but the caller
was not prepared for this. The p pointer cannot be overridden in such
cases since that would result in buffer length (p - buf) overflows. Fix
this by using a temporary variable to check the return value before
overriding p so that the hostapd_sta_assoc() ends up using correct
length for the IE buffer.

Fixes: 33c8bbd8ca7a ("OWE: Add AP mode handling of OWE with drivers that implement SME")
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoOpenSSL: Replace EVP_PKEY_paramgen() with EC_KEY_new_by_curve_name()
Jouni Malinen [Sun, 10 Dec 2017 21:49:39 +0000 (23:49 +0200)] 
OpenSSL: Replace EVP_PKEY_paramgen() with EC_KEY_new_by_curve_name()

The BoringSSL version of crypto_ecdh_init() and dpp_gen_keypair() works
fine with OpenSSL as well, so use that same implementation for both to
avoid unnecessary maintanence of multiple versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoBoringSSL: Use EC_KEY_new_by_curve_name() to simplify implementation
Jouni Malinen [Sun, 10 Dec 2017 21:41:29 +0000 (23:41 +0200)] 
BoringSSL: Use EC_KEY_new_by_curve_name() to simplify implementation

There is no need to go through EC_GROUP_new_by_curve_name(),
EC_KEY_new(), and EC_KEY_set_group() when a single call to
EC_KEY_new_by_curve_name() takes care of all that.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoRevert "BoringSSL: Add DPP special cases regardless of claimed version number"
Jouni Malinen [Sun, 10 Dec 2017 21:24:31 +0000 (23:24 +0200)] 
Revert "BoringSSL: Add DPP special cases regardless of claimed version number"

This reverts commit 5548453a2d0061cf5d65180dca5d0141e15e14bb since
BoringSSL added ECDSA_SIG_set0() and ECDSA_SIG_get0() in commit
8dc226ca8f1ef60737e1c1bf8cfcabf51d4068c7 ('Add some missing OpenSSL
1.1.0 accessors.') and updated X509_ALGOR_get0() prototype to match
OpenSSL 1.1.0 changes in commit e3b2a5d30d309091cab3e6a19dee7323c40d968d
('Const-correct X509_ALGOR_get0.').

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoRevert "BoringSSL: Define RSA_bits() helper"
Jouni Malinen [Sun, 10 Dec 2017 21:22:05 +0000 (23:22 +0200)] 
Revert "BoringSSL: Define RSA_bits() helper"

This reverts commit 3cfbd3b0f63fb299f1187f16db6fcec9421e3df4 since
BoringSSL added RSA_bits() in commit
8dc226ca8f1ef60737e1c1bf8cfcabf51d4068c7 ('Add some missing OpenSSL
1.1.0 accessors.').

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agotests: Suite B 192-bit with RSA and RADIUS
Jouni Malinen [Sun, 10 Dec 2017 19:18:06 +0000 (21:18 +0200)] 
tests: Suite B 192-bit with RSA and RADIUS

This tests use of RSA >3K keys and forcing ECDHE on both the server and
client side.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoOpenSSL: Allow cipher list to be overridden for tls_suiteb=1 case
Jouni Malinen [Sun, 10 Dec 2017 19:16:26 +0000 (21:16 +0200)] 
OpenSSL: Allow cipher list to be overridden for tls_suiteb=1 case

This allows wpa_supplicant configuration with phase1="tls_suiteb=1" to
use openssl_ciphers="ECDHE-RSA-AES256-GCM-SHA384" to further limit the
possible TLS cipher suites when using Suite B with RSA >3K keys. This
combination disables use of DHE and as such, mandates ECDHE to be used.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoFix wnm-fuzzer build
Jouni Malinen [Sat, 9 Dec 2017 16:45:34 +0000 (18:45 +0200)] 
Fix wnm-fuzzer build

Need to include couple more wpa_supplicant source code files into the
build.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoFix ap-mgmt-fuzzer build
Jouni Malinen [Sat, 9 Dec 2017 16:41:55 +0000 (18:41 +0200)] 
Fix ap-mgmt-fuzzer build

Add src/ap/eth_p_oui.o into libap.a to be able to link ap-mgmt-fuzzer.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoeapol-fuzzer: Resolve circular library references with --start-group
Jouni Malinen [Sat, 9 Dec 2017 16:36:48 +0000 (18:36 +0200)] 
eapol-fuzzer: Resolve circular library references with --start-group

src/crypto/libcrypto.a and src/tls/libtls.a have circular references
and will need special handling with the linker at least for the time
being. This could be cleaned up eventually, but for now, provide a
mechanism to get the program linked.

This was already done in tests/Makefile, but tests/eapol-fuzzer/Makefile
needs the same.

Signed-off-by: Jouni Malinen <j@w1.fi>
6 years agoOpenSSL: Avoid SSL*_use_default_passwd_cb()
David Benjamin [Mon, 18 Sep 2017 15:47:47 +0000 (11:47 -0400)] 
OpenSSL: Avoid SSL*_use_default_passwd_cb()

These functions are a bit awkward to use for one-off file loads, as
suggested by the tls_clear_default_passwd_cb() logic. There was also
some historical mess with OpenSSL versions and either not having per-SSL
settings, having per-SSL settings but ignoring them, and requiring the
per-SSL settings.

Instead, loading the key with the lower-level functions seems a bit
tidier and also allows abstracting away trying both formats, one after
another.

Signed-off-by: David Benjamin <davidben@google.com>
6 years agoOpenSSL: Remove unnecessary os_strdup() from password callback
David Benjamin [Mon, 18 Sep 2017 04:33:43 +0000 (00:33 -0400)] 
OpenSSL: Remove unnecessary os_strdup() from password callback

There's no need to make an extra copy of private_key_passwd for
SSL_{CTX_,}set_default_passwd_cb().

Signed-off-by: David Benjamin <davidben@google.com>
6 years agoAndroid: Set CONFIG_NO_RANDOM_POOL=y
Jeff Vander Stoep [Thu, 30 Nov 2017 22:46:26 +0000 (14:46 -0800)] 
Android: Set CONFIG_NO_RANDOM_POOL=y

Wpa_supplicant's random pool is not necessary on Android. Randomness
is already provided by the entropymixer service which ensures
sufficient entropy is maintained across reboots. Commit b410eb1913
'Initialize /dev/urandom earlier in boot' seeds /dev/urandom with
that entropy before either wpa_supplicant or hostapd are run.

Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
6 years agoAndroid: Move hostapd to vendor partition
Po-Chien Hsueh [Thu, 30 Nov 2017 22:45:51 +0000 (14:45 -0800)] 
Android: Move hostapd to vendor partition

Move hostapd to /vendor/bin/ because it's only used by WIFI HAL.

Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
6 years agowlantest: Try harder to find a STA entry with PTK for 4-address frames
Jouni Malinen [Fri, 8 Dec 2017 19:51:47 +0000 (21:51 +0200)] 
wlantest: Try harder to find a STA entry with PTK for 4-address frames

Commit aab66128369c5953e70f867e997a54146bcca88b ('wlantest: Search
bss/sta entry more thoroughly for 4-address frames') allowed wlantest to
find a STA entry in this type of cases, but it was still possible for
that STA entry to be the one that has no derived PTK while the STA entry
for the other side of the link might have the derived PTK available.

Extend this BSS/STA selection mechanism to use sta->ptk_set to determine
which STA entry is more useful for decryption, i.e., select the one with
a known PTK.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoAdd new QCA vendor attribute for WLAN Latency Module (WLM)
Paul Zhang [Thu, 30 Nov 2017 13:40:30 +0000 (21:40 +0800)] 
Add new QCA vendor attribute for WLAN Latency Module (WLM)

A new vendor attribute QCA_WLAN_VENDOR_ATTR_CONFIG_LATENCY_LEVEL is added
for vendor sub-command QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION.
This attribute is for setting the level of WLM.

Signed-off-by: Paul Zhang <paulz@qti.qualcomm.com>
6 years agotests: DPP P-256 test vectors
Jouni Malinen [Thu, 7 Dec 2017 11:35:19 +0000 (13:35 +0200)] 
tests: DPP P-256 test vectors

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Allow protocol key to be overridden for testing purposes
Jouni Malinen [Tue, 5 Dec 2017 21:49:55 +0000 (23:49 +0200)] 
DPP: Allow protocol key to be overridden for testing purposes

This can be used for various testing needs.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: sigma_dut and DPPAuthDirection,Mutual on Initiator
Jouni Malinen [Tue, 5 Dec 2017 19:13:30 +0000 (21:13 +0200)] 
tests: sigma_dut and DPPAuthDirection,Mutual on Initiator

Do not include this argument in normal case, but add a test case to
cover the special extra check case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: sigma_dut DPP protocol testing - Stop at RX
Jouni Malinen [Tue, 5 Dec 2017 18:22:07 +0000 (20:22 +0200)] 
tests: sigma_dut DPP protocol testing - Stop at RX

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: WPS with other AES-based ciphers
Jouni Malinen [Fri, 1 Dec 2017 23:43:58 +0000 (01:43 +0200)] 
tests: WPS with other AES-based ciphers

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoWPS: Add GCMP-256 and CCMP-256 cipher options on Enrollee
Jouni Malinen [Fri, 1 Dec 2017 23:42:50 +0000 (01:42 +0200)] 
WPS: Add GCMP-256 and CCMP-256 cipher options on Enrollee

If a credential with encp type AES is received, add GCMP-256 and
CCMP-256 cipher options on station Enrollee based on local capabilities.
This is needed to allow connection with an AP using either of these
newer ciphers.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: Make ap_wps_ap_scan_2 work with multiple AES-ciphers
Jouni Malinen [Sat, 2 Dec 2017 10:12:27 +0000 (12:12 +0200)] 
tests: Make ap_wps_ap_scan_2 work with multiple AES-ciphers

This test case is not really realistic and the second connection attempt
would fail if additional AES-based ciphers get provisioned. Work this
around by dropping to CCMP only if other ciphers are present.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: Allow more ciphers in ap_wps_mixed_cred
Jouni Malinen [Sat, 2 Dec 2017 10:03:53 +0000 (12:03 +0200)] 
tests: Allow more ciphers in ap_wps_mixed_cred

This is needed to avoid false errors with GCMP-256 and CCMP-256 to be
added in the implementation.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoWPS: Check BSS table against current BSSID if credential does not match
Jouni Malinen [Fri, 1 Dec 2017 23:37:41 +0000 (01:37 +0200)] 
WPS: Check BSS table against current BSSID if credential does not match

The credential MAC address is not necessarily that of the AP, i.e., it
is more likely to be that of the Enrollee. Check the scan results
against the current BSSID as well if match is not found otherwise when
going through the mixed mode workaround.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoWPS: Map GCMP-256 and CCMP-256 to AES encryption type
Jouni Malinen [Fri, 1 Dec 2017 23:36:43 +0000 (01:36 +0200)] 
WPS: Map GCMP-256 and CCMP-256 to AES encryption type

This is needed to allow a credential to be built for GCMP-256/CCMP-256
networks that do not enable GCMP-128/CCMP-128.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoWPS: Allow WPS to be enabled in CCMP-256 and GCMP-256 only cases
Shiva Sankar Gajula [Fri, 1 Dec 2017 23:22:55 +0000 (01:22 +0200)] 
WPS: Allow WPS to be enabled in CCMP-256 and GCMP-256 only cases

Extend the check against WPA/TKIP only configuration by adding CCMP-256
and GCMP-256 to the list of allowed ciphers. This is needed to allow WPS
to be enabled in AP configurations where neither CCMP-128 nor GCMP-128
are enabled.

Signed-off-by: Shiva Sankar Gajula <sgajula@qti.qualcomm.com>
6 years agotests: DPP testing to check for mutual authentication on Initiator
Jouni Malinen [Fri, 1 Dec 2017 23:17:37 +0000 (01:17 +0200)] 
tests: DPP testing to check for mutual authentication on Initiator

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Indicate to upper layers whether mutual authentication was used
Jouni Malinen [Fri, 1 Dec 2017 23:16:17 +0000 (01:16 +0200)] 
DPP: Indicate to upper layers whether mutual authentication was used

DPP Responder selects whether mutual authentication is used. This commit
adds information about that selection to upper layers (ctrl_iface event
DPP-AUTH-DIRECTION mutual=<0/1>) on the Initiator side.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: DPP exchange stopping unexpectedly
Jouni Malinen [Fri, 1 Dec 2017 23:05:50 +0000 (01:05 +0200)] 
tests: DPP exchange stopping unexpectedly

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Extend protocol testing to allow exchange termination
Jouni Malinen [Fri, 1 Dec 2017 23:04:42 +0000 (01:04 +0200)] 
DPP: Extend protocol testing to allow exchange termination

This extends dpp_test functionality to allow DPP exchanges to be stopped
when receiving a specified message.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Change Authentication Response retry time to 1 second
Jouni Malinen [Fri, 1 Dec 2017 22:38:12 +0000 (00:38 +0200)] 
DPP: Change Authentication Response retry time to 1 second

The previously used 10 second timer did not really make much sense since
the Initiator is not going to be waiting for the response that long.
Change this to 1 second based on the DPP tech spec change.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: nl80211.py: Fix attribute padding
Johannes Berg [Fri, 1 Dec 2017 20:37:40 +0000 (21:37 +0100)] 
tests: nl80211.py: Fix attribute padding

The kernel started enforcing attribute lengths, and nl80211.py had been
doing it all wrong - the padding must be present, but not part of the
length.

Fix it to do it the right way.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
6 years agonl80211: Fix NL80211_MESHCONF_AUTO_OPEN_PLINKS encoding
Jouni Malinen [Fri, 1 Dec 2017 20:21:24 +0000 (22:21 +0200)] 
nl80211: Fix NL80211_MESHCONF_AUTO_OPEN_PLINKS encoding

This nl80211 attribute uses NLA_U8 policy in cfg80211 and wpa_supplicant
needs to use same size when writing the attribute.

This fixes mesh mode regression triggered by kernel commit "net:
netlink: Update attr validation to require exact length for some types"
in v4.15-rc1 that resulted in the following debug log entry when trying
to join a mesh:
nl80211: mesh join failed: ret=-22 (Invalid argument)

Fixes: 6c1664f6051f ("nl80211: Add new commands to support mesh interfaces")
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agonl80211: Fix NL80211_ATTR_SMPS_MODE encoding
Jouni Malinen [Fri, 1 Dec 2017 18:22:44 +0000 (20:22 +0200)] 
nl80211: Fix NL80211_ATTR_SMPS_MODE encoding

This nl80211 attribute uses NLA_U8 policy in cfg80211 and
hostapd/wpa_supplicant needs to use same size when writing the
attribute.

This fixes AP mode regression triggered by kernel commit "net: netlink:
Update attr validation to require exact length for some types" in
v4.15-rc1 that resulted in the following debug log entry when trying to
enable beaconing:
nl80211: Beacon set failed: -34 (Numerical result out of range)

Fixes: da1080d7215f ("nl80211: Advertise and configure SMPS modes")
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: sigma_dut and WPS PBC Enrollee
Jouni Malinen [Thu, 30 Nov 2017 21:06:33 +0000 (23:06 +0200)] 
tests: sigma_dut and WPS PBC Enrollee

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: sigma_dut controlled connection using preconfigured profile
Jouni Malinen [Thu, 30 Nov 2017 20:54:34 +0000 (22:54 +0200)] 
tests: sigma_dut controlled connection using preconfigured profile

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: DPP protocol testing - invalid E-nonce in Conf Req
Jouni Malinen [Thu, 30 Nov 2017 20:03:07 +0000 (22:03 +0200)] 
tests: DPP protocol testing - invalid E-nonce in Conf Req

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Extend dpp_test with invalid E-Nonce in Config Req
Jouni Malinen [Thu, 30 Nov 2017 20:01:10 +0000 (22:01 +0200)] 
DPP: Extend dpp_test with invalid E-Nonce in Config Req

Allow an E-Nonce attribute with invalid length to be sent for protocol
testing purposes.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: DPP protocol testing - invalid Transaction ID in Peer Disc Req
Jouni Malinen [Thu, 30 Nov 2017 19:56:55 +0000 (21:56 +0200)] 
tests: DPP protocol testing - invalid Transaction ID in Peer Disc Req

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Extend dpp_test with invalid Transaction ID in Peer Disc Req
Jouni Malinen [Thu, 30 Nov 2017 19:56:19 +0000 (21:56 +0200)] 
DPP: Extend dpp_test with invalid Transaction ID in Peer Disc Req

Allow a Transaction ID attribute with invalid length to be sent for
protocol testing purposes.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoAdd QCA vendor command and attributes for RROP
Krishna Rao [Fri, 24 Nov 2017 09:26:16 +0000 (14:56 +0530)] 
Add QCA vendor command and attributes for RROP

Add QCA vendor command and attributes for vendor specific Representative
RF Operating Parameter (RROP) information. This information is intended
for optional use by external ACS. It provides guidance values for some
RF parameters that are used by the system during operation, so that
external ACS can utilize these to compare between channels, bands, etc.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: Make dpp_auth_req_retries* more reliable
Jouni Malinen [Thu, 30 Nov 2017 10:56:24 +0000 (12:56 +0200)] 
tests: Make dpp_auth_req_retries* more reliable

These test cases were failing when run immediately after
dpp_pkex_test_fail. It looks like timing of the TX status and the short
eloop wait were getting reordered in this cases. This ended up with some
of the DPP-TX-STATUS event messages missing. Instead of explicitly
checking for those message, simply count the number of DPP-TX messages
to verify that the correct number of retries are being sent.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agonl80211: Use consistent "0x" prefix for the cookie values
Jouni Malinen [Thu, 30 Nov 2017 10:42:58 +0000 (12:42 +0200)] 
nl80211: Use consistent "0x" prefix for the cookie values

One of the event message for TX status was missing 'x' from the "0x"
prefix. Add that to make the used format consistent for all cookie debug
print cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Call wpas_dpp_stop() from wpas_dpp_deinit()
Jouni Malinen [Wed, 29 Nov 2017 22:11:22 +0000 (00:11 +0200)] 
DPP: Call wpas_dpp_stop() from wpas_dpp_deinit()

This makes the full DPP deinit operation more consistent with stopping
of a single operation. In practice, this adds the new GAS client
stopping functionality.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: DPP/PKEX and local failures
Jouni Malinen [Wed, 29 Nov 2017 11:45:39 +0000 (13:45 +0200)] 
tests: DPP/PKEX and local failures

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Stop pending GAS client operation on DPP_STOP_LISTEN
Jouni Malinen [Wed, 29 Nov 2017 22:07:50 +0000 (00:07 +0200)] 
DPP: Stop pending GAS client operation on DPP_STOP_LISTEN

This makes the operation more complete in stopping all ongoing DPP
related functionality.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Do not continue if public key hash derivation fails
Jouni Malinen [Wed, 29 Nov 2017 19:40:31 +0000 (21:40 +0200)] 
DPP: Do not continue if public key hash derivation fails

sha256_vector() result was ignored apart from printing out the failure
in the debug log. This is not really a normal case and it is better to
reject the full operation rather than try to continue with an incorrect
public key hash value.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Fix memory leak on dpp_auth_build_conf() error paths
Jouni Malinen [Wed, 29 Nov 2017 19:20:45 +0000 (21:20 +0200)] 
DPP: Fix memory leak on dpp_auth_build_conf() error paths

The wpabuf for the message needs to be freed on the error paths.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoJSON: Fix a memory leak on an error path
Jouni Malinen [Wed, 29 Nov 2017 11:22:44 +0000 (13:22 +0200)] 
JSON: Fix a memory leak on an error path

If the second json_alloc_token() call failed to allocate memory,
json_parse() missed the first allocation on the error path. Assign the
root pointer earlier for that case to avoid the potential memory leak.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Fix a memory leak on an error path
Jouni Malinen [Wed, 29 Nov 2017 11:03:48 +0000 (13:03 +0200)] 
DPP: Fix a memory leak on an error path

Need to free temporary allocations if dpp_build_conf_start() fails to
allocate memory.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Deinit PKEX instance on DPP_STOP_LISTEN
Jouni Malinen [Wed, 29 Nov 2017 10:24:01 +0000 (12:24 +0200)] 
DPP: Deinit PKEX instance on DPP_STOP_LISTEN

Previously this stopped only the DPP Authentication instance, but it is
better to clear both PKEX and Authentication.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: Generate DPP Config Object for legacy network (PSK)
Jouni Malinen [Wed, 29 Nov 2017 10:12:31 +0000 (12:12 +0200)] 
tests: Generate DPP Config Object for legacy network (PSK)

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Clear authentication instance on configuration completion in AP
Jouni Malinen [Mon, 27 Nov 2017 18:33:43 +0000 (20:33 +0200)] 
DPP: Clear authentication instance on configuration completion in AP

wpa_supplicant was already doing this and hostapd needs to clear
hapd->dpp_auth when completing the exchange in Configurator (GAS server)
role.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: sigma_dut DPP AP Configurator using self-configuration
Jouni Malinen [Mon, 27 Nov 2017 18:26:33 +0000 (20:26 +0200)] 
tests: sigma_dut DPP AP Configurator using self-configuration

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Do not process dpp_auth_ok_on_ack multiple times
Jouni Malinen [Mon, 27 Nov 2017 18:20:26 +0000 (20:20 +0200)] 
DPP: Do not process dpp_auth_ok_on_ack multiple times

An additional TX status callback could result in processing the DPP
authentication completion another time at least with hostapd. Fix this
by clearing the dpp_auth_ok_on_ack when processing it.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agoDPP: Fix compilation without CONFIG_TESTING_OPTIONS=y
Ashok Ponnaiah [Mon, 27 Nov 2017 11:20:58 +0000 (16:50 +0530)] 
DPP: Fix compilation without CONFIG_TESTING_OPTIONS=y

Add CONFIG_TESTING_OPTIONS ifdef protection to couple of forgotten DPP
test parameters in wpa_supplicant ctrl_iface.

Signed-off-by: Ashok Ponnaiah <aponnaia@qti.qualcomm.com>
6 years agoDPP: Ignore GAS server status callback for unknown response
Jouni Malinen [Mon, 27 Nov 2017 11:48:40 +0000 (13:48 +0200)] 
DPP: Ignore GAS server status callback for unknown response

It was possible for a timeout from an old GAS server operation to
trigger DPP configuration failure during the subsequent DPP operation.
Fix this by verifying that the status callback is for the response
generated during the same DPP Authentication/Configuration exchange.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
6 years agotests: DPP configurator (AP) signing own connector
Jouni Malinen [Mon, 27 Nov 2017 10:45:05 +0000 (12:45 +0200)] 
tests: DPP configurator (AP) signing own connector

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>