Commit graph

9480 commits

Author SHA1 Message Date
Srinivas Dasari
844dfeb804 QCA vendor command support to set band to driver
Add vendor command to pass SET setband command to the driver and read
the updated channel list from driver when this notification succeeds.
This allows the driver to update its internal channel lists based on
setband configuration.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2015-07-28 21:00:18 +03:00
Jouni Malinen
06836013d3 OpenSSL: Remove EAP-FAST TLSv1.0 only workaround for OpenSSL 1.1.0
The issue with the special form of TLS session tickets has been fixed in
the OpenSSL 1.1.0 branch, so disable workaround for it. OpenSSL 1.0.1
and 1.0.2 workaround is still in place until a release with the fix has
been made.

This allows TLSv1.1 and TLSv1.2 to be negotiated for EAP-FAST with the
OpenSSL versions that support this.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 21:00:18 +03:00
Jouni Malinen
9dd21d5183 tests: Allow local disconnect in openssl_cipher_suite_config_wpas
The openssl_ciphers="EXPORT" case may result in locally generated
disconnection event if the OpenSSL version used in the build rejects
export ciphers in default configuration (which is what OpenSSL 1.1.0
will likely do). Don't report a test case failure in such a case.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 21:00:18 +03:00
Jouni Malinen
3947997dcc EAP-TLS/TTLS/PEAP/FAST peer: Stop connection more quickly on local failure
If there is only zero-length buffer of output data in error case, mark
that as an immediate failure instead of trying to report that
non-existing error report to the server. This allows faster connection
termination in cases where a non-recoverable error occurs in local TLS
processing, e.g., if none of the configured ciphers are available.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 21:00:18 +03:00
Jouni Malinen
bb91243047 EAP-TTLS/PEAP/FAST peer: Stop immediately on local TLS processing failure
EAP-TLS was already doing this, but the other TLS-based EAP methods did
not mark methodState DONE and decision FAIL on local TLS processing
errors (instead, they left the connection waiting for a longer timeout).

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 21:00:18 +03:00
Jouni Malinen
6ee66b4251 OpenSSL: Add CONFIG_TLS_ADD_DL=y build option for hostapd
This behaves similarly to the same option in wpa_supplicant, i.e., adds
-ldl when linking in libcrypto from OpenSSL.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 21:00:18 +03:00
Jouni Malinen
c34cd66866 OpenSSL: Drop security level to 0 if needed for EAP-FAST
OpenSSL 1.1.0 disables the anonymous ciphers by default, so need to
enable these for the special case of anonymous EAP-FAST provisioning.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 21:00:17 +03:00
Jouni Malinen
16bc3b8935 OpenSSL: Add SHA256 support in openssl_tls_prf() for TLSv1.2
This is needed when enabling TLSv1.2 support for EAP-FAST since the
SSL_export_keying_material() call does not support the needed parameters
for TLS PRF and the external-to-OpenSSL PRF needs to be used instead.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 21:00:17 +03:00
Jouni Malinen
3de28506d2 OpenSSL: Implement openssl_tls_prf() for OpenSSL 1.1.0
This needs to use the new accessor functions since the SSL session
details are not directly accessible anymore and there is now sufficient
helper functions to get to the needed information.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 18:56:45 +03:00
Jouni Malinen
4d2a1b4f8f OpenSSL: Implement SSL_set_session_secret_cb() callback for OpenSSL 1.1.0
This needs to use the new accessor functions for client/server random
since the previously used direct access won't be available anymore.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 18:56:45 +03:00
Jouni Malinen
005c5dcf43 OpenSSL: Implement tls_connection_get_keys() for OpenSSL 1.1.0
This needs to use the new accessor functions since the SSL session
details are not directly accessible anymore.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 18:56:45 +03:00
Jouni Malinen
690e543e8a OpenSSL: Include openssl/engine.h and openssl/dsa.h explicitly
This seems to be needed for OpenSSL 1.1.0.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 18:56:45 +03:00
Jouni Malinen
e9690eb74e OpenSSL: Remove extra BIO_write() call on TLS client
openssl_handshake() was checking only that in_data is not NULL and not
its length when determining whether to call BIO_write(). Extend that to
check the buffer length as well. In practice, this removes an
unnecessary BIO_write() call at the beginning of a TLS handshake on the
client side. This did not cause issues with OpenSSL versions up to
1.0.2, but that call seems to fail with the current OpenSSL 1.1.0
degvelopment snapshot. There is no need for that zero-length BIO_write()
call, so remove it.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-28 18:56:45 +03:00
Jouni Malinen
d8aa603d53 tests: Skip fst_attach_wpas_error if no FST support
This check for FST testing support was forgotten from one of the new FST
test cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
2015-07-28 18:56:33 +03:00
Max Stepanov
aff4b2c139 tests: Add CPT parameters to p2ps_provision()
Add adv_cpt and seeker_cpt parameters to p2ps_provision() function.
The seeker_cpt is used in P2P_ASP_PROVISION command by a seeker, the
adv_cpt parameter is in P2P_ASP_PROVISION_RESP by an advertiser.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-27 00:47:20 +03:00
Max Stepanov
5e9d05115f tests: Add CPT parameter to p2ps_advertise()
Add an optional parameter to p2ps_advertise() function allowing to
specify CPT priority values.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-27 00:47:20 +03:00
Max Stepanov
c1e31bdb7f tests: Add CPT parameter to WpaSupplicant asp_provision()
Add an optional CPT parameter to asp_provision() method of
WpaSupplicant.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-27 00:47:19 +03:00
Max Stepanov
88f3d7c980 P2PS: Add feature capability to PD events
Report the feature capability on P2PS-PROV-START and P2PS-PROV-DONE
ctrl-iface events. A feature capability value is specified as
'feature_cap=<hex>' event parameter, where <val> is a hexadecimal
string of feature capability bytes in a PD Response frame.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-27 00:47:19 +03:00
Max Stepanov
c3ddf2c798 P2PS: Add CPT handling on PD request and response
On PD Request/follow-on PD Request preparation set a feature capability
CPT value of PD context.

On PD Request processing use a request CPT and service advertisement
CPT priority list to select a feature capability CPT of PD Response.

On follow-on PD Request processing use a request CPT and a CPT priority
list in PD context to select a CPT value of follow on PD Response.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-27 00:47:19 +03:00
Max Stepanov
0670de74ae P2PS: Add CPT parameter to P2PS_PROVISION and P2PS_PROVISION_RESP
Add a parameter allowing to specify a value of Coordination
Protocol Transport to P2PS_PROVISION and P2PS_PROVISION_RESP commands.

Extend the p2ps_provision structure to contain cpt_priority and
cpt_mask properties and initialize them on a P2PS PD request command.

The format of the parameter:
    cpt=<cpt>[:cpt]

where <cpt> is CPT name e.g. UDP or MAC. The CPT names are listed
according to their preferences to be used for a specific P2PS session.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-27 00:47:19 +03:00
Max Stepanov
e2b7fbf2fb P2PS: Add CPT parameter to P2P_SERVICE_ADD asp command
Add Coordination Transport Protocol parameter to P2P_SERVICE_ADD
asp command.

Extend p2ps_advertisement structure to contain CPT priorities
and a supported CPT bitmask.

The format of the new parameter:
    cpt=<cpt>[:<cpt>]

where <cpt> is a name of the Coordination Protocol Transport.
This implementation supports two CPT names: UDP and MAC.
The order of specified CPTs defines their priorities where
the first one has the highest priority.

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-27 00:47:19 +03:00
Max Stepanov
add5975751 utils: Add cstr_token() function
Add an auxiliary cstr_token() function to get a token from a const char
string. The function usage syntax is similar to str_token(), but unlike
str_token() the function doesn't modify the buffer of the string. Change
str_token() function implementation to use cstr_token().

Signed-off-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-27 00:47:19 +03:00
Andrei Otcheretianski
e999e56c2c tests: Add p2ps_connect_pd() method
Add p2ps_connect_pd() helper method which strictly validates the PD
results and establishes the connection between peers accordingly.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-26 21:45:35 +03:00
Andrei Otcheretianski
4796021088 tests: Add p2ps_provision() method
Add generic provision method. This method receives a seeker and an
advertiser devices, advertisement id, method, and a flag which indicates
whether deferred flow is expected. The method returns P2PS-PROV-DONE
events and the pin (if keypad or display method is used).

This method is needed to simplify the P2PS provision flows in the tests.
This method complies to the P2PS specification regarding the expected
order of the show and display PIN events.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-26 21:45:35 +03:00
Andrei Otcheretianski
1a1b015622 tests: Add asp_provision method to wpa_supplicant
Add asp_provision method which issues either P2PS PD Request or, if the
status is provided, continues the deferred flow by sending follow on
PD Request.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
Reviewed-by: Max Stepanov <Max.Stepanov@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
2015-07-26 21:45:35 +03:00
Jouni Malinen
f751368ec3 tests: Make discovery_auto more robust
This test case could fail if there were old BSS entries remaining in
cfg80211 scan results. That happened, e.g., when running test cases in
the following sequence: "discovery_social_plus_one discovery_auto".

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:45:14 +03:00
Jouni Malinen
898b33095e tests: FST SESSION_INITIATE and SESSION_RESPOND error cases
Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:45:14 +03:00
Jouni Malinen
8f997f044f FST: Make fst_hw_mode_to_band() non-inline function
There is no need for using an inline function for this. Save a bit in
binary size by using a normal function.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:45:14 +03:00
Jouni Malinen
78ca254237 tests: More FST GET_PEER_MBIES coverage
The case of valid but unknown peer address was not covered previously.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:45:13 +03:00
Jouni Malinen
f4843c2645 FST: Fix get_peer_mbies interface fetching in multi-group case
The foreach_fst_group() loop needs "break-if-found", not
"continue-if-not-found" to do the search iteration properly. If there
were multiple groups, the previous design could have failed to find the
interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:45:13 +03:00
Jouni Malinen
1ab51fb595 FST: Merge unreachable error case to another error return
fst_read_next_text_param() is never called with buflen <= 1, so this
separate error path is practically unreachable. Merge it with another
error path to make this a bit more compact.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:45:13 +03:00
Jouni Malinen
54b227a1ff tests: Use a shared FST setup function
This removes quite a bit of duplicated code. In addition, this starts
using different FST group names to get additional coverage.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:45:13 +03:00
Jouni Malinen
fa95b7c073 FST: Use more robust interface-find for TEST_REQUEST
It is possible for there to be multiple FST groups, so the hardcoded
mechanism of selecting the first one when sending out an event message
may not be sufficient. Get the interface from the caller, if available,
and if not, go through all groups in search of an interface to send the
event on.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:45:13 +03:00
Jouni Malinen
481fa8fb22 FST: Use more robust interface-find for event messages
It is possible for there to be multiple FST groups, so the hardcoded
mechanism of selecting the first one when sending out an event message
may not be sufficient. Get the interface from the caller, if available,
and if not, go through all groups in search of an interface to send the
event on.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:09 +03:00
Jouni Malinen
1f9427c9cd tests: Explicitly close hostapd global control socket on RELOG
Without this, the run-tests.py socket could have been left in attached
to receive all hostapd global events during a test case. This could hit
the limit of pending messages on the socket since there is nothing
clearing this socket during the execution of a test case. Fix this by
explicitly closing the socket after having completed the RELOG command.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:09 +03:00
Jouni Malinen
55cd405a44 FST: Remove unnecessary fst_attach() already attached check
Now that both hostapd and wpa_supplicant already enforce no duplicate
fst_attach() calls, there is no need for this check within fst_attach().

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:09 +03:00
Jouni Malinen
5994658309 tests: FST attach errors in wpa_supplicant
Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:09 +03:00
Jouni Malinen
5dbd3bf915 FST: Avoid memory leak on double FST-ATTACH
Do not allow wpa_s->fst to be replaced when processing FST-ATTACH
command for an interface that has already been attached.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:09 +03:00
Jouni Malinen
6e2536fc79 tests: FST Setup Request processing and OOM during MBIE update
Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:09 +03:00
Jouni Malinen
2fffbd4db8 tests: FST setup multiple times
This verifies FST group dialog_token wrap-around and behavior with large
number of session setups and teardowns.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:09 +03:00
Jouni Malinen
fe73b469e8 FST: Fix dialog token wrap-around
Dialog token is only 8 bits and maintaining u32 version of it in struct
fst_group resulted in incorrect wrap-around behavior in
fst_group_assign_dialog_token(). It was possible to assign u8
dialog_token value 0 because of this. Fix this by using u8 variable
consistently.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:08 +03:00
Jouni Malinen
3aa1ca9aec tests: Additional FST Setup test coverage
This adds a test case that goes through session initialization through
separate commands that can be modified more easily for special case. The
first such special case is using special FST Setup Request frames with
non-standard MBIE contents to hit different code paths for finding the
interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:08 +03:00
Jouni Malinen
9162eed42b tests: Extend fst_ap_ctrl_iface to support existing groups
Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 18:12:08 +03:00
Jouni Malinen
6c247100e8 tests: FST protocol tests to verify invalid STIE header
Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 11:22:21 +03:00
Jouni Malinen
b019955297 FST: Validate STIE header in FST Setup Request/Response
While this is always supposed to be the first element, check that this
is indeed the case instead of blindly using values from within the
element.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 11:22:21 +03:00
Jouni Malinen
e49f535dc5 FST: Fix Session Transition element length field value
The Element ID and Length subfields are not supposed to be included in
the Length. In addition, both of these subfields needs to be filled in
even for non-zero status code cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-26 11:21:58 +03:00
Jouni Malinen
94edea89fd FST: Print reason for ignoring FST Action frame in debug log
This makes it easier to understand why some frames are not processed.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-25 23:20:33 +03:00
Jouni Malinen
ff7a4bd13f FST: Do not replace previous attachment
hapd->iface->fst must not be overridden if it is already pointing to FST
instance. Without this, duplicated FST-ATTACH could result in memory
leak and process termination.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-25 19:52:27 +03:00
Jouni Malinen
ceb8a79c33 FST: Use -EINVAL instead of EINVAL as return value
This is more consistent with other error cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
2015-07-25 19:50:43 +03:00
Ashok Ponnaiah
8659e33342 atheros: Enable PMF functionality without CONFIG_IEEE80211R=y
This extends the previous PMF (CONFIG_IEEE80211W=y) design that used
functionality from the FT (CONFIG_IEEE80211R=y) changes to work without
requiring CONFIG_IEEE80211R=y build option to be included.

Signed-off-by: Ashok Ponnaiah <aponnaia@qti.qualcomm.com>
2015-07-24 16:55:16 +03:00