mech_eap.git
9 years agomesh: Use a separate variable to track whether HT is enabled
Jouni Malinen [Sat, 10 Jan 2015 10:52:50 +0000 (12:52 +0200)]
mesh: Use a separate variable to track whether HT is enabled

A network profile parameter should not be used to check whether the
currently operating mesh has HT enabled.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Move debug prints into nl80211_put_freq_params()
Jouni Malinen [Sat, 10 Jan 2015 10:50:46 +0000 (12:50 +0200)]
nl80211: Move debug prints into nl80211_put_freq_params()

This way all callers can get the benefit of the same debug prints.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Add a helper function for putting basic rates
Jouni Malinen [Sat, 10 Jan 2015 10:49:41 +0000 (12:49 +0200)]
nl80211: Add a helper function for putting basic rates

There is no need for maintaining two more or less identical copies of
this functionality.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Drop mesh_ht_mode parameter from mesh test cases
Jouni Malinen [Sat, 10 Jan 2015 10:39:42 +0000 (12:39 +0200)]
tests: Drop mesh_ht_mode parameter from mesh test cases

This network profile parameter will be removed with the cleanup that
makes mesh use shared functions for setting channel parameters. That
will allow HT to be enabled automatically based on driver capabilities.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Mesh in 5 GHz band
Jouni Malinen [Sat, 10 Jan 2015 10:04:25 +0000 (12:04 +0200)]
tests: Mesh in 5 GHz band

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoibss/mesh: Enable HT40 if supported
Janusz Dziedzic [Thu, 8 Jan 2015 11:48:36 +0000 (12:48 +0100)]
ibss/mesh: Enable HT40 if supported

Setup HT40+/HT40- if supported by driver.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoMake check_40mhz_2g4 common
Janusz Dziedzic [Thu, 8 Jan 2015 11:48:35 +0000 (12:48 +0100)]
Make check_40mhz_2g4 common

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoMake check_20mhz_bss common
Janusz Dziedzic [Thu, 8 Jan 2015 11:48:34 +0000 (12:48 +0100)]
Make check_20mhz_bss common

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoMake check_40mhz_5g common
Janusz Dziedzic [Thu, 8 Jan 2015 11:48:33 +0000 (12:48 +0100)]
Make check_40mhz_5g common

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoMake get_pri_sec_chan() common
Janusz Dziedzic [Thu, 8 Jan 2015 11:48:32 +0000 (12:48 +0100)]
Make get_pri_sec_chan() common

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoIntroduce common allowed_ht40_channel_pair()
Janusz Dziedzic [Thu, 8 Jan 2015 11:48:31 +0000 (12:48 +0100)]
Introduce common allowed_ht40_channel_pair()

This can be used from hostapd/wpa_supplicant.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoUse common hw_get_freq/hw_get_chan helpers in hostapd
Janusz Dziedzic [Thu, 8 Jan 2015 11:48:30 +0000 (12:48 +0100)]
Use common hw_get_freq/hw_get_chan helpers in hostapd

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoIntroduce common hw features
Janusz Dziedzic [Thu, 8 Jan 2015 11:48:29 +0000 (12:48 +0100)]
Introduce common hw features

Introduce wpa_supplicant/hostapd hw features.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoIBSS: Add WPA_DRIVER_FLAGS_HT_IBSS
Janusz Dziedzic [Wed, 7 Jan 2015 08:29:43 +0000 (09:29 +0100)]
IBSS: Add WPA_DRIVER_FLAGS_HT_IBSS

Add WPA_DRIVER_FLAGS_HT_IBSS driver feature flag. Some drivers could not
set this feature and next could fail when we will enable HT support for
IBSS with error message: nl80211: Join IBSS failed: ret=-22 (Invalid
argument).

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agoSAE: Implement retransmission timer
Bob Copeland [Wed, 7 Jan 2015 06:10:57 +0000 (01:10 -0500)]
SAE: Implement retransmission timer

Add the t0 retransmission timer as specified by IEEE Std 802.11-2012,
11.3.8.4. This makes SAE much more likely to succeed in the case of lost
frames.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
9 years agoSAE: Centralize function for sending initial COMMIT
Bob Copeland [Wed, 7 Jan 2015 06:10:56 +0000 (01:10 -0500)]
SAE: Centralize function for sending initial COMMIT

When performing SAE authentication in mesh, one station may
initiate authentication by sending a COMMIT as soon as a peer
candidate is discovered. Previously we did this in mesh_rsn.c,
but this left some of the state initialization in a different
part of the code from the rest of the state machine, and we may
need to add other initializations here in the future, so move
that to a more central function.

Signed-off-by: Bob Copeland <me@bobcopeland.com>
9 years agobsd: Fix parsing of ieee80211req_scan_result on FreeBSD and DragonFly
Imre Vadasz [Tue, 6 Jan 2015 14:08:37 +0000 (15:08 +0100)]
bsd: Fix parsing of ieee80211req_scan_result on FreeBSD and DragonFly

On FreeBSD and DragonFly BSD, we additionally need to skip the
isr_meshid_len bytes of the MESH ID, to get the correct address for
copying the IE data.

The isr_meshid_len field was added in the FreeBSD svn revision r195618
in 2009, so I don't think we need to check the FreeBSD version here.

Signed-off-by: Imre Vadász <imre@vdsz.com>
9 years agoAndroid: Remove hardcoded ICU include paths from hs20-osu-client
Narayan Kamath [Mon, 5 Jan 2015 11:39:15 +0000 (11:39 +0000)]
Android: Remove hardcoded ICU include paths from hs20-osu-client

ICU exports them using LOCAL_EXPORT_C_INCLUDE_DIRS.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agotests: Refactor tshark running
Johannes Berg [Fri, 9 Jan 2015 18:55:44 +0000 (19:55 +0100)]
tests: Refactor tshark running

Refactor the code to run tshark into its own submodule. This allows
even remembering whether -Y or -R needs to be used for filtering.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agotests: Out-of-memory cases for D-Bus operations
Jouni Malinen [Tue, 6 Jan 2015 11:33:32 +0000 (13:33 +0200)]
tests: Out-of-memory cases for D-Bus operations

This increases testing coverage on various error paths.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Additional D-Bus error path coverage
Jouni Malinen [Thu, 8 Jan 2015 23:41:57 +0000 (01:41 +0200)]
tests: Additional D-Bus error path coverage

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoD-Bus: Use NoMemory error message from CreateInterface
Jouni Malinen [Fri, 9 Jan 2015 00:31:23 +0000 (02:31 +0200)]
D-Bus: Use NoMemory error message from CreateInterface

Try to be a bit more consistent by using NoMemory instead of InvalidArgs
if os_strdup() fails in the CreateInterface handler.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoHandle interface disabled/enabled more consistently
Jouni Malinen [Thu, 8 Jan 2015 20:39:18 +0000 (22:39 +0200)]
Handle interface disabled/enabled more consistently

It was possible for the interface not to be marked in INTERFACE_DISABLED
state in case the event was processed for P2P GO because the wpa_s
instance could have been removed in case of a separate group interface.
Change the state first to avoid leaving different state for the case
where separate group interface is not used.

Mark scan to be a normal scan on INTERFACE_ENABLED so that scanning
rules (e.g., skip scan if no networks enabled) get used consistently.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Indicate reason=UNAVAILABLE for group netdev going down
Jouni Malinen [Thu, 8 Jan 2015 20:13:17 +0000 (22:13 +0200)]
P2P: Indicate reason=UNAVAILABLE for group netdev going down

There is a race condition between receiving an AP stopped event and
netdev down event. These resulted in different group removal reasons on
a GO device (UNAVAILABLE for stop AP event coming first and REQUESTED
for netdev event first). Make this more consistent by reporting
UNAVAILABLE for both possible cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Add out-of-memory loop tests for hostapd startup
Jouni Malinen [Thu, 8 Jan 2015 00:31:11 +0000 (02:31 +0200)]
tests: Add out-of-memory loop tests for hostapd startup

These test cases run hostapd interface setup multiple times with
TEST_ALLOC_FAIL commands triggering memory allocation failures one by
one at each possible location in the setup sequence. Effectively, these
test cases will hit most error paths for memory allocation issue cases
(i.e., only the cases requiring more than one allocation failure in a
sequence are not covered).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: hostapd BSS addition failures
Jouni Malinen [Tue, 6 Jan 2015 00:38:26 +0000 (02:38 +0200)]
tests: hostapd BSS addition failures

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: hostapd interface setup and memory allocation failures
Jouni Malinen [Mon, 5 Jan 2015 20:00:55 +0000 (22:00 +0200)]
tests: hostapd interface setup and memory allocation failures

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Memory allocation failure in wpa_supplicant blacklist
Jouni Malinen [Mon, 5 Jan 2015 20:00:22 +0000 (22:00 +0200)]
tests: Memory allocation failure in wpa_supplicant blacklist

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Convert test skipping to use exception
Jouni Malinen [Wed, 7 Jan 2015 12:19:30 +0000 (14:19 +0200)]
tests: Convert test skipping to use exception

Instead of returning "skip" from the test function, raise the new
HwsimSkip exception to indicate a test case was skipped.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Use rfkill python module
Johannes Berg [Thu, 8 Jan 2015 13:59:16 +0000 (14:59 +0100)]
tests: Use rfkill python module

Instead of calling the rfkill binary, use the built-in module.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agotests: Add rfkill module
Johannes Berg [Thu, 8 Jan 2015 10:16:33 +0000 (11:16 +0100)]
tests: Add rfkill module

This can be used instead of invoking the rfkill binary.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
9 years agoVerify that eloop_register_read_sock() succeeds for ctrl_iface setup
Jouni Malinen [Thu, 8 Jan 2015 00:29:59 +0000 (02:29 +0200)]
Verify that eloop_register_read_sock() succeeds for ctrl_iface setup

This allows faster detection of a case where a memory allocation fails
within eloop.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix a memory leak on WPA authenticator error path
Jouni Malinen [Thu, 8 Jan 2015 00:22:03 +0000 (02:22 +0200)]
Fix a memory leak on WPA authenticator error path

wpa_auth->group needs to be freed if PMK cache setup fails.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix hostapd interface addition error path
Jouni Malinen [Thu, 8 Jan 2015 00:13:46 +0000 (02:13 +0200)]
Fix hostapd interface addition error path

The local conf pointer needs to be cleared once it gets assigned to
hapd_iface to avoid double-free of the configuration data on error path.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Make scan_random_mac more robust
Jouni Malinen [Wed, 7 Jan 2015 14:29:19 +0000 (16:29 +0200)]
tests: Make scan_random_mac more robust

There is a race condition between wlantest having received and written
the sniffer log and this test case using tshark to process it. Wait one
second before running tshark to make it less likely to get truncated
results that can result in the test case failing.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Convert "hwsim-SKIP" exception to use a custom class
Jouni Malinen [Wed, 7 Jan 2015 11:41:31 +0000 (13:41 +0200)]
tests: Convert "hwsim-SKIP" exception to use a custom class

This makes the design a bit cleaner for catching the exceptions.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Import dbus module in a cleaner way
Jouni Malinen [Wed, 7 Jan 2015 11:29:25 +0000 (13:29 +0200)]
tests: Import dbus module in a cleaner way

There is no need to use prepare_dbus() function to check whether the
dbus module can be imported.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd support for testing memory allocation failures
Jouni Malinen [Mon, 5 Jan 2015 18:30:28 +0000 (20:30 +0200)]
Add support for testing memory allocation failures

The new control interface command TEST_ALLOC_FAIL and GET_ALLOC_FAIL can
now be used to trigger memory allocation failures for testing purposes.
TEST_ALLOC_FAIL sets a failure conditions with
<count>:func[;func][;func]... string and GET_ALLOC_FAIL returns the
current state using the same format. Whenever an allocation is made with
a matching backtrace of calling functions, the count is decremented by
one and once zero is reached, the allocation is forced to fail.

Function names can be prefixed with either '=' or '?' to get different
matching behavior. '=' requires this specific function to be the next
one in the backtrace (i.e., do not skip any other functions in the list
which is the default behavior). '?' allows the function to be optionally
present in the backtrace.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoD-Bus: Fix interface unregistration on error path
Jouni Malinen [Tue, 6 Jan 2015 21:13:28 +0000 (23:13 +0200)]
D-Bus: Fix interface unregistration on error path

It is possible for this function to get called even if D-Bus
registration had failed, so the path can be NULL here.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoD-Bus (old): Fix interface unregistration on error path
Jouni Malinen [Tue, 6 Jan 2015 21:07:12 +0000 (23:07 +0200)]
D-Bus (old): Fix interface unregistration on error path

It is possible for this function to be called even if D-Bus interface
registration has failed. Avoid a D-Bus assert in such a case.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix memory leak on wpa_supplicant_init_wpa() error path
Jouni Malinen [Tue, 6 Jan 2015 21:01:00 +0000 (23:01 +0200)]
Fix memory leak on wpa_supplicant_init_wpa() error path

If wpa_sm_init() fails, the context data needs to be freed in the
caller.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoTDLS: Fix an interface addition error path
Jouni Malinen [Tue, 6 Jan 2015 20:54:52 +0000 (22:54 +0200)]
TDLS: Fix an interface addition error path

It is possible for wpa_tdls_teardown_peers() to be called with sm ==
NULL in case interface addition fails before the WPA state machine is
initialized.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoD-Bus: Fix string array dict entry parser in out-of-memory case
Jouni Malinen [Tue, 6 Jan 2015 15:04:24 +0000 (17:04 +0200)]
D-Bus: Fix string array dict entry parser in out-of-memory case

entry->strarray_value was left to point to freed memory in case
os_realloc_array() failed. This resulted in the following
wpa_dbus_dict_entry_clear() trying to free an already freed memory area.
In addition, the separately allocated strings in the array would have
been leaked in such a case. Furthermore, wpa_dbus_dict_entry_clear() was
not prepared for the possibility of the initial os_calloc() call failing
and entry->strarray_value being NULL without array_len being cleared to
zero. That would have resulted in reading uninitialized memory and NULL
pointer dereference.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoD-Bus: Fix byte array dict entry parser in out-of-memory case
Jouni Malinen [Tue, 6 Jan 2015 14:45:16 +0000 (16:45 +0200)]
D-Bus: Fix byte array dict entry parser in out-of-memory case

entry->bytearray_value was left to point to freed memory in case
os_realloc_array() failed. This resulted in the following
wpa_dbus_dict_entry_clear() trying to free an already freed memory area.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoD-Bus: Fix Introspect() in case of os_strdup() failure
Jouni Malinen [Tue, 6 Jan 2015 13:55:51 +0000 (15:55 +0200)]
D-Bus: Fix Introspect() in case of os_strdup() failure

add_interface() did not check for os_strdup() return value and could end
up dereferencing a NULL pointer if memory allocation failed.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoD-Bus (old): Fix wpsReg error message
Jouni Malinen [Tue, 6 Jan 2015 11:33:02 +0000 (13:33 +0200)]
D-Bus (old): Fix wpsReg error message

This was supposed to return WpsRegError, not WpsPbcError.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoD-Bus (old): Fix message handler error paths
Jouni Malinen [Tue, 6 Jan 2015 11:22:06 +0000 (13:22 +0200)]
D-Bus (old): Fix message handler error paths

The error reply needs to be sent out as a response. The "out" label was
in incorrect place to allow that to happen; instead, it ended up leaking
memory for the generated reply message.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoD-Bus (old): Fix memory leak on error path
Jouni Malinen [Tue, 6 Jan 2015 10:06:39 +0000 (12:06 +0200)]
D-Bus (old): Fix memory leak on error path

If setSmartcardModules() fails to allocate memory with os_strdup(), the
allocated items in the dict entry were not freed.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotrace: Fix compiler warning on 32-bit builds with bfd support
Jouni Malinen [Tue, 6 Jan 2015 09:46:46 +0000 (11:46 +0200)]
trace: Fix compiler warning on 32-bit builds with bfd support

With CONFIG_WPA_TRACE_BFD, the type cast from void* to integer was
generating a compiler warning due to the target integer being larger in
size in case of 32-bit builds. Type case to bfd_hostptr_t instead of
directly to bfd_vma to avoid this.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoeloop: Fix WPA_TRACE tracking in case of realloc failure
Jouni Malinen [Mon, 5 Jan 2015 21:46:24 +0000 (23:46 +0200)]
eloop: Fix WPA_TRACE tracking in case of realloc failure

The socket reference tracking entries need to be restored in case
os_realloc_array() fails when adding a new eloop socket.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix memory leak on hostapd BSS addition error path
Jouni Malinen [Mon, 5 Jan 2015 23:39:27 +0000 (01:39 +0200)]
Fix memory leak on hostapd BSS addition error path

The per-BSS configuration information needs to be freed if hostapd fails
to add a new interface for a BSS added with "ADD bss_config=..."
command.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix hostapd initialization error path on allocation failure
Jouni Malinen [Mon, 5 Jan 2015 19:57:15 +0000 (21:57 +0200)]
Fix hostapd initialization error path on allocation failure

If hostapd_alloc_bss_data() failed to allocate the struct hostapd_data
instance, dynamic interface addition path ended up trying to dereference
freed memory due to incorrect cleanup steps. Fix this by decrementing
the interface count when the newly added interface is removed. In
addition, make the setup more robust by clearing all changes within
hostapd_data_alloc() if any of the allocations fails.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Fix compilation with libnl 1.1 and 2.0
Jouni Malinen [Tue, 6 Jan 2015 16:27:06 +0000 (18:27 +0200)]
nl80211: Fix compilation with libnl 1.1 and 2.0

Unfortunately, libnl 3.0 has changed the API in a way that is not
backwards compatible by renaming nlmsg_len() to nlmsg_datalen() without
leaving the older nlmsg_len() defined. As such, there does not seem to
be any clean way of using this function without breaking the build with
some libnl versions. For now, replace this call with direct calculation
of the data length since it can be done with a simple one-liner that
compiles with all libnl versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Additional bgscan coverage
Jouni Malinen [Mon, 5 Jan 2015 16:35:14 +0000 (18:35 +0200)]
tests: Additional bgscan coverage

Verify error cases in bgscan module parameters. Increase learn bgscan
module coverage with parsing of the saved data and probe frequency
selection.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agocrypto: Clear temporary stack buffers after use
Jouni Malinen [Mon, 5 Jan 2015 16:05:58 +0000 (18:05 +0200)]
crypto: Clear temporary stack buffers after use

This reduces possibility of exposure of private keys should something
get access to stack memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agocrypto: Clear temporary heap allocations before freeing
Jouni Malinen [Mon, 5 Jan 2015 16:05:09 +0000 (18:05 +0200)]
crypto: Clear temporary heap allocations before freeing

This reduces the time private keys may remain in heap memory after use.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoDH: Clear memory explicitly on private key deinit
Jouni Malinen [Mon, 5 Jan 2015 16:03:40 +0000 (18:03 +0200)]
DH: Clear memory explicitly on private key deinit

Remove any DH private key from heap memory after use.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd wpabuf_clear_free() to allow clearing of freed memory
Jouni Malinen [Mon, 5 Jan 2015 16:02:04 +0000 (18:02 +0200)]
Add wpabuf_clear_free() to allow clearing of freed memory

This can be useful when a wpabuf is used to store private data that
should not be left in heap after use.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Move SHA256 test cases into hwsim framework
Jouni Malinen [Mon, 5 Jan 2015 15:34:20 +0000 (17:34 +0200)]
tests: Move SHA256 test cases into hwsim framework

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Move SHA1 test cases into hwsim framework
Jouni Malinen [Mon, 5 Jan 2015 15:28:10 +0000 (17:28 +0200)]
tests: Move SHA1 test cases into hwsim framework

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoOpenSSL: Fix pbkdf2_sha1() wrapper
Jouni Malinen [Mon, 5 Jan 2015 15:27:08 +0000 (17:27 +0200)]
OpenSSL: Fix pbkdf2_sha1() wrapper

This was supposed to use the iterations parameter from the caller
instead of the hardcoded 4096. In practice, this did not have problems
for normal uses since that 4096 value was used in all cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Move MD5 test cases into hwsim framework
Jouni Malinen [Mon, 5 Jan 2015 15:12:27 +0000 (17:12 +0200)]
tests: Move MD5 test cases into hwsim framework

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Move ms_funcs test cases into hwsim framework
Jouni Malinen [Mon, 5 Jan 2015 15:05:42 +0000 (17:05 +0200)]
tests: Move ms_funcs test cases into hwsim framework

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Add some of the AES ECB mode test cases from CAVS 11.1
Jouni Malinen [Mon, 5 Jan 2015 14:57:57 +0000 (16:57 +0200)]
tests: Add some of the AES ECB mode test cases from CAVS 11.1

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Move AES key wrap/unwrap test cases into hwsim framework
Jouni Malinen [Mon, 5 Jan 2015 14:35:59 +0000 (16:35 +0200)]
tests: Move AES key wrap/unwrap test cases into hwsim framework

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Move AES-CBC test cases into hwsim framework
Jouni Malinen [Mon, 5 Jan 2015 14:28:46 +0000 (16:28 +0200)]
tests: Move AES-CBC test cases into hwsim framework

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Move AES-128 EAX mode test cases into hwsim framework
Jouni Malinen [Mon, 5 Jan 2015 14:24:22 +0000 (16:24 +0200)]
tests: Move AES-128 EAX mode test cases into hwsim framework

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Additional OMAC1-AES module test coverage
Jouni Malinen [Mon, 5 Jan 2015 14:15:23 +0000 (16:15 +0200)]
tests: Additional OMAC1-AES module test coverage

This verifies couple of corner cases with short vector entries in the
OMAC1-AES implementation.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Move OMAC1-AES test cases into hwsim module tests
Jouni Malinen [Mon, 5 Jan 2015 14:02:08 +0000 (16:02 +0200)]
tests: Move OMAC1-AES test cases into hwsim module tests

This makes sure the test cases are executed automatically with rest of
the hwsim tests.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Add module tests for AES-SIV
Jouni Malinen [Mon, 5 Jan 2015 13:48:17 +0000 (15:48 +0200)]
tests: Add module tests for AES-SIV

This moves the AES-SIV test case from tests/test-aes.c to be part of
wpa_supplicant module testing framework with a new
src/crypto/crypto_module_tests.c component. In addition, the second test
vector from RFC 5297 is also included for additional coverage.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAES-SIV: Make aes_s2v() static
Jouni Malinen [Mon, 5 Jan 2015 13:22:36 +0000 (15:22 +0200)]
AES-SIV: Make aes_s2v() static

This function is not used outside aes-siv.c. In addition, include the
aes_siv.h header to make sure that functions get declared consistently.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Simplify event processing error paths
Jouni Malinen [Mon, 5 Jan 2015 11:40:07 +0000 (13:40 +0200)]
nl80211: Simplify event processing error paths

These are practically unreachable code since cfg80211 fills in the
required attributes or does not send the event. Keep the checks in
place, but minimize the extra code in wpa_supplicant/hostapd.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Remove cfg80211 state mismatch workaround for authentication
Jouni Malinen [Mon, 5 Jan 2015 10:21:12 +0000 (12:21 +0200)]
nl80211: Remove cfg80211 state mismatch workaround for authentication

cfg80211 dropped support for tracking BSS authentication state and
setting NL80211_BSS_STATUS_AUTHENTICATED in 'cfg80211: stop tracking
authenticated state' three years ago (starting in Linux 3.4). As such,
this workaround code in wpa_supplicant cannot be reached anymore. There
is no real need for maintaining it for older kernels either, since there
are other ways of detecting and working around state mismatches with the
actual authentication operations failing.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Check support for rekey offload on first use
Jouni Malinen [Mon, 5 Jan 2015 10:00:09 +0000 (12:00 +0200)]
nl80211: Check support for rekey offload on first use

While there is no explicit driver capability advertisement for this in
nl80211, the EOPNOTSUPP response can be interpreted as a clear
indication of NL80211_CMD_SET_REKEY_OFFLOAD not being supported. Check
for that and don't try to offload keys again if the driver has not use
for them.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: MAC_RAND_SCAN with valid and invalid arguments
Jouni Malinen [Sun, 4 Jan 2015 21:05:47 +0000 (23:05 +0200)]
tests: MAC_RAND_SCAN with valid and invalid arguments

This verifies that random MAC address is used as requested in Probe
Request frames.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agowpa_cli: Add MAC address randomization in scan
Ilan Peer [Mon, 29 Dec 2014 06:41:08 +0000 (01:41 -0500)]
wpa_cli: Add MAC address randomization in scan

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agoctrl_iface: Add MAC address randomization in scan processing
Ilan Peer [Mon, 29 Dec 2014 06:41:07 +0000 (01:41 -0500)]
ctrl_iface: Add MAC address randomization in scan processing

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agoscan: Add MAC address randomization in scan handling
Ilan Peer [Mon, 29 Dec 2014 06:41:06 +0000 (01:41 -0500)]
scan: Add MAC address randomization in scan handling

1. Supported MAC address randomization for scan.
2. Supported MAC address randomization for scheduled scan.
2. Supported MAC address randomization for pno.
4. Add functions to set and clear the MAC address randomization
   state variables.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agonl80211: Handle MAC address randomization in scan/sched_scan
Ilan Peer [Mon, 29 Dec 2014 06:41:05 +0000 (01:41 -0500)]
nl80211: Handle MAC address randomization in scan/sched_scan

1. Process supported driver capabilities.
2. Populate scan request with MAC address randomization data

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agodriver: Add definitions for MAC address randomization in scan
Ilan Peer [Mon, 29 Dec 2014 06:41:04 +0000 (01:41 -0500)]
driver: Add definitions for MAC address randomization in scan

1. Add parameters to the scan command to allow MAC address
   randomization during scan and scheduled scan.
2. Add capability bits to publish MAC address randomization support
   in scan and scheduled scan.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agotests: TDLS channel switching
Jouni Malinen [Sun, 4 Jan 2015 19:45:18 +0000 (21:45 +0200)]
tests: TDLS channel switching

Verify correct behavior with invalid commands. In addition, allow minor
mac80211_hwsim modifications to be used to enable testing of the driver
interface to enable and disable channel switching.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agowpa_cli: Implement TDLS start/cancel channel switching commands
Arik Nemtsov [Mon, 29 Dec 2014 03:35:21 +0000 (22:35 -0500)]
wpa_cli: Implement TDLS start/cancel channel switching commands

For the start operation, this includes appropriate parameters for
specifying channel and peer information. The cancel operation includes
peer information.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agonl80211: Pass TDLS channel-switch start/stop params to kernel
Arik Nemtsov [Mon, 29 Dec 2014 03:35:20 +0000 (22:35 -0500)]
nl80211: Pass TDLS channel-switch start/stop params to kernel

The kernel-driver/firmware are responsible for performing periodic
switches to the target channel with the given peer. Propagate all TDLS
channel switching related information to kernel.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Propagate enable/disable channel-switch commands to driver
Arik Nemtsov [Mon, 29 Dec 2014 05:20:51 +0000 (00:20 -0500)]
TDLS: Propagate enable/disable channel-switch commands to driver

The supplicant code does not try to control the actual channel of the
radio at any point. It simply passes the target peer and channel
parameters to the driver. It's the driver's responsibility to
periodically initiate TDLS channel-switch operations when TDLS
channel-switching is enabled.

Allow enable/disable operations to be invoked via the control interface.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Track TDLS channel switch prohibition in BSS
Arik Nemtsov [Mon, 29 Dec 2014 03:35:18 +0000 (22:35 -0500)]
TDLS: Track TDLS channel switch prohibition in BSS

Mark an appropriate sm flag when TDLS switch is prohibited by the AP.
Populate the flag upon association with the AP.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Add channel-switch capability flag
Arik Nemtsov [Mon, 29 Dec 2014 03:44:37 +0000 (22:44 -0500)]
TDLS: Add channel-switch capability flag

Propagate a driver TDLS channel-switch support bit from nl80211 to
TDLS code.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoSync with wireless-testing.git include/uapi/linux/nl80211.h
Jouni Malinen [Sun, 4 Jan 2015 13:35:34 +0000 (15:35 +0200)]
Sync with wireless-testing.git include/uapi/linux/nl80211.h

This brings in nl80211 definitions as of 2014-11-26.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: WMM-AC reassociation-to-same-BSS test
Eliad Peller [Mon, 29 Dec 2014 02:15:03 +0000 (21:15 -0500)]
tests: WMM-AC reassociation-to-same-BSS test

Make sure the tspecs are kept on reassociation to the same BSS.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
9 years agotests: wmm_ac_status and roaming case with WMM-AC
Eliad Peller [Mon, 29 Dec 2014 02:15:02 +0000 (21:15 -0500)]
tests: wmm_ac_status and roaming case with WMM-AC

Make sure the wmm_ac_status command reflects correctly the existing
tspecs after add_ts/del_ts commands. Add a new test to verify all tspecs
are removed on roaming (while FT is not used).

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
9 years agoWMM AC: Reconfigure tspecs on reassociation to the same BSS
Eliad Peller [Mon, 29 Dec 2014 02:15:01 +0000 (21:15 -0500)]
WMM AC: Reconfigure tspecs on reassociation to the same BSS

The specification requires the tspecs to be kept upon reassociation to
the same BSS. Save the last tspecs before such reassociation, and
reconfigure on the association notification.

Note that the current flow is not transparent to the user
(it is notified about deauth/reassoc and tspec removal/addition).

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
9 years agoWMM AC: Do not fail on unknown IEs in Association Response
Eliad Peller [Mon, 29 Dec 2014 02:15:00 +0000 (21:15 -0500)]
WMM AC: Do not fail on unknown IEs in Association Response

Some APs add their custom (vendor-specific) IEs to the Association
Response frame. Fail WMM AC initialization only if Association Response
frame IE parsing actually failed, i.e., ignore all unknown IEs.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
9 years agoWMM AC: Delete tspecs on roaming
Eliad Peller [Mon, 29 Dec 2014 02:14:59 +0000 (21:14 -0500)]
WMM AC: Delete tspecs on roaming

In case of roaming, we don't get disassoc notification, but
still want to remove the existing tspecs.

Move the wmm_ac_notify_disassoc() call to the state change
function, which get called also on roaming.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
9 years agoWMM AC: Print user-priority in wmm_ac_status
Eliad Peller [Mon, 29 Dec 2014 02:14:58 +0000 (21:14 -0500)]
WMM AC: Print user-priority in wmm_ac_status

The UP is important property of the tspec, so print it as well.

Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
9 years agonl80211: Always register management frames handler
Avraham Stern [Mon, 29 Dec 2014 02:14:57 +0000 (21:14 -0500)]
nl80211: Always register management frames handler

If registering WMM-AC ADDTS response action frame or WMM-AC DELTS
action frame fails, the management frame handler is not being
registered. This results with a segmentation fault when trying to
unsubscribe the handler when the interface is removed.
Fix it by always registering the handler and just returning a negative
value to note that the action frame could not be registered.

This fixes an issue introduced in the commit
dfa8787833f0b237f954b01233cad3527f3d4805 ('nl80211: Implement
add_ts/del_ts ops').

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
9 years agodoc: Extend driver.h documentation
Jouni Malinen [Sat, 3 Jan 2015 14:59:14 +0000 (16:59 +0200)]
doc: Extend driver.h documentation

This documents some more parts of the driver wrapper interface.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agodoc: Add rule for generating _wpa_supplicant.eps
Jouni Malinen [Sat, 3 Jan 2015 13:57:41 +0000 (15:57 +0200)]
doc: Add rule for generating _wpa_supplicant.eps

Commit 7c4e92115a795dd2ee2135cf49d7e9e172fb5851 ('Update Doxygen
documentation for new version') rename the PNG version of the image, but
forgot the EPS version for Latex.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Extend EAP key lifetime in memory to cover MSK and EMSK
Jouni Malinen [Mon, 29 Dec 2014 19:57:35 +0000 (21:57 +0200)]
tests: Extend EAP key lifetime in memory to cover MSK and EMSK

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agodoc: Disable Doxygen autolink support
Jouni Malinen [Sat, 3 Jan 2015 13:44:35 +0000 (15:44 +0200)]
doc: Disable Doxygen autolink support

The way autolink support is implementing in Doxygen is a bit
inconvenient with wpa_supplicant being recognized as something that
would always be linked to struct wpa_supplicant. In addition, number of
links were not really noticed automatically. To get this working more
robustly and without having to use the %wpa_supplicant workaround (which
had its own issues, e.g., with titles), disable autolinking and use
explicit \ref commands instead.

This is also updating some of the obsolete notes to point to correct
file names, etc. changes in the source code tree.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Clear nlmsg payload with keys before freeing
Jouni Malinen [Fri, 2 Jan 2015 23:01:42 +0000 (01:01 +0200)]
nl80211: Clear nlmsg payload with keys before freeing

This reduces the time possible keys could remain in heap memory. Couple
of the nl80211 messages include keys (TK for normal ciphers and
KCK/KEK/PMK for various offloading cases).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Note linux_set_iface_flags() failure in debug log
Jouni Malinen [Fri, 2 Jan 2015 20:54:30 +0000 (22:54 +0200)]
nl80211: Note linux_set_iface_flags() failure in debug log

There was one final remaining linux_set_iface_flags() call that did not
check the result. This specific one does not really matter much, but
anyway, be more consistent by checking the result and log any error in
debug log. (CID 74146)

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