mech_eap.git
9 years agowpa_supplicant: Allow OpenSSL cipherlist string to be configured
Jouni Malinen [Sun, 12 Oct 2014 08:53:51 +0000 (11:53 +0300)]
wpa_supplicant: Allow OpenSSL cipherlist string to be configured

The new openssl_cipher configuration parameter can be used to select
which TLS cipher suites are enabled for TLS-based EAP methods when
OpenSSL is used as the TLS library. This parameter can be used both as a
global parameter to set the default for all network blocks and as a
network block parameter to override the default for each network
profile.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agohostapd: Allow OpenSSL cipherlist string to be configured
Jouni Malinen [Sun, 12 Oct 2014 08:52:05 +0000 (11:52 +0300)]
hostapd: Allow OpenSSL cipherlist string to be configured

The new openssl_cipher configuration parameter can be used to select
which TLS cipher suites are enabled when hostapd is used as an EAP
server with OpenSSL as the TLS library.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoOpenSSL: Add a mechanism to configure cipher suites
Jouni Malinen [Sun, 12 Oct 2014 08:45:21 +0000 (11:45 +0300)]
OpenSSL: Add a mechanism to configure cipher suites

This extends the TLS wrapper code to allow OpenSSL cipherlist string to
be configured. In addition, the default value is now set to
DEFAULT:!EXP:!LOW to ensure cipher suites with low and export encryption
algoriths (40-64 bit keys) do not get enabled in default configuration
regardless of how OpenSSL build was configured.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoeapol_test: Check inet_aton() result
Jouni Malinen [Sat, 11 Oct 2014 16:45:17 +0000 (19:45 +0300)]
eapol_test: Check inet_aton() result

This makes code more consistent (CID 72676).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoDFS: Check os_get_random() result
Jouni Malinen [Sat, 11 Oct 2014 16:41:33 +0000 (19:41 +0300)]
DFS: Check os_get_random() result

This use does not really need a strong random number, so fall back to
os_random() if a theoretical error case occurs. (CID 72682)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAP: Check os_get_random() return value more consistently
Jouni Malinen [Sat, 11 Oct 2014 16:38:45 +0000 (19:38 +0300)]
AP: Check os_get_random() return value more consistently

While this specific case does not really care what value is used, the
the theoretical error case can be handled more consistently. (CID 72684)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-MSCHAPv2 server: Check ms_funcs results more consistently
Jouni Malinen [Sat, 11 Oct 2014 16:31:48 +0000 (19:31 +0300)]
EAP-MSCHAPv2 server: Check ms_funcs results more consistently

This makes the code more consistent by checking the somewhat theoretical
error cases more consistently (CID 72685).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoReport sendto() failures for hostapd ctrl_iface
Jouni Malinen [Sat, 11 Oct 2014 16:29:22 +0000 (19:29 +0300)]
Report sendto() failures for hostapd ctrl_iface

This makes issues with control interface operations more easily
debuggable (CID 72681, CID 72686).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-IKEv2: Fix the payload parser
Jouni Malinen [Sat, 11 Oct 2014 16:22:30 +0000 (19:22 +0300)]
EAP-IKEv2: Fix the payload parser

The payload lengths were not properly verified and the first check on
there being enough buffer for the header was practically ignored. The
second check for the full payload would catch length issues, but this is
only after the potential read beyond the buffer. (CID 72687)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWPS UPnP: Check os_get_random() result more consistently
Jouni Malinen [Sat, 11 Oct 2014 16:08:30 +0000 (19:08 +0300)]
WPS UPnP: Check os_get_random() result more consistently

While the value here would not matter much, make the implementation more
consistent (CID 72692).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoTLS client: Make DH parameter parsing easier for static analyzers
Jouni Malinen [Sat, 11 Oct 2014 16:04:00 +0000 (19:04 +0300)]
TLS client: Make DH parameter parsing easier for static analyzers

The dh_p_len, dh_g_len, and dh_ys_len parameters were validated against
the received message structure, but that did not seem to be done in a
way that some static analyzers would understand this (CID 72699).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWPS UPnP: Check os_get_random() result
Jouni Malinen [Sat, 11 Oct 2014 15:58:17 +0000 (18:58 +0300)]
WPS UPnP: Check os_get_random() result

This makes the implementation more consistent (CID 72705).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoMACsec: Check os_get_random() return value
Jouni Malinen [Sat, 11 Oct 2014 15:46:35 +0000 (18:46 +0300)]
MACsec: Check os_get_random() return value

This makes the MACsec implementation more consistent with rest of
wpa_supplicant. (CID 72677, CID 72695, CID 72701, CID 72709, CID 72711)

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Be more consistent with linux_set_iface_flags() result
Jouni Malinen [Sat, 11 Oct 2014 15:43:30 +0000 (18:43 +0300)]
nl80211: Be more consistent with linux_set_iface_flags() result

Check the return value and write a debug message if this operation
failes (CID 74146).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWFD: Use cleaner bounds checking for sub-element length field
Jouni Malinen [Sat, 11 Oct 2014 15:40:32 +0000 (18:40 +0300)]
WFD: Use cleaner bounds checking for sub-element length field

Mark the variable as unsigned and make the length check use "len > end -
pos" version to makes this easier to understand for static analyzers
(CID 74155).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P NFC: Make code easier for static analyzers
Jouni Malinen [Sat, 11 Oct 2014 15:34:25 +0000 (18:34 +0300)]
P2P NFC: Make code easier for static analyzers

len + pos > end comparison here did verify that the length field had a
valid value, but that did not seem to enough to avoid TAINTED_SCALAR
warning. Re-order that validation step to be equivalent "len > end -
pos" to remove these false positives (CID 68116).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-PAX server: Remove unused assignment
Jouni Malinen [Sat, 11 Oct 2014 15:14:42 +0000 (18:14 +0300)]
EAP-PAX server: Remove unused assignment

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-SIM DB: Remove unused assignment
Jouni Malinen [Sat, 11 Oct 2014 15:13:32 +0000 (18:13 +0300)]
EAP-SIM DB: Remove unused assignment

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-FAST server: Remove unused assignment
Jouni Malinen [Sat, 11 Oct 2014 15:11:14 +0000 (18:11 +0300)]
EAP-FAST server: Remove unused assignment

Commit e8c08c9a363340c45baf8e13c758c99078bc0d8b ('EAP-FAST server: Fix
potential read-after-buffer (by one byte)') changed the while loop
design in a way that does not require the pos variable to be updated
anymore. Remove that unneeded code to clean up static analyzer warnings
about unused assignments.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoEAP-FAST server: Remove unused write
Jouni Malinen [Sat, 11 Oct 2014 15:10:27 +0000 (18:10 +0300)]
EAP-FAST server: Remove unused write

next_type is not used in case m->check() results in ignoring the packet.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRADIUS: Remove unused write
Jouni Malinen [Sat, 11 Oct 2014 15:06:52 +0000 (18:06 +0300)]
RADIUS: Remove unused write

There is no need to update the left variable when breaking out from the
loop.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoIAPP: Avoid warnings on unused write
Jouni Malinen [Sat, 11 Oct 2014 15:03:38 +0000 (18:03 +0300)]
IAPP: Avoid warnings on unused write

The hlen and len variables are identical here, but only the hlen was
used in the end. Change this to use the len variable to avoid
unnecessary static analyzer warnings about unused writes.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotest: Remove driver_test.c
Jouni Malinen [Sat, 11 Oct 2014 14:46:04 +0000 (17:46 +0300)]
test: Remove driver_test.c

The driver_test.c driver wrapper (-Dtest in wpa_supplicant and
driver=test in hostapd) was previously used for testing without real
Wi-Fi hardware. mac80211_hwsim-based tests have practically replaced all
these needs and there has been no improvements or use for driver_test.c
in a long while. Because of this, there has not really been any effort
to maintain this older test tool and no justification to change this
either. Remove the obsoleted test mechanism to clean up the repository.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoSimplify memory allocation/freeing for static analyzers
Jouni Malinen [Sat, 11 Oct 2014 14:29:50 +0000 (17:29 +0300)]
Simplify memory allocation/freeing for static analyzers

It looks like the use of sm->wpa == WPA_VERSION_WPA2 in two locations
within the function was a bit too much for clang static analyzer to
understand. Use a separate variable for storing the allocated memory so
that it can be freed unconditionally. The kde variable can point to
either stack memory or temporary allocation, but that is now const
pointer to make the design clearer.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd a workaround to clanc static analyzer warning
Jouni Malinen [Sat, 11 Oct 2014 14:18:02 +0000 (17:18 +0300)]
Add a workaround to clanc static analyzer warning

dl_list_del() followed by dl_list_add() seemed to confuse clang static
analyzer somehow, so explicitly check for the prev pointer to be
non-NULL to avoid an incorrect warning.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoWPS UPnP: Make dl_list_first() use easier for static analyzer
Jouni Malinen [Sat, 11 Oct 2014 10:43:27 +0000 (13:43 +0300)]
WPS UPnP: Make dl_list_first() use easier for static analyzer

The preceding dl_list_len() check guarantees that dl_list_first()
returns an entry and not NULL. However, that seems to be a bit too
difficult path to follow for static analyzers, so add an explicit check
for the dl_list_first() return value to be non-NULL to avoid warnings.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoSet WoWLAN triggers only if driver capabilities are known
Jouni Malinen [Sat, 11 Oct 2014 09:38:35 +0000 (12:38 +0300)]
Set WoWLAN triggers only if driver capabilities are known

Previously, wpas_set_wowlan_triggers() could have been called in
uninitialized wpa_driver_capa data if the driver interface did not
support reporting of capabilities. While this would not really happen
with a driver wrapper that implements set_wowlan() and as such, would
not cause any difference in practice, it is better to clean this up to
make the code path easier to understand for static analyzers.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Clean up coding style and indentation level
Jouni Malinen [Sat, 11 Oct 2014 09:05:27 +0000 (12:05 +0300)]
P2P: Clean up coding style and indentation level

The multi-line for loop body and incorrect indentation level on the
return statement looked pretty confusing.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Provide subtype and reason code for AP SME drivers
Jouni Malinen [Thu, 9 Oct 2014 13:52:38 +0000 (16:52 +0300)]
nl80211: Provide subtype and reason code for AP SME drivers

This allows drivers that implement AP SME internally to generate a
Deauthentication or Disassociation frame with the specified reason code.
This was already done with drivers that use hostapd/wpa_supplicant for
AP SME.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: P2P group formation with WSC_Done missing
Jouni Malinen [Fri, 10 Oct 2014 15:03:38 +0000 (18:03 +0300)]
tests: P2P group formation with WSC_Done missing

This verifies that GO is able to complete group formation even if the
P2P Client does not send WSC_Done message (or that message is dropped
for any reason) in case the P2P Client completes 4-way handshake
successfully.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: 4-way exchange using external EAPOL I/O
Jouni Malinen [Fri, 10 Oct 2014 15:03:05 +0000 (18:03 +0300)]
tests: 4-way exchange using external EAPOL I/O

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd external EAPOL transmission option for testing purposes
Jouni Malinen [Fri, 10 Oct 2014 15:01:15 +0000 (18:01 +0300)]
Add external EAPOL transmission option for testing purposes

The new ext_eapol_frame_io parameter can be used to configure hostapd
and wpa_supplicant to use control interface for receiving and
transmitting EAPOL frames. This makes it easier to implement automated
test cases for protocol testing. This functionality is included only in
CONFIG_TESTING_OPTIONS=y builds.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Handle improper WPS termination on GO during group formation
Sunil Dutt [Wed, 1 Oct 2014 12:36:53 +0000 (18:06 +0530)]
P2P: Handle improper WPS termination on GO during group formation

A P2P Client may be able to connect to the GO even if the WPS
provisioning step has not terminated cleanly (e.g., P2P Client does not
send WSC_Done). Such group formation attempt missed the event
notification about started group on the GO and also did not set the
internal state corresponding to the successful group formation.

This commit addresses the missing part by completing GO side group
formation on a successful first data connection if WPS does not complete
cleanly. Also, this commit reorders the STA authorization indications to
ensure that the group formation success notification is given prior to
the first STA connection to handle such scenarios.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoP2P: Clear p2p_go_group_formation_completed on GO start
Jouni Malinen [Fri, 10 Oct 2014 12:53:22 +0000 (15:53 +0300)]
P2P: Clear p2p_go_group_formation_completed on GO start

Previously, this variable did not necessarily get cleared between group
formations and could result in some of the workaround operations from
not being executed after the first group formation when using the same
interface for all P2P groups. Fix this by clearing the variable whenever
starting the GO to make sure it is used consistently for each group
formation.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoComplete sme-connect radio work when clearing connection state
Jouni Malinen [Thu, 9 Oct 2014 22:33:58 +0000 (01:33 +0300)]
Complete sme-connect radio work when clearing connection state

It was possible for local deauthentication request to leave sme-connect
radio work running even when there was no ongoing effort to complete the
connection anymore. Clean this up by marking sme-connect radio work
item, if any, done when clearing connection state after such
disconnection during connection.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Report group removal reason PSK_FAILURE in timeout case
Jouni Malinen [Thu, 9 Oct 2014 22:31:57 +0000 (01:31 +0300)]
P2P: Report group removal reason PSK_FAILURE in timeout case

It was possible for group formation timeout to be the trigger for
detecting the second PSK/4-way handshake failure. If that happened, the
special reason=PSK_FAILURE was not used in the P2P-GROUP-REMOVED event
even though P2P-PERSISTENT-PSK-FAIL did get reported. Fix this special
case by replacing the reason code with PSK_FAILURE if the PSK failure
timeout gets registed as part of the disconnection processing in the
formation timeout handler.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Make ap_hs20_session_info more robust
Jouni Malinen [Thu, 9 Oct 2014 21:29:46 +0000 (00:29 +0300)]
tests: Make ap_hs20_session_info more robust

It looks like mac80211 scan-while-associated can now take over 10
seconds with the current wireless-regdb rules for world roaming due to
number of additional DFS channel having been enabled for passive
scanning. This resulted in ap_hs20_session_info failing due to the wait
for the scan result event timing out. That is not really a real failure,
so increase the timeout to avoid reporting this incorrectly.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoThe master branch is now used for v2.4 development
Jouni Malinen [Thu, 9 Oct 2014 17:36:53 +0000 (20:36 +0300)]
The master branch is now used for v2.4 development

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoChange version information for the 2.3 release hostap_2_3
Jouni Malinen [Mon, 6 Oct 2014 16:07:21 +0000 (19:07 +0300)]
Change version information for the 2.3 release

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoUpdate ChangeLog files for v2.3
Jouni Malinen [Mon, 6 Oct 2014 16:05:47 +0000 (19:05 +0300)]
Update ChangeLog files for v2.3

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agobrowser-wpadebug: Use more robust mechanism for starting browser
Jouni Malinen [Mon, 6 Oct 2014 15:51:22 +0000 (18:51 +0300)]
browser-wpadebug: Use more robust mechanism for starting browser

Use os_exec() to run the external browser to avoid undesired command
line processing for control interface event strings. Previously, it
could have been possible for some of the event strings to include
unsanitized data which is not suitable for system() use.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agobrowser-android: Use more robust mechanism for starting browser
Jouni Malinen [Mon, 6 Oct 2014 15:50:47 +0000 (18:50 +0300)]
browser-android: Use more robust mechanism for starting browser

Use os_exec() to run the external browser to avoid undesired command
line processing for control interface event strings. Previously, it
could have been possible for some of the event strings to include
unsanitized data which is not suitable for system() use.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agobrowser-system: Use more robust mechanism for starting browser
Jouni Malinen [Mon, 6 Oct 2014 15:50:00 +0000 (18:50 +0300)]
browser-system: Use more robust mechanism for starting browser

Use os_exec() to run the external browser to avoid undesired command
line processing for control interface event strings. Previously, it
could have been possible for some of the event strings to include
unsanitized data which is not suitable for system() use.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agohostapd_cli: Use os_exec() for action script execution
Jouni Malinen [Mon, 6 Oct 2014 15:49:01 +0000 (18:49 +0300)]
hostapd_cli: Use os_exec() for action script execution

Use os_exec() to run the action script operations to avoid undesired
command line processing for control interface event strings. Previously,
it could have been possible for some of the event strings to include
unsanitized data which is not suitable for system() use. (CVE-2014-3686)

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agowpa_cli: Use os_exec() for action script execution
Jouni Malinen [Mon, 6 Oct 2014 14:25:52 +0000 (17:25 +0300)]
wpa_cli: Use os_exec() for action script execution

Use os_exec() to run the action script operations to avoid undesired
command line processing for control interface event strings. Previously,
it could have been possible for some of the event strings to include
unsanitized data which is not suitable for system() use. (CVE-2014-3686)

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoAdd os_exec() helper to run external programs
Jouni Malinen [Mon, 6 Oct 2014 13:27:44 +0000 (16:27 +0300)]
Add os_exec() helper to run external programs

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: VHT 80+80 MHz
Jouni Malinen [Thu, 9 Oct 2014 11:27:23 +0000 (14:27 +0300)]
tests: VHT 80+80 MHz

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoDFS: Allow 80+80 MHz be configured for VHT
Jouni Malinen [Thu, 9 Oct 2014 11:25:55 +0000 (14:25 +0300)]
DFS: Allow 80+80 MHz be configured for VHT

This allows cases where neither 80 MHz segment requires DFS to be
configured. DFS CAC operation itself does not yet support 80+80, though,
so if either segment requires DFS, the AP cannot be brought up.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Fix DFS radar-during-CAC test case
Jouni Malinen [Wed, 8 Oct 2014 22:59:52 +0000 (01:59 +0300)]
tests: Fix DFS radar-during-CAC test case

This uses mac80211_hwsim dfs_simulate_radar to get the real kernel side
CAC operation executed and aborted due to radar detection. This allows
another channel to be selected properly through another CAC run.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Extend DFS testing to include channel switch
Jouni Malinen [Wed, 8 Oct 2014 22:23:21 +0000 (01:23 +0300)]
tests: Extend DFS testing to include channel switch

Simulate a radar detection event to verify that hostapd switches
channels properly and the station follows the AP to the new channel.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Re-enable DFS connection check
Jouni Malinen [Wed, 8 Oct 2014 15:27:12 +0000 (18:27 +0300)]
tests: Re-enable DFS connection check

It looks like association with DFS works fine with the current kernel
version, so re-enable this part of the DFS test cases.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: VHT with 160 MHz channel width
Jouni Malinen [Wed, 8 Oct 2014 15:18:39 +0000 (18:18 +0300)]
tests: VHT with 160 MHz channel width

Since this requires a recent CRDA version and updated wireless-regdb, do
not report failures yet (i.e., indicate that the test case was skipped
if AP startup fails).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoReserve QCA vendor specific nl80211 commands 34..49
Jouni Malinen [Tue, 7 Oct 2014 17:07:48 +0000 (20:07 +0300)]
Reserve QCA vendor specific nl80211 commands 34..49

These are reserved for QCA use.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotest-aes: Allow NIST key wrap test vectors to be verified
Jouni Malinen [Tue, 7 Oct 2014 11:53:09 +0000 (14:53 +0300)]
test-aes: Allow NIST key wrap test vectors to be verified

This allows the aes_wrap() and aes_unwrap() implementation to be
verified against KW_{AE,AD}_{128,192,256}.txt test vectors from
http://csrc.nist.gov/groups/STM/cavp/documents/mac/kwtestvectors.zip

For example:
./test-aes NIST-KW-AE kwtestvectors/KW_AE_128.txt
./test-aes NIST-KW-AE kwtestvectors/KW_AE_192.txt
./test-aes NIST-KW-AE kwtestvectors/KW_AE_256.txt
./test-aes NIST-KW-AD kwtestvectors/KW_AD_128.txt
./test-aes NIST-KW-AD kwtestvectors/KW_AD_192.txt
./test-aes NIST-KW-AD kwtestvectors/KW_AD_256.txt

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAES: Extend key wrap implementation to support longer data
Jouni Malinen [Tue, 7 Oct 2014 11:45:22 +0000 (14:45 +0300)]
AES: Extend key wrap implementation to support longer data

This extends the "XOR t" operation in aes_wrap() and aes_unwrap() to
handle up to four octets of the n*h+i value instead of just the least
significant octet. This allows the plaintext be longer than 336 octets
which was the previous limit.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAES: Extend key wrap design to support longer AES keys
Jouni Malinen [Tue, 7 Oct 2014 10:48:45 +0000 (13:48 +0300)]
AES: Extend key wrap design to support longer AES keys

This adds kek_len argument to aes_wrap() and aes_unwrap() functions and
allows AES to be initialized with 192 and 256 bit KEK in addition to
the previously supported 128 bit KEK.

The test vectors in test-aes.c are extended to cover all the test
vectors from RFC 3394.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoOpenSSL: Clean up one part from the BoringSSL patch
Jouni Malinen [Tue, 7 Oct 2014 08:44:56 +0000 (11:44 +0300)]
OpenSSL: Clean up one part from the BoringSSL patch

The (int) typecast I used with sk_GENERAL_NAME_num() to complete the
BoringSSL compilation was not really the cleanest way of doing this.
Update that to use stack_index_t variable to avoid this just like the
other sk_*_num() calls.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoSupport building with BoringSSL
Adam Langley [Fri, 19 Sep 2014 01:40:03 +0000 (18:40 -0700)]
Support building with BoringSSL

BoringSSL is Google's cleanup of OpenSSL and an attempt to unify
Chromium, Android and internal codebases around a single OpenSSL.

As part of moving Android to BoringSSL, the wpa_supplicant maintainers
in Android requested that I upstream the change. I've worked to reduce
the size of the patch a lot but I'm afraid that it still contains a
number of #ifdefs.

[1] https://www.imperialviolet.org/2014/06/20/boringssl.html

Signed-off-by: Adam Langley <agl@chromium.org>
9 years agoAndroid: Remove ctrl_interface=wlan0 from config template
Dmitry Shmidt [Fri, 5 Sep 2014 20:13:01 +0000 (13:13 -0700)]
Android: Remove ctrl_interface=wlan0 from config template

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agoAndroid: Set pmf=1 to default template
Dmitry Shmidt [Thu, 4 Sep 2014 17:47:59 +0000 (10:47 -0700)]
Android: Set pmf=1 to default template

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
9 years agotests: VENDOR_ELEM_REMOVE of the second IE
Jouni Malinen [Mon, 6 Oct 2014 21:40:52 +0000 (00:40 +0300)]
tests: VENDOR_ELEM_REMOVE of the second IE

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix out of bounds memory access when removing vendor elements
Toby Gray [Mon, 6 Oct 2014 11:24:33 +0000 (12:24 +0100)]
Fix out of bounds memory access when removing vendor elements

Commit 86bd36f0d5b3d359075c356d68977b4d2e7c9f71 ("Add generic
mechanism for adding vendor elements into frames") has a minor bug
where it miscalculates the length of memory to move using
os_memmove. If multiple vendor elements are specified then this can
lead to out of bounds memory accesses.

This patch fixes this by calculating the correct length of remaining
data to shift down in the information element.

Signed-off-by: Toby Gray <toby.gray@realvnc.com>
9 years agoClean up authenticator PMKSA cache implementation
Jouni Malinen [Sat, 4 Oct 2014 19:08:17 +0000 (22:08 +0300)]
Clean up authenticator PMKSA cache implementation

This makes the implementation somewhat easier to understand.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoClear PMKSA cache entry data when freeing them
Jouni Malinen [Sat, 4 Oct 2014 18:43:32 +0000 (21:43 +0300)]
Clear PMKSA cache entry data when freeing them

Avoid leaving the PMK information unnecessarily in memory.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoRemove unnecessary PMKSA cache freeing step
Jouni Malinen [Sat, 4 Oct 2014 18:38:44 +0000 (21:38 +0300)]
Remove unnecessary PMKSA cache freeing step

_pmksa_cache_free_entry() is a static function that is never called with
entry == NULL, so there is no need to check for that.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: OKC with multiple stations
Jouni Malinen [Sat, 4 Oct 2014 19:59:01 +0000 (22:59 +0300)]
tests: OKC with multiple stations

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix authenticator OKC fetch from PMKSA cache to avoid infinite loop
Jouni Malinen [Sat, 4 Oct 2014 19:11:00 +0000 (22:11 +0300)]
Fix authenticator OKC fetch from PMKSA cache to avoid infinite loop

If the first entry in the PMKSA cache did not match the station's MAC
address, an infinite loop could be reached in pmksa_cache_get_okc() when
trying to find a PMKSA cache entry for opportunistic key caching cases.
This would only happen if OKC is enabled (okc=1 included in the
configuration file).

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: PMKSA cache with multiple stations
Jouni Malinen [Sat, 4 Oct 2014 19:39:16 +0000 (22:39 +0300)]
tests: PMKSA cache with multiple stations

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: PMKSA cache entry timeout based on Session-Timeout
Jouni Malinen [Sat, 4 Oct 2014 16:38:55 +0000 (19:38 +0300)]
tests: PMKSA cache entry timeout based on Session-Timeout

This verifies that hostapd uses Session-Timeout value from Access-Accept
as the lifetime for the PMKSA cache entries and expires entries both
while the station is disconnected and during an association.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoFix PMKSA cache timeout from Session-Timeout in WPA/WPA2 cases
Jouni Malinen [Sat, 4 Oct 2014 16:36:48 +0000 (19:36 +0300)]
Fix PMKSA cache timeout from Session-Timeout in WPA/WPA2 cases

Previously, WPA/WPA2 case ended up using the hardcoded
dot11RSNAConfigPMKLifetime (43200 seconds) for PMKSA cache entries
instead of using the Session-Timeout value from the RADIUS server (if
included in Access-Accept). Store a copy of the Session-Timeout value
and use it instead of the default value so that WPA/WPA2 cases get the
proper timeout similarly to non-WPA/WPA2 cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: PMKSA caching disabled on AP
Jouni Malinen [Sat, 4 Oct 2014 16:05:10 +0000 (19:05 +0300)]
tests: PMKSA caching disabled on AP

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agowpa_supplicant: Enable HT for IBSS
Janusz Dziedzic [Wed, 1 Oct 2014 07:52:54 +0000 (09:52 +0200)]
wpa_supplicant: Enable HT for IBSS

Enable HT20 for IBSS when HT is supported by the driver.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agowpa_supplicant: Use hostapd_freq_params in assoc_params
Janusz Dziedzic [Wed, 1 Oct 2014 07:52:53 +0000 (09:52 +0200)]
wpa_supplicant: Use hostapd_freq_params in assoc_params

Use hostapd_freq_params instead of simple frequency parameter for driver
commands. This is preparation for IBSS configuration to allow use of
HT/VHT in IBSS.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
9 years agowpa_ctrl: Update wpa_ctrl_recv() documentation for non-block behavior
Jouni Malinen [Sat, 4 Oct 2014 15:32:57 +0000 (18:32 +0300)]
wpa_ctrl: Update wpa_ctrl_recv() documentation for non-block behavior

Commit 4fdc8def8855ce9b90ffbbdc47152ce46ccdcb1e changed the wpa_ctrl
socket to be be non-blocking, so the comment about wpa_ctrl_recv()
blocking is not valid anymore.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agodbus: Add an interface configuration entry to set the WPS methods
Tomasz Bursztyka [Fri, 3 Oct 2014 06:10:33 +0000 (09:10 +0300)]
dbus: Add an interface configuration entry to set the WPS methods

It is thus possible to restrain WPS methods to prefered ones, like PBC
only, etc.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agotests: External MAC address change
Jouni Malinen [Sat, 4 Oct 2014 13:41:33 +0000 (16:41 +0300)]
tests: External MAC address change

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Re-read MAC address on RTM_NEWLINK
Dan Williams [Thu, 2 Oct 2014 15:30:05 +0000 (10:30 -0500)]
nl80211: Re-read MAC address on RTM_NEWLINK

Commit 97279d8d (after hostap-2.0) dropped frame events from foreign
addresses. Unfortunately this commit did not handle the case where the
interface's MAC address might be changed externally, which other
wpa_supplicant code already handled. This causes the driver to reject
any MLME event because the address from the event doesn't match the
stale address in the driver data.

Changing an interface's MAC address requires that the interface be
down, the change made, and then the interface brought back up. This
triggers an RTM_NEWLINK event which driver_nl80211.c can use to
re-read the MAC address of the interface.

Signed-hostap: Dan Williams <dcbw@redhat.com>

9 years agonl80211: Add get_bss_ifindex() helper
Jouni Malinen [Sat, 4 Oct 2014 13:20:38 +0000 (16:20 +0300)]
nl80211: Add get_bss_ifindex() helper

This can be used to fetch a BSS entry based on interface index.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoP2P: Use only the -m config for P2P management device
Jouni Malinen [Fri, 3 Oct 2014 19:50:21 +0000 (22:50 +0300)]
P2P: Use only the -m config for P2P management device

Previously, the case of non-netdev P2P management device ended up
pulling in both the main interface (e.g., wlan0) and P2P Device
interface (from command line -m argument) as configuration. Similarly,
the main interface ended up included both configuration files. This is
not really helpful for various use cases, e.g., when permanent P2P group
information is stored in the P2P Devince interface, but it gets
duplicated in the main station interface configuration.

Clean this up by changing the -m<file> argument to replace, not
concatenate, configuration information. In other words, the main station
interface will not read this configuration and the P2P Device interface
(non-netdev) does not read parameters from the station interface
configuration file.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoRevert "tests: Skip ap_wpa2_tdls_concurrent_init on failure"
Jouni Malinen [Fri, 3 Oct 2014 08:41:32 +0000 (11:41 +0300)]
Revert "tests: Skip ap_wpa2_tdls_concurrent_init on failure"

This reverts commit bf700cc3d2431017e5911e4efb439c235b18ef5d. The
concurrent initialization test case is now expected to work again with
the STA entry added early enough to avoid the recently added mac80211
validation step failure.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Verify TDLS responder teardown in encrypted network
Arik Nemtsov [Mon, 29 Sep 2014 18:47:54 +0000 (20:47 +0200)]
tests: Verify TDLS responder teardown in encrypted network

Older mac80211 implementations did not set the link identifier
appropriately, resulting in an incorrect teardown packet being sent the
peer. wpa_supplicant adds the FTE containing the MIC field calculated
using the correct link-identifier. This causes a MIC failure on the
other side and the teardown is discarded. Verify this case is fixed by
newer kernel and wpa_supplicant code.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Use WMM IE for propagating peer WMM capability
Arik Nemtsov [Mon, 29 Sep 2014 18:47:53 +0000 (20:47 +0200)]
TDLS: Use WMM IE for propagating peer WMM capability

Relying on qos qosinfo is not enough, as it can be 0 for WMM enabled
peers that don't support U-APSD. Further, some peers don't even contain
this IE (Google Nexus 5), but do contain the WMM IE during setup.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Fix concurrent setup test for mac80211 drivers
Arik Nemtsov [Mon, 29 Sep 2014 18:47:52 +0000 (20:47 +0200)]
TDLS: Fix concurrent setup test for mac80211 drivers

A recent mac80211 patch ("8f02e6b mac80211: make sure TDLS peer STA
exists during setup") forces the TDLS STA to exist before sending any
mgmt packets. Add the STA before sending a concurrent-setup test packet.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoTDLS: Set the initiator during tdls_mgmt operations
Arik Nemtsov [Mon, 29 Sep 2014 18:47:51 +0000 (20:47 +0200)]
TDLS: Set the initiator during tdls_mgmt operations

Some drivers need to know the initiator of a TDLS connection in order
to generate a correct TDLS mgmt packet. It is used to determine
the link identifier IE. Pass this information to the driver.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
9 years agoSync with wireless-testing.git include/uapi/linux/nl80211.h
Jouni Malinen [Fri, 3 Oct 2014 08:38:34 +0000 (11:38 +0300)]
Sync with wireless-testing.git include/uapi/linux/nl80211.h

This brings in nl80211 definitions as of 2014-10-02.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agonl80211: Fix compatibility with older version of libnl
Ilan Peer [Wed, 1 Oct 2014 06:01:25 +0000 (08:01 +0200)]
nl80211: Fix compatibility with older version of libnl

Commit 97ed9a06df566357f0ebe57f8080f78726e78db6 ('nl80211: Remove bridge
FDB entry upon sta_remove()') used nl_sock and nl_socket_* functions
which are not compatible with older versions of libnl. Fix this.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
9 years agoTDLS: Filter AID value properly for VHT peers
Jouni Malinen [Mon, 29 Sep 2014 16:58:26 +0000 (19:58 +0300)]
TDLS: Filter AID value properly for VHT peers

IEEE 802.11 standard sends AID in a field that is defined in a bit
strange way to set two MSBs to ones. That is not the real AID and those
extra bits need to be filtered from the value before passing this to the
driver.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agotests: Random MAC addresses while maintaining OUI
Jouni Malinen [Mon, 29 Sep 2014 20:25:43 +0000 (23:25 +0300)]
tests: Random MAC addresses while maintaining OUI

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoExtend random MAC address support to allow OUI to be kept
Jouni Malinen [Mon, 29 Sep 2014 20:24:19 +0000 (23:24 +0300)]
Extend random MAC address support to allow OUI to be kept

mac_addr=2 and preassoc_mac_addr=2 parameters can now be used to
configure random MAC address to be generated by maintaining the OUI part
of the permanent MAC address (but with locally administered bit set to
1). Other than that, these values result in similar behavior with
mac_addr=1 and preassoc_mac_addr=1, respectively.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agoAdd helper function for generating random MAC addresses with same OUI
Jouni Malinen [Mon, 29 Sep 2014 20:23:11 +0000 (23:23 +0300)]
Add helper function for generating random MAC addresses with same OUI

random_mac_addr_keep_oui() is similar to random_mac_addr(), but it
maintains the OUI part of the source address.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: Update server and user certificates
Jouni Malinen [Mon, 29 Sep 2014 21:19:45 +0000 (00:19 +0300)]
tests: Update server and user certificates

The previous versions expired, so need to re-sign these to fix number of
the EAP test cases.

Signed-off-by: Jouni Malinen <j@w1.fi>
9 years agotests: FDB entry addition/removal
Jouni Malinen [Wed, 24 Sep 2014 13:13:44 +0000 (16:13 +0300)]
tests: FDB entry addition/removal

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agonl80211: Remove bridge FDB entry upon sta_remove()
Kyeyoon Park [Tue, 9 Sep 2014 22:38:03 +0000 (15:38 -0700)]
nl80211: Remove bridge FDB entry upon sta_remove()

The FDB entry removal ensures that the traffic destined for a
disassociated station's MAC address is no longer forwarded from the
bridge to the BSS.

Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
9 years agoAP: hostapd_setup_bss() code clean-up
Kyeyoon Park [Fri, 29 Aug 2014 18:59:55 +0000 (11:59 -0700)]
AP: hostapd_setup_bss() code clean-up

Signed-off-by: Kyeyoon Park <kyeyoonp@qca.qualcomm.com>
9 years agoP2P: Add support for 60 GHz social channel
Ahmad Masri [Thu, 25 Sep 2014 09:42:07 +0000 (12:42 +0300)]
P2P: Add support for 60 GHz social channel

Support 60 GHz band in P2P module by selecting random social channel
from all supported social channels in 2.4 GHz and 60 GHz bands.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
9 years agoExtend STATUS command with frequency information
Bojan Prtvar [Sat, 13 Sep 2014 16:24:04 +0000 (18:24 +0200)]
Extend STATUS command with frequency information

This makes 'wpa_cli status' command more versatile.

Signed-off-by: Bojan Prtvar <bojan.prtvar@rt-rk.com>
9 years agohostapd: Avoid dead code with P2P not enabled
Philippe De Swert [Tue, 23 Sep 2014 07:08:30 +0000 (10:08 +0300)]
hostapd: Avoid dead code with P2P not enabled

In case P2P is not enabled the if (dev_addr) is always ignored as
dev_addr will be NULL. As this code is relevant only to P2P, it can be
moved to be the ifdef to avoid static analyzer warnings. (CID 72907)

Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
9 years agodbus: Add a global property to set or unset WFD IEs
Tomasz Bursztyka [Mon, 15 Sep 2014 05:04:31 +0000 (08:04 +0300)]
dbus: Add a global property to set or unset WFD IEs

This permits to set or unset the WiFi Display subelements from DBus, by
providing the full WFD specific IE frame.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agowifi_display: Add a utility function to set WFD subelements from IEs
Tomasz Bursztyka [Mon, 15 Sep 2014 05:04:30 +0000 (08:04 +0300)]
wifi_display: Add a utility function to set WFD subelements from IEs

This will be useful to update the WFD subelements from DBus.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
9 years agowifi_display: Add a utility function to get the sub-elements as IEs
Tomasz Bursztyka [Mon, 15 Sep 2014 05:04:29 +0000 (08:04 +0300)]
wifi_display: Add a utility function to get the sub-elements as IEs

This will be useful for DBus API to expose current WFD configuration.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>