]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
8 years agotests: FT PTK rekeying triggered by AP/station after roam
Jouni Malinen [Wed, 9 Dec 2015 22:05:10 +0000 (00:05 +0200)] 
tests: FT PTK rekeying triggered by AP/station after roam

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFT: Fix FTIE generation for EAPOL-Key msg 3/4
Jouni Malinen [Wed, 9 Dec 2015 22:12:59 +0000 (00:12 +0200)] 
FT: Fix FTIE generation for EAPOL-Key msg 3/4

This FTIE needs to be an exact copy of the one in (Re)Association
Response frame. Copy the stored element rather than building a new copy
that would not have the correct MIC value. This is needed to fix PTK
rekeying after FT protocol run.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFT: Fix sm->assoc_resp_ftie storing on the AP side
Jouni Malinen [Wed, 9 Dec 2015 22:11:00 +0000 (00:11 +0200)] 
FT: Fix sm->assoc_resp_ftie storing on the AP side

The FTIE from (Re)Association Response frame was copied before
calculating the MIC. This resulted in incorrect value being used when
comparing the EAPOL-Key msg 2/4 value in case PTK rekeying was used
after FT protocol run. Fix this by storing the element after the MIC
field has been filled in.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoFT: Fix FTIE generation for 4-way handshake after FT protocol run
Jouni Malinen [Wed, 9 Dec 2015 22:06:06 +0000 (00:06 +0200)] 
FT: Fix FTIE generation for 4-way handshake after FT protocol run

wpa_insert_pmkid() did not support cases where the original RSN IE
included any PMKIDs. That case can happen when PTK rekeying through
4-way handshake is used after FT protocol run. Such a 4-way handshake
used to fail with wpa_supplicant being unable to build the EAPOL-Key msg
2/4.

Fix this by extending wpa_insert_pmkid() to support removal of the old
PMKIDs, if needed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Make pmksa_cache_opportunistic_connect more robust
Jouni Malinen [Sun, 6 Dec 2015 18:31:18 +0000 (20:31 +0200)] 
tests: Make pmksa_cache_opportunistic_connect more robust

This test case could fail if the cfg80211 scan cache brought in a BSS
entry from an earlier test case and a new scan did not get executed
prior to the ROAM command. Fix this by forcing the scan to go through
prior to roaming to AP2

This issue showed up with the following test case sequence:
connect_cmd_roam pmksa_cache_opportunistic_connect

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAP: Use more readable version of management group cipher in error cases
Jouni Malinen [Sun, 6 Dec 2015 18:01:05 +0000 (20:01 +0200)] 
AP: Use more readable version of management group cipher in error cases

This makes it easier to interpret AP side debug log for a case where a
station specifies in unsupported management group cipher.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPA2 AP processing of RSN IE differences
Jouni Malinen [Sun, 6 Dec 2015 17:33:36 +0000 (19:33 +0200)] 
tests: WPA2 AP processing of RSN IE differences

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAdd TEST_ASSOC_IE for WPA/RSN IE testing on AP side
Jouni Malinen [Sun, 6 Dec 2015 17:30:59 +0000 (19:30 +0200)] 
Add TEST_ASSOC_IE for WPA/RSN IE testing on AP side

The new wpa_supplicant control interface command "TEST_ASSOC_IE
<hexdump>" can now be used to override the WPA/RSN IE for Association
Request frame and following 4-way handshake to allow protocol testing of
AP side processing of WPA/RSN IE.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Write GTK locations into debug log in key_lifetime_in_memory
Jouni Malinen [Sun, 6 Dec 2015 15:48:43 +0000 (17:48 +0200)] 
tests: Write GTK locations into debug log in key_lifetime_in_memory

It looks like it is possible for the GTK to be found from memory every
now and then. This makes these test cases fail. Write the memory
addresses in which the GTK was found to the log to make it somewhat
easier to try to figure out where the key can be left in memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Make dbus_wps_oom more robust
Jouni Malinen [Sun, 6 Dec 2015 15:10:06 +0000 (17:10 +0200)] 
tests: Make dbus_wps_oom more robust

It was possible for the BSSs object property change signal to be
generated during the OOM test case for Get(). If that happened, the
signal was not sent out, but the following Get(BSSs) operation succeeded
unexpectedly which resulted in a test failure. Make this less likely to
happen by waiting 50 ms between the scan and Get(BSSs) operation. This
should be sufficient to cover most cases since wpa_supplicant uses 5 ms
timeout for D-Bus property changed updates.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Make ap_max_num_sta_no_probe_resp more robust
Jouni Malinen [Sun, 6 Dec 2015 11:35:40 +0000 (13:35 +0200)] 
tests: Make ap_max_num_sta_no_probe_resp more robust

It was possible for the AP's Beacon frame to be seen by dev[0] when
running a scan. This is not an error case. Make this test case more
robust by verifying with a sniffer whether a Probe Response frame was
sent to unexpected STA.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFST: Print debug entry on MB IE update based on EVENT_AUTH
Jouni Malinen [Sun, 6 Dec 2015 10:53:24 +0000 (12:53 +0200)] 
FST: Print debug entry on MB IE update based on EVENT_AUTH

This is more consistent with all the other callers of
wpas_fst_update_mbie().

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: D-Bus vendor element operations
Jouni Malinen [Sun, 6 Dec 2015 10:41:31 +0000 (12:41 +0200)] 
tests: D-Bus vendor element operations

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agodbus: Add support for vendor specific elements
Avichal Agarwal [Fri, 4 Dec 2015 05:27:27 +0000 (10:57 +0530)] 
dbus: Add support for vendor specific elements

The new methods are
1. VendorElemAdd "i" "ay" i=integer ay=array of bytes
2. VendorElemGet "i" i=integer (output array of bytes)
3. VendorElemRem "i" "ay" i=integer ay=array of bytes

These provide functionality similar to the control interface commands
VENDOR_ELEM_ADD, VENDOR_ELEM_GET, and VENDOR_ELEM_REMOVE.

Signed-off-by: Avichal Agarwal <avichal.a@samsung.com>
Signed-off-by: Purushottam Kushwaha <p.kushwaha@samsung.com>
Signed-off-by: Kyeong-Chae Lim <kcya.lim@samsung.com>
Signed-off-by: Mayank Haarit <mayank.h@samsung.com>
Signed-off-by: Dilshad Ahmad <dilshad.a@samsung.com>
[VendorElemGet to return array of bytes instead of string; cleanup]
Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: EAP-PSK local error cases
Jouni Malinen [Sun, 6 Dec 2015 09:13:12 +0000 (11:13 +0200)] 
tests: EAP-PSK local error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: EAP-IKEv2 local error cases
Jouni Malinen [Sat, 5 Dec 2015 20:04:00 +0000 (22:04 +0200)] 
tests: EAP-IKEv2 local error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-IKEv2: Check HMAC SHA1/MD5 result
Jouni Malinen [Sat, 5 Dec 2015 19:49:04 +0000 (21:49 +0200)] 
EAP-IKEv2: Check HMAC SHA1/MD5 result

Make the IKEv2 helper functions return a possible error return from the
HMAC routines.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: WPS and fragment ack OOM
Jouni Malinen [Sat, 5 Dec 2015 19:35:45 +0000 (21:35 +0200)] 
tests: WPS and fragment ack OOM

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoUse proper build config for parsing proxy_arp
Matt Woods [Sat, 5 Dec 2015 07:20:58 +0000 (07:20 +0000)] 
Use proper build config for parsing proxy_arp

In the definition of struct hostapd_bss_config, proxy_arp isn't affected
by the macro CONFIG_HS20. In addition, proxy_arp is not described in the
section of Hotspot 2.0 in the file hostapd.conf. The item proxy_arp
should be decided its action area by the macro CONFIG_PROXYARP which is
used to select whether the needed function gets included in the build.

Signed-off-by: Matt Woods <matt.woods@aliyun.com>
8 years agotests: PKCS #8 private key with PKCS #5 v1.5 and v2.0 format
Jouni Malinen [Sat, 5 Dec 2015 18:24:53 +0000 (20:24 +0200)] 
tests: PKCS #8 private key with PKCS #5 v1.5 and v2.0 format

This verifies client private key use in encrypted PKCS #8 format with
PKCS #5 v1.5 format using pbeWithMD5AndDES-CBC and PKCS #5 v2.0 format
using PBES2 with des-ede3-cbc.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS: Add support for PKCS #5 v2.0 PBES2
Jouni Malinen [Sat, 5 Dec 2015 18:23:12 +0000 (20:23 +0200)] 
TLS: Add support for PKCS #5 v2.0 PBES2

This extends the internal TLS support for PKCS #5 v2.0 PBES2 private key
format with des-ede3-cbc encryption and PBKDF2 SHA-1.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: P2P persistent group formation, re-invocation, and cancel
Jouni Malinen [Fri, 4 Dec 2015 21:15:11 +0000 (23:15 +0200)] 
tests: P2P persistent group formation, re-invocation, and cancel

Verify that P2P_CANCEL gets rejected on fully re-invoked persistent
group. This did not work properly before the last couple of commits and
before this week, the P2P_CANCEL on a separate group interface in P2p
Client role could result in use of freed memory and process termination.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Fix re-invoked client interface completion on data connection
Jouni Malinen [Fri, 4 Dec 2015 21:11:10 +0000 (23:11 +0200)] 
P2P: Fix re-invoked client interface completion on data connection

This was already working for the case where a separate group interface
is used due to the recent commit
328f49acfe961a212e89e750516d2e2cc320765f ('P2P: Complete group formation
on client data connection'). However, the case of no separate group
interface was used did not clear the interface state properly on data
connection. Fix this by setting the group formation information in
wpas_start_p2p_client().

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Fix P2P_CANCEL for p2p_in_invitation case
Jouni Malinen [Fri, 4 Dec 2015 20:49:59 +0000 (22:49 +0200)] 
P2P: Fix P2P_CANCEL for p2p_in_invitation case

Commit f05cee9714ae87d315d893699a536b60a5aa73a9 ('P2P: Clear
p2p_in_invitation on cancel') added a wpas_p2p_cancel() case to call
wpas_p2p_group_formation_failed() if wpa_s->p2p_in_invitation is set.
This is done in a loop going through wpa_s->next pointers. However, the
call here can result in removing the interface and freeing wpa_s. The
following attempt to read wpa_s->next is from freed memory and that can
result in process termination when using a separate P2P group interface
and issuing P2P_CANCEL on a group that was started through re-invocation
of a persistent group.

The recent commit 328f49acfe961a212e89e750516d2e2cc320765f ('P2P:
Complete group formation on client data connection') "fixed" this by
accident since wpa_s->p2p_in_invitation gets cleared in the sequence
that could hit this issue and this results in P2P_CANCEL getting
rejected. However, the real bug here is in the loop that continues after
possible wpa_s instance deletion. Fix that by breaking out of the loop.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Make tests using multi_check() more robust
Jouni Malinen [Fri, 4 Dec 2015 19:03:43 +0000 (21:03 +0200)] 
tests: Make tests using multi_check() more robust

It was possible for a cached scan entry in cfg80211 from an earlier test
case to show up while verifying that the disabled AP does not show up in
scan results. This could result in invalid test failures, e.g., when
running test cases "ap_require_ht ap_multi_bss_config" multiple times
(depends a bit on timing). Make this less likely to occur by explicitly
clearing the scan cache and by stopping wlan1 from trying to associate
before stopping ap_required_ht* test cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoEST: Comment out X509_REQ_print calls on Android with BoringSSL
Jouni Malinen [Fri, 4 Dec 2015 16:26:06 +0000 (18:26 +0200)] 
EST: Comment out X509_REQ_print calls on Android with BoringSSL

These were restored into BoringSSL in June 2015, but not all Android
branches include those changes. To fix the build, comment these call out
on Android for now if hs20-osu-client is built against BoringSSL. These
are used only for debugging purposes, so this is fine for Hotspot 2.0
functionality.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoEST: Add CSR generation support with BoringSSL
Jouni Malinen [Fri, 4 Dec 2015 14:25:21 +0000 (16:25 +0200)] 
EST: Add CSR generation support with BoringSSL

This completes EST support with hs20-osu-client when built with
BoringSSL instead of OpenSSL.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoEST: Implement pkcs7_to_cert() with BoringSSL
Jouni Malinen [Fri, 4 Dec 2015 13:38:50 +0000 (15:38 +0200)] 
EST: Implement pkcs7_to_cert() with BoringSSL

This adds one more step in completing hs20-osu-client support when using
BoringSSL instead of OpenSSL. EST client can now parse the cacerts file.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoHTTP (curl): OCSP with BoringSSL
Jouni Malinen [Fri, 4 Dec 2015 12:06:53 +0000 (14:06 +0200)] 
HTTP (curl): OCSP with BoringSSL

This adds experimental support for using OCSP with libcurl that is built
against BoringSSL. This needs small modifications to libcurl to allow
CURLOPT_SSL_VERIFYSTATUS to be used to call
SSL_enable_ocsp_stapling(connssl->handle) in ossl_connect_step1().

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoBoringSSL: Move OCSP implementation into a separate file
Jouni Malinen [Fri, 4 Dec 2015 12:04:31 +0000 (14:04 +0200)] 
BoringSSL: Move OCSP implementation into a separate file

This makes it easier to share the OCSP implementation needed for
BoringSSL outside tls_openssl.c. For now, this is mainly for
http_curl.c.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoBoringSSL: Support new SHA_CTX definition for EAP-SIM PRF
Jouni Malinen [Fri, 4 Dec 2015 09:26:29 +0000 (11:26 +0200)] 
BoringSSL: Support new SHA_CTX definition for EAP-SIM PRF

BoringSSL modified the struct sha_state_st (SHA_CTX) definition by
converting h0..h4 with h[5] array. This broke wpa_supplicant/hostapd
build with EAP-SIM enabled. BoringSSL restored the old version for
ANDROID builds, but only the new version is currently defined for
non-Android cases. For now, fix this by having matching selection in
fips_prf_openssl.c based on OPENSSL_IS_BORINGSSL and ANDROID defines.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoOpenSSL: Fix build with current OpenSSL master branch snapshot
Jouni Malinen [Thu, 3 Dec 2015 21:53:35 +0000 (23:53 +0200)] 
OpenSSL: Fix build with current OpenSSL master branch snapshot

OpenSSL 1.1.x will apparently go out with "SSLeay" renamed in the API to
"OpenSSL", which broke the build here for fetching the version of the
running OpenSSL library when wpa_supplicant/hostapd is built against the
current OpenSSL snapshot.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Fix ap_wps_er_multi_add_enrollee cleanup steps
Jouni Malinen [Wed, 2 Dec 2015 16:19:39 +0000 (18:19 +0200)] 
tests: Fix ap_wps_er_multi_add_enrollee cleanup steps

Only one of the ERs was stopped at the end of the test case and this
could result in the following test case failing, e.g., when executing
this test case sequence: ap_wps_er_multi_add_enrollee ap_wps_upnp.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Remove forgotten print from gas_anqp_oom_hapd
Jouni Malinen [Wed, 2 Dec 2015 11:32:59 +0000 (13:32 +0200)] 
tests: Remove forgotten print from gas_anqp_oom_hapd

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Make autogo_join_auto_go_neg more robust
Jouni Malinen [Tue, 1 Dec 2015 22:40:17 +0000 (00:40 +0200)] 
tests: Make autogo_join_auto_go_neg more robust

It was possible for this test case to fail if the single attempt of
discovering the peer as part of the scan for join failed. This test case
was useful in combination with another test case:
ap_hs20_fetch_osu autogo_join_auto_go_neg

However, there is now an explicit test case (discovery_after_gas) for
this, so autogo_join_auto_go_neg can be made more robust without losing
testing coverage.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: P2P device discovery after fragmented GAS/ANQP exchange
Jouni Malinen [Tue, 1 Dec 2015 22:14:47 +0000 (00:14 +0200)] 
tests: P2P device discovery after fragmented GAS/ANQP exchange

This verifies cfg80211/mac80211 offchannel TX cancellation steps.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agonl80211: Cancel all pending TX frame cookies
Jouni Malinen [Tue, 1 Dec 2015 22:12:32 +0000 (00:12 +0200)] 
nl80211: Cancel all pending TX frame cookies

These needs to be cancelled so that the kernel driver does not get left
with all old entries blocking other offchannel operations.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: EAP-EKE local error cases
Jouni Malinen [Mon, 30 Nov 2015 22:46:35 +0000 (00:46 +0200)] 
tests: EAP-EKE local error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-EKE peer: Fix memory leak on error path
Jouni Malinen [Mon, 30 Nov 2015 22:20:25 +0000 (00:20 +0200)] 
EAP-EKE peer: Fix memory leak on error path

If DHComponent_P derivation fails (local crypto operation failure), the
message buffer was not freed.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Fix p2p_go_move_scm_peer_does_not_support to clear avoid freqs
Jouni Malinen [Mon, 30 Nov 2015 20:06:54 +0000 (22:06 +0200)] 
tests: Fix p2p_go_move_scm_peer_does_not_support to clear avoid freqs

The P2P channel list on dev[1] at the end of
p2p_go_move_scm_peer_does_not_support was empty because all of the 2.4
GHz band got disabled by the simulated avoid frequencies driver event.
That channel list needs to be cleared prior to resetting regulatory
domain back to world roaming to get the P2P channel list updated
properly for the following test cases.

This was triggered by the following test case sequence:
p2p_go_move_scm_peer_does_not_support persistent_group_and_role_change

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: P2P group formation timeout with cfg80211 P2P Device
Jouni Malinen [Mon, 30 Nov 2015 19:38:23 +0000 (21:38 +0200)] 
tests: P2P group formation timeout with cfg80211 P2P Device

Verify that both the GO and P2P Client processing of P2P group formation
timeout removes the correct group.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Complete group formation on client data connection
Jouni Malinen [Mon, 30 Nov 2015 19:35:16 +0000 (21:35 +0200)] 
P2P: Complete group formation on client data connection

This was already the case in the GO role where the first client
connection is waited before marking
wpa_s->p2p_go_group_formation_completed = 1 and clearing
wpa_s->global->p2p_group_formation. However, in the P2P Client role,
that was done already at the completion of the WPS exchange. This can be
problematic since group formation timeout may still try to clear the
group and with wpa_s->global->p2p_group_formation == NULL, the correct
group interface may not be found.

Fix this by postponing clearing of wpa_s->global->p2p_group_formation on
the P2P Client side until the data connection has been completed and
group is declared started.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoRevert "tests: Dynamic hwsim p2ps_channel_active_go_and_station_different_mcc"
Jouni Malinen [Mon, 30 Nov 2015 17:58:07 +0000 (19:58 +0200)] 
Revert "tests: Dynamic hwsim p2ps_channel_active_go_and_station_different_mcc"

This reverts commit 78fdab307e4f10275795a196489a4894b0b437d3. This test
case needs MCC support on two stations, so the earlier attempt to handle
this with one dynamic interface is not sufficient.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Show vm-run.sh command line for re-running failure sequences
Jouni Malinen [Mon, 30 Nov 2015 17:42:56 +0000 (19:42 +0200)] 
tests: Show vm-run.sh command line for re-running failure sequences

Now that vm-run.sh supports a long list of test cases without crashing
the VM kernel, there is no need to use the "parallel-vm.py -1 1 <tests>"
workaround. Print the re-run example commands with vm-run.sh instead. In
addition, add the --long argument if it was specified for the test run
to avoid skipping test cases in the re-run case.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Force concurrent exchange in ap_wps_er_multi_add_enrollee
Jouni Malinen [Mon, 30 Nov 2015 14:58:47 +0000 (16:58 +0200)] 
tests: Force concurrent exchange in ap_wps_er_multi_add_enrollee

This makes it more likely for the two ERs to go through WPS UPnP
exchange in parallel. This was already happening every now and then and
resulted in failures. However, now that there is support for multiple
concurrent exchanges, it is useful to have this test case hit that
possibility more frequently.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoWPS: Support parallel UPnP WPS protocol runs
Jouni Malinen [Mon, 30 Nov 2015 14:57:11 +0000 (16:57 +0200)] 
WPS: Support parallel UPnP WPS protocol runs

This allows multiple external registrars to execute a WPS protocol run
with a WPS AP over UPnP. Previously, hostapd supported only a single WPS
peer entry at a time and if multiple ERs tried to go through a WPS
protocol instance concurrently, only one such exchange could succeed.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: wpa_supplicant sched_scan_plans parsing
Jouni Malinen [Mon, 30 Nov 2015 12:01:40 +0000 (14:01 +0200)] 
tests: wpa_supplicant sched_scan_plans parsing

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoAllow sched_scan_plans to be updated at runtime
Jouni Malinen [Mon, 30 Nov 2015 12:00:41 +0000 (14:00 +0200)] 
Allow sched_scan_plans to be updated at runtime

This allows the control interface SET command to be used to update the
sched_scan_plans parameter at runtime. In addition, an empty string can
be used to clear the previously configured plan.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agotests: Allow passing more arguments to vm-run.sh
Johannes Berg [Mon, 30 Nov 2015 10:59:09 +0000 (11:59 +0100)] 
tests: Allow passing more arguments to vm-run.sh

The script is currently limited by the maximum kernel command line
length and if that's exceeded the kernel panics at boot. Fix this by
writing the arguments to a file and reading it in the VM.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agoAdd support for configuring scheduled scan plans
Avraham Stern [Tue, 17 Nov 2015 13:08:24 +0000 (15:08 +0200)] 
Add support for configuring scheduled scan plans

Add the option to configure scheduled scan plans in the config file.
Each scan plan specifies the interval between scans and the number
of scan iterations. The last plan will run infinitely and thus
specifies only the interval between scan iterations.

usage:
sched_scan_plans=<interval:iterations> <interval2:iterations2> ... <interval>

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agonl80211: Add support for multiple scan plans for scheduled scan
Avraham Stern [Tue, 17 Nov 2015 13:08:23 +0000 (15:08 +0200)] 
nl80211: Add support for multiple scan plans for scheduled scan

Add 'scan plans' to driver scan parameters for scheduled scan.
Each 'scan plan' specifies the number of iterations to run the scan
request and the interval between iterations. When a scan plan
finishes (i.e., it was run for the specified number of iterations),
the next scan plan is executed. The last scan plan will run
infinitely.

The maximum number of supported scan plans, the maximum number of
iterations for a single scan plan and the maximum scan interval
are advertised by the driver.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
8 years agotests: Extend scan_dfs to cover US-disallowed channels 12 and 13
Jouni Malinen [Mon, 30 Nov 2015 09:59:45 +0000 (11:59 +0200)] 
tests: Extend scan_dfs to cover US-disallowed channels 12 and 13

Verify that active scanning is not used in US regulatory domain on 2.4
GHz channels 12 and 13.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
8 years agoP2P: Make p2p_go_configured() more robust against unexpected calls
Jouni Malinen [Sun, 29 Nov 2015 23:25:24 +0000 (01:25 +0200)] 
P2P: Make p2p_go_configured() more robust against unexpected calls

A hwsim test sequence was able to hit a SIGSEGV in
p2p_go_save_group_common_freqs() called by p2p_go_configured() callback
in a case where a non-P2P AP mode operation is started in wpa_supplicant
(wpas_ap_wep test case). This callback should not have happened for
non-P2P case and the debug logs did not make it clear how this could
happen. In addition, it is unclear how this could be reproduced.

To avoid this type of issues, clear the wpa_s->ap_configured_cb pointer
as soon as the first call to the function happens. In addition, verify
that wpa_s->go_params is available before processing the GO configured
callback.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: EAP-TLS with SHA512/SHA384 signature
Jouni Malinen [Sun, 29 Nov 2015 22:39:38 +0000 (00:39 +0200)] 
tests: EAP-TLS with SHA512/SHA384 signature

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: ap_wpa2_eap_fast_prf_oom with internal TLS implementation
Jouni Malinen [Sun, 29 Nov 2015 21:57:39 +0000 (23:57 +0200)] 
tests: ap_wpa2_eap_fast_prf_oom with internal TLS implementation

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS client: Fix session_resumed status after TLS session ticket use
Jouni Malinen [Sun, 29 Nov 2015 21:52:30 +0000 (23:52 +0200)] 
TLS client: Fix session_resumed status after TLS session ticket use

conn->session_resumed was not set to 1 after successful use of a TLS
session ticket with EAP-FAST. This resulted in the wpa_supplicant STATUS
tls_session_reused showing incorrect value (0 instead of 1) when
EAP-FAST PAC was used. Fix this by setting conn->session_resumed = 1
when TLS handshake using the session ticket succeeds.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFix tls_connection_prf() regression with CONFIG_TLS=internal
Jouni Malinen [Sun, 29 Nov 2015 21:40:54 +0000 (23:40 +0200)] 
Fix tls_connection_prf() regression with CONFIG_TLS=internal

Commit af851914f810978909dd8598ab88030fe43d0051 ('Make
tls_connection_get_keyblock_size() internal to tls_*.c') broke
tls_connection_prf() with the internal TLS implementation when using
skip_keyblock=1. In practice, this broke EAP-FAST. Fix this by deriving
the correct number of PRF bytes before skipping the keyblock.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS: Add support for extKeyUsage X.509v3 extension
Jouni Malinen [Sun, 29 Nov 2015 19:53:23 +0000 (21:53 +0200)] 
TLS: Add support for extKeyUsage X.509v3 extension

If the server/client certificate includes the extKeyUsage extension,
verify that the listed key purposes include either the
anyExtendedKeyUsage wildcard or id-kp-serverAuth/id-kp-clientAuth,
respectively.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Skip ap_wpa2_eap_ttls_dh_params_dsa with internal TLS
Jouni Malinen [Sun, 29 Nov 2015 19:09:44 +0000 (21:09 +0200)] 
tests: Skip ap_wpa2_eap_ttls_dh_params_dsa with internal TLS

DH DSA parameters are not yet supported.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Skip PKCS#12 tests with internal TLS client implementation
Jouni Malinen [Sun, 29 Nov 2015 19:07:39 +0000 (21:07 +0200)] 
tests: Skip PKCS#12 tests with internal TLS client implementation

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAdd TEST_FAIL() support for internal hash functions
Jouni Malinen [Sun, 29 Nov 2015 19:01:33 +0000 (21:01 +0200)] 
Add TEST_FAIL() support for internal hash functions

md4_vector(), md5_vector(), sha1_vector(), and sha256_vector() already
supported TEST_FAIL() with the OpenSSL crypto implementation, but the
same test functionality is needed for the internal crypto implementation
as well.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Skip dbus_connect_eap if altsubject_match is not supported
Jouni Malinen [Sun, 29 Nov 2015 18:57:26 +0000 (20:57 +0200)] 
tests: Skip dbus_connect_eap if altsubject_match is not supported

This test case fails with the current internal TLS client implementation
since the needed altsubject_match parameter is not yet supported.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoFix memory leak on NFC DH generation error path
Jouni Malinen [Sun, 29 Nov 2015 18:53:20 +0000 (20:53 +0200)] 
Fix memory leak on NFC DH generation error path

It was possible for some NFC DH generation error paths to leak memory
since the old private/public key was not freed if an allocation failed.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Fix wpas_ctrl_oom with the internal TLS implementation
Jouni Malinen [Sun, 29 Nov 2015 18:43:44 +0000 (20:43 +0200)] 
tests: Fix wpas_ctrl_oom with the internal TLS implementation

One of the OOM cases does not apply for internal crypto implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Fix wpas_ctrl_network without SAE
Jouni Malinen [Sun, 29 Nov 2015 18:38:34 +0000 (20:38 +0200)] 
tests: Fix wpas_ctrl_network without SAE

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Skip domain_match and domain_suffix_match with internal TLS
Jouni Malinen [Sun, 29 Nov 2015 18:35:05 +0000 (20:35 +0200)] 
tests: Skip domain_match and domain_suffix_match with internal TLS

The internal TLS client in wpa_supplicant does not yet support the
functionality needed for these test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS client: Add certificate chain validation failure callbacks
Jouni Malinen [Sun, 29 Nov 2015 18:32:52 +0000 (20:32 +0200)] 
TLS client: Add certificate chain validation failure callbacks

This adds more support for event_cb() calls for various server
certificate chain validation failures.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: TLS v1.2 check in ap_wpa2_eap_tls_versions for internal TLS
Jouni Malinen [Sun, 29 Nov 2015 18:04:26 +0000 (20:04 +0200)] 
tests: TLS v1.2 check in ap_wpa2_eap_tls_versions for internal TLS

The internal TLS implementation in wpa_supplicant supports TLS v1.2, so
verify that this version can be disabled.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS client: Add support for disabling TLS versions
Jouni Malinen [Sun, 29 Nov 2015 18:03:11 +0000 (20:03 +0200)] 
TLS client: Add support for disabling TLS versions

The internal TLS client implementation in wpa_supplicant can now be used
with the phase2 parameters tls_disable_tlsv1_0=1, tls_disable_tlsv1_1=1,
and tls_disable_tlsv1_2=1 to disable the specified TLS version(s).

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS client: Use TLS_CONN_* flags
Jouni Malinen [Sun, 29 Nov 2015 17:48:17 +0000 (19:48 +0200)] 
TLS client: Use TLS_CONN_* flags

This makes it simpler to add support for new TLS_CONN_* flags without
having to add a new configuration function for each flag.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS: Add support for tls_get_version()
Jouni Malinen [Sun, 29 Nov 2015 17:41:37 +0000 (19:41 +0200)] 
TLS: Add support for tls_get_version()

This allows wpa_supplicant to return eap_tls_version STATUS information
when using the internal TLS client implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Skip OCSP test cases with the internal TLS implementation
Jouni Malinen [Sun, 29 Nov 2015 17:32:45 +0000 (19:32 +0200)] 
tests: Skip OCSP test cases with the internal TLS implementation

The internal TLS client implementation does not yet support OCSP.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: ap_wpa2_eap_ttls_server_cert_hash with internal TLS client
Jouni Malinen [Sun, 29 Nov 2015 17:02:04 +0000 (19:02 +0200)] 
tests: ap_wpa2_eap_ttls_server_cert_hash with internal TLS client

Since the internal TLS client implementation in wpa_supplicant now has
sufficient support for this functionality, allow the test case to be
executed.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS client: Add support for server certificate probing
Jouni Malinen [Sun, 29 Nov 2015 16:59:27 +0000 (18:59 +0200)] 
TLS client: Add support for server certificate probing

The internal TLS client implementation can now be used with
ca_cert="probe://" to probe the server certificate chain. This is also
adding the related CTRL-EVENT-EAP-TLS-CERT-ERROR and
CTRL-EVENT-EAP-PEER-CERT events.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS: Add TLS v1.2 signature algorithm support for SHA384 and SHA512
Jouni Malinen [Sun, 29 Nov 2015 16:16:07 +0000 (18:16 +0200)] 
TLS: Add TLS v1.2 signature algorithm support for SHA384 and SHA512

This extends the internal TLS client implementation to support signature
algorithms SHA384 and SHA512 in addition to the previously supported
SHA256.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agocrypto: Add CRYPTO_HASH_ALG_SHA384 and CRYPTO_HASH_ALG_SHA512
Jouni Malinen [Sun, 29 Nov 2015 16:14:50 +0000 (18:14 +0200)] 
crypto: Add CRYPTO_HASH_ALG_SHA384 and CRYPTO_HASH_ALG_SHA512

This extends the crypto_hash_*() API to support SHA384 and SHA512 when
built with CONFIG_TLS=internal.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS client: Add signature_algorithms extension into ClientHello
Jouni Malinen [Sun, 29 Nov 2015 15:30:37 +0000 (17:30 +0200)] 
TLS client: Add signature_algorithms extension into ClientHello

Since we support only SHA256 (and not the default SHA1) with TLS v1.2,
the signature_algorithms extensions needs to be added into ClientHello.
This fixes interop issues with the current version of OpenSSL that uses
the default SHA1 hash if ClientHello does not specify allowed signature
algorithms.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoTLS client: Validate certificates with SHA384 and SHA512 hashes
Pali Rohár [Sun, 22 Nov 2015 01:02:58 +0000 (02:02 +0100)] 
TLS client: Validate certificates with SHA384 and SHA512 hashes

This commit adds support for validating certificates with SHA384 and
SHA512 hashes. Those certificates are now very common so wpa_supplicant
needs support for them.

SHA384 and SHA512 hash functions are included in the previous commit.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
8 years agoAdd SHA384 and SHA512 implementations from LibTomCrypt library
Pali Rohár [Sun, 22 Nov 2015 01:02:57 +0000 (02:02 +0100)] 
Add SHA384 and SHA512 implementations from LibTomCrypt library

These will be used with the internal TLS implementation to extend hash
algorithm support for new certificates and TLS v1.2.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
8 years agoTLS client: Add support for validating server certificate hash
Pali Rohár [Sun, 22 Nov 2015 01:02:56 +0000 (02:02 +0100)] 
TLS client: Add support for validating server certificate hash

This commit adds support for "hash://server/sha256/cert_hash_in_hex"
scheme in ca_cert property for the internal TLS implementation.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
8 years agoTLS client: Do not verify CA certificates when ca_cert is not specified
Pali Rohár [Sun, 22 Nov 2015 01:02:55 +0000 (02:02 +0100)] 
TLS client: Do not verify CA certificates when ca_cert is not specified

In documentation is written: "If ca_cert and ca_path are not included,
server certificate will not be verified". This is the case when
wpa_supplicant is compiled with OpenSSL library, but when using the
internal TLS implementation and some certificates in CA chain are in
unsupported format (e.g., use SHA384 or SHA512 hash functions) then
verification fails even if ca_cert property is not specified.

This commit changes behavior so that certificate verification in
internal TLS implementation is really skipped when ca_cert is not
specified.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
8 years agotests: Fix OOM eloop_register_sock() test cases with new gcc
Jouni Malinen [Sat, 28 Nov 2015 17:07:35 +0000 (19:07 +0200)] 
tests: Fix OOM eloop_register_sock() test cases with new gcc

gcc 4.8 vs 5.2 seem to compile eloop_register_sock() differently. With
5.2, that function name does not show up in the backtrace since
eloop_sock_table_add_sock() is used without a separate function call.
This broke the memory allocation failure checking in this test case. Fix
this by matching against the eloop_sock_table_add_sock() function which
shows up in the backtrace for both gcc versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: EAP-SIM/AKA/AKA' error cases
Jouni Malinen [Sat, 28 Nov 2015 17:20:18 +0000 (19:20 +0200)] 
tests: EAP-SIM/AKA/AKA' error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoAdd TEST_FAIL() condition to aes_128_cbc_encrypt/decrypt()
Jouni Malinen [Sat, 28 Nov 2015 17:00:32 +0000 (19:00 +0200)] 
Add TEST_FAIL() condition to aes_128_cbc_encrypt/decrypt()

This enables more error path testing.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-SIM peer: Fix memory leak on reauth error path
Jouni Malinen [Sat, 28 Nov 2015 17:43:55 +0000 (19:43 +0200)] 
EAP-SIM peer: Fix memory leak on reauth error path

If init_for_reauth fails, the EAP-SIM peer state was not freed properly.
Use eap_sim_deinit() to make sure all allocations get freed. This could
be hit only if no random data could be derived for NONCE_MT.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agoEAP-SAKE: Fix a typo in attribute parser debug print
Jouni Malinen [Sat, 28 Nov 2015 10:25:42 +0000 (12:25 +0200)] 
EAP-SAKE: Fix a typo in attribute parser debug print

Parsing AT_MSK_LIFE ended up writing a debug log entry with incorrect
attribute name (AT_IV).

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Extended coverage for the EAP-SAKE attribute parser
Jouni Malinen [Sat, 28 Nov 2015 10:25:22 +0000 (12:25 +0200)] 
tests: Extended coverage for the EAP-SAKE attribute parser

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: EAP-SAKE local error cases
Jouni Malinen [Sat, 28 Nov 2015 09:53:31 +0000 (11:53 +0200)] 
tests: EAP-SAKE local error cases

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Convert eap_proto_sake to use newer design
Jouni Malinen [Sat, 28 Nov 2015 09:22:21 +0000 (11:22 +0200)] 
tests: Convert eap_proto_sake to use newer design

This makes it more convenient to extend the test case with new
message exchanges.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Fix error message for ap_open_out_of_memory
Jouni Malinen [Fri, 27 Nov 2015 22:23:35 +0000 (00:23 +0200)] 
tests: Fix error message for ap_open_out_of_memory

If hostapd AP started unexpectedly, this test case would fail with
NameError due to incorrect variable name being used to construct the
exception text.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: run-tests: Print more details about NameError
Johannes Berg [Fri, 27 Nov 2015 18:54:58 +0000 (19:54 +0100)] 
tests: run-tests: Print more details about NameError

If encountering a NameError, print the entire traceback so that
it's actually debuggable.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agotests: ERP protocol tests
Jouni Malinen [Fri, 27 Nov 2015 22:18:49 +0000 (00:18 +0200)] 
tests: ERP protocol tests

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Enable 802.11ac support in example wpa_supplicant config
Jouni Malinen [Fri, 27 Nov 2015 18:59:38 +0000 (20:59 +0200)] 
tests: Enable 802.11ac support in example wpa_supplicant config

This is needed for proper test execution. The recently added VHT 80+80
test cases started verifying channel bandwidth on the station side and
those checks fail if wpa_supplicant is built without
CONFIG_IEEE80211AC=y.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Honor HWSIM_TEST_LOG_DIR variable in VM runs
Johannes Berg [Tue, 24 Nov 2015 16:39:58 +0000 (17:39 +0100)] 
tests: Honor HWSIM_TEST_LOG_DIR variable in VM runs

If /tmp has a relatively small size limit, or multiple people run the
tests on the same machine, using the same output directory can easily
cause problems.

Make the test framework honor the new HWSIM_TEST_LOG_DIR environment
variable to make it easier to avoid those problems.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agotests: Add a simple wmediumd test
Johannes Berg [Fri, 27 Nov 2015 14:41:37 +0000 (15:41 +0100)] 
tests: Add a simple wmediumd test

If wmediumd is available on the path, test that it can forward
packets between two virtual nodes and that stopping it makes
the regular in-kernel datapath do the needed work again.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
8 years agotests: Remove HwsimSkip from p2p_channel
Jouni Malinen [Fri, 27 Nov 2015 17:38:17 +0000 (19:38 +0200)] 
tests: Remove HwsimSkip from p2p_channel

With the optimizations from the previous commits, none of the test cases
here need to be skipped.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Optimize p2p_go_move_active initial wait
Jouni Malinen [Fri, 27 Nov 2015 17:37:35 +0000 (19:37 +0200)] 
tests: Optimize p2p_go_move_active initial wait

There is no need to wait for the initial client timeout in this type of
test sequence since that wait can be cleared by connecting and
disconnecting a client to the group. This allows the test case to be
executed much more quickly and the dependency on --long can be removed.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Optimize p2p_go_move_reg_change initial wait
Jouni Malinen [Fri, 27 Nov 2015 17:34:18 +0000 (19:34 +0200)] 
tests: Optimize p2p_go_move_reg_change initial wait

There is no need to wait for the initial client timeout in this type of
test sequence since that wait can be cleared by connecting and
disconnecting a client to the group. This allows the test case to be
executed much more quickly and the dependency on --long can be removed.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Optimize p2p_go_move_scm_multi initial wait
Jouni Malinen [Fri, 27 Nov 2015 17:31:44 +0000 (19:31 +0200)] 
tests: Optimize p2p_go_move_scm_multi initial wait

There is no need to wait for the initial client timeout in this type of
test sequence since that wait can be cleared by connecting and
disconnecting a client to the group. This allows the test case to be
executed much more quickly and the dependency on --long can be removed.

Signed-off-by: Jouni Malinen <j@w1.fi>
8 years agotests: Convert p2p_go_move_scm_multi to use dynamic hwsim
Jouni Malinen [Fri, 27 Nov 2015 17:30:02 +0000 (19:30 +0200)] 
tests: Convert p2p_go_move_scm_multi to use dynamic hwsim

Use a dynamically added HWSimRadio to allow the MCC case to be covered
with a single test run with the mac80211_hwsim default radios disabling
MCC.

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