mech_eap.git
11 years agoHS 2.0: Add preliminary documentation for Hotspot 2.0
Jouni Malinen [Tue, 21 Aug 2012 18:30:37 +0000 (21:30 +0300)]
HS 2.0: Add preliminary documentation for Hotspot 2.0

This describes wpa_supplicant functionality for Interworking
(probe request parameters, network selection) and Hotspot 2.0.

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

11 years agohlr_auc_gw: Add SQLite database support for Milenage information
Jouni Malinen [Sun, 19 Aug 2012 19:59:30 +0000 (22:59 +0300)]
hlr_auc_gw: Add SQLite database support for Milenage information

An SQLite database can now be used to manage the Milenage information
instead of a text file. The new hlr_auc_gw.txt document describes how
this is configured and used.

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

11 years agohlr_auc_gw: Return FAILURE if IMSI for AKA is not known
Jouni Malinen [Sun, 19 Aug 2012 19:08:23 +0000 (22:08 +0300)]
hlr_auc_gw: Return FAILURE if IMSI for AKA is not known

Instead of no response, send a FAILURE response as AKA-RESP-AUTH if the
requested IMSI is not known.

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

11 years agoEAP-SIM DB: Fix a memory leak on DB connection re-opening
Jouni Malinen [Sun, 19 Aug 2012 18:17:26 +0000 (21:17 +0300)]
EAP-SIM DB: Fix a memory leak on DB connection re-opening

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

11 years agoEAP-SIM DB: Do not require external program at startup
Jouni Malinen [Sun, 19 Aug 2012 17:51:21 +0000 (20:51 +0300)]
EAP-SIM DB: Do not require external program at startup

The previous implementation was able to re-open the connection to an
external program (e.g., hlr_auc_gw) when needed, but required the
connection to be available during startup. Extend this to allow the
initial failure, so that hlr_auc_gw can be started after hostapd.

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

11 years agoWPS: Remove unused credential handlers for 802.1X
Jouni Malinen [Sun, 19 Aug 2012 16:10:40 +0000 (19:10 +0300)]
WPS: Remove unused credential handlers for 802.1X

The WPA_AUTH_WPA and WPA_AUTH_WPA2 cases have already been rejected in
this function when execution comes here. In theory, support for
WPA-Enterprise could be added, but since that has not happened over the
years, there is no good reason to keep this dead code here.

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

11 years agoOpenSSL: Make fips186_2_prf() easier for static analyzers
Jouni Malinen [Sun, 19 Aug 2012 15:54:34 +0000 (18:54 +0300)]
OpenSSL: Make fips186_2_prf() easier for static analyzers

Explicitly validate seed_len to skip memset call with zero length of
copied data at the end of the buffer. This is not really needed, but it
makes the code a bit easier for static analyzers. This is identical to
the commit a9ea17491a2c9e95bf9ac98fd36e56fde3faf188 but for the OpenSSL
version of the function.

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

11 years agoUse os_strdup() instead of os_malloc() + os_memcpy()
Jouni Malinen [Sun, 19 Aug 2012 15:50:42 +0000 (18:50 +0300)]
Use os_strdup() instead of os_malloc() + os_memcpy()

It is simpler to use os_strdup() to copy strings even if the end results
end up being used as binary data with a separate length field.

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

11 years agoRemove unnecessary header file inclusion
Jouni Malinen [Sun, 19 Aug 2012 15:44:53 +0000 (18:44 +0300)]
Remove unnecessary header file inclusion

Commit bfc62fe1331da4eca6dec70133c5d4cd1d6bc958 moved the code that
using crypto/random.h, but forgot to remove the inclusion of that header
file.

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

11 years agoRemove unnecessary base64.h inclusion
Jouni Malinen [Sun, 19 Aug 2012 15:41:45 +0000 (18:41 +0300)]
Remove unnecessary base64.h inclusion

All the TNC base64 operations are within tncs.c, so there is no point in
including base64.h into eap_server_tnc.c.

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

11 years agoHandle EVENT_RX_MGMT validation consistently
Jouni Malinen [Sun, 19 Aug 2012 15:38:27 +0000 (18:38 +0300)]
Handle EVENT_RX_MGMT validation consistently

All the other places processing EVENT_RX_MGMT events assume that the
event data is included, so not much point in verifying that here.

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

11 years agoShow an error message if sending of Action frame fails
Jouni Malinen [Sun, 19 Aug 2012 15:34:16 +0000 (18:34 +0300)]
Show an error message if sending of Action frame fails

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

11 years agoRADIUS DAS: Verify that Error-Code attribute is added
Jouni Malinen [Sun, 19 Aug 2012 15:32:35 +0000 (18:32 +0300)]
RADIUS DAS: Verify that Error-Code attribute is added

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

11 years agonl80211: Print an error if WDS STA interface cannot be set up
Jouni Malinen [Sun, 19 Aug 2012 15:28:55 +0000 (18:28 +0300)]
nl80211: Print an error if WDS STA interface cannot be set up

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

11 years agowpabuf: Get rid of separate ext_data pointer
Jouni Malinen [Sun, 19 Aug 2012 15:25:25 +0000 (18:25 +0300)]
wpabuf: Get rid of separate ext_data pointer

Use an explicit pointer to the beginning of the buffer and a flag
to indicate whether that is to external data or not. This avoids
a branch whenever accessing the buffer and helps some static
analyzers to understand the wpabuf memory uses better.

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

11 years agoClean up the closed stdin/stdout/stderr workaround to close sockets
Jouni Malinen [Sun, 19 Aug 2012 15:01:04 +0000 (18:01 +0300)]
Clean up the closed stdin/stdout/stderr workaround to close sockets

Close the workaround sockets when wpa_supplicant exists to avoid
hitting resource leak warnings.

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

11 years agoUse a shared helper function for merging supported rate lists
Jouni Malinen [Sun, 19 Aug 2012 14:52:41 +0000 (17:52 +0300)]
Use a shared helper function for merging supported rate lists

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

11 years agoFix memory allocation failure handling in EAP-TTLS/MSCHAPv2 server
Jouni Malinen [Sun, 19 Aug 2012 14:23:00 +0000 (17:23 +0300)]
Fix memory allocation failure handling in EAP-TTLS/MSCHAPv2 server

If the os_malloc() call for the User-Name value fails in EAP-TTLS
server, the inner MSCHAPv2 processing could have tried to dereference a
NULL pointer. Avoid this by handling this cleanly as an internal error
and reject the authentication attempt.

Signed-hostap: Jouni Malinen <j@w1.fi>
intended-for: hostap-1

11 years agoFIPS: Remove md5-non-fips.c
Jouni Malinen [Sun, 19 Aug 2012 13:53:15 +0000 (16:53 +0300)]
FIPS: Remove md5-non-fips.c

Commit c9e08af24fd7dda3f21674cdc744579b8c38fa28 removed the only user of
the special case MD5 use that would be allowed in FIPS mode in
tls_prf_sha1_md5(). Commit 271dbf1594bea461ea2ea7946a773a30bfa254aa
removed the file from the build, but left the implementation into the
repository. To clean things up even further, remove this functionality
completely since it is not expected to be needed for FIPS mode anymore.

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

11 years agoAdd User-Name/CUI from RADIUS ACL in Accounting messages
Michael Braun [Sun, 19 Aug 2012 11:27:30 +0000 (14:27 +0300)]
Add User-Name/CUI from RADIUS ACL in Accounting messages

This allows User-Name and Chargeable-User-Identity attributes to be
passed from Access-Accept into Accounting messages even when IEEE 802.1X
is not used.

Signed-hostap: Michael Braun <michael-dev@fami-braun.de>

11 years agoInitialize EAPOL auth identity/cui with STA entry data
Michael Braun [Sun, 19 Aug 2012 11:23:20 +0000 (14:23 +0300)]
Initialize EAPOL auth identity/cui with STA entry data

If RADIUS ACL was used for the STA, identity/cui may already be
known at this point.

Signed-hostap: Michael Braun <michael-dev@fami-braun.de>

11 years agoCopy User-Name/CUI from RADIUS ACL to STA entry
Michael Braun [Sun, 19 Aug 2012 11:20:10 +0000 (14:20 +0300)]
Copy User-Name/CUI from RADIUS ACL to STA entry

Signed-hostap: Michael Braun <michael-dev@fami-braun.de>

11 years agoStore User-Name and CUI in RADIUS ACL cache
Michael Braun [Sun, 19 Aug 2012 11:09:28 +0000 (14:09 +0300)]
Store User-Name and CUI in RADIUS ACL cache

These can be used for Accounting messages when IEEE 802.1X is not used.

Signed-hostap: Michael Braun <michael-dev@fami-braun.de>

11 years agoRemove an extra level of indentation in hostapd_acl_cache_get()
Jouni Malinen [Sun, 19 Aug 2012 10:46:23 +0000 (13:46 +0300)]
Remove an extra level of indentation in hostapd_acl_cache_get()

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

11 years agoHS 2.0: Do not allow AP hs20=1 configuration without RSN
Jouni Malinen [Sun, 19 Aug 2012 09:53:45 +0000 (12:53 +0300)]
HS 2.0: Do not allow AP hs20=1 configuration without RSN

Hotspot 2.0 networks are required to use WPA2-Enterprise/CCMP, so
enforce this while validating hostapd configuration.

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

11 years agoInterworking: Do not match credentials without WPA2-Enterprise
Jouni Malinen [Sun, 19 Aug 2012 09:47:20 +0000 (12:47 +0300)]
Interworking: Do not match credentials without WPA2-Enterprise

Since we currently support only HS 2.0 networks with Interworking
network selection, do not indicate credential match unless the
network uses WPA2-Enterprise.

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

11 years agoInterworking: Enforce WPA2-Enterprise/CCMP
Jouni Malinen [Sun, 19 Aug 2012 09:39:39 +0000 (12:39 +0300)]
Interworking: Enforce WPA2-Enterprise/CCMP

Since we currently support only HS 2.0 networks with Interworking
network selection, enforce that WPA2-Enterprise/CCMP is used on the
AP instead of allowing any WPA-Enterprise combination.

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

11 years agoHS 2.0: Do not indicate HS 2.0 status without WPA2-Enterprise
Jouni Malinen [Sun, 19 Aug 2012 09:34:14 +0000 (12:34 +0300)]
HS 2.0: Do not indicate HS 2.0 status without WPA2-Enterprise

Hotspot 2.0 allows only WPA2-Enterprise to be used, so other types of
networks must not be indicated as Hotspot 2.0 networks even if they
(incorrectly) advertise HS 2.0 support.

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

11 years agoInterworking: Do not reconnect without "auto" parameter
Jouni Malinen [Sun, 19 Aug 2012 09:26:21 +0000 (12:26 +0300)]
Interworking: Do not reconnect without "auto" parameter

When there was no credential match, but an enabled network block matched
with a scan result, wpa_supplicant reconnected at the end of
interworking_select command even if "auto" parameter was not used. Fix
this by running the reconnect only if requested to automatically select
a network.

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

11 years agoFix EAP-FAST with OpenSSL 1.0.1
Jouni Malinen [Fri, 17 Aug 2012 20:55:14 +0000 (23:55 +0300)]
Fix EAP-FAST with OpenSSL 1.0.1

The mechanism to figure out key block size based on ssl->read_hash
does not seem to work with OpenSSL 1.0.1, so add an alternative
mechanism to figure out the NAC key size that seems to work at
least with the current OpenSSL 1.0.1 releases.

Signed-hostap: Jouni Malinen <j@w1.fi>
intended-for: hostap-1

11 years agoDocument TLS options in phase1/phase2
Jouni Malinen [Fri, 17 Aug 2012 19:27:29 +0000 (22:27 +0300)]
Document TLS options in phase1/phase2

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

11 years agoDisable TLS Session Ticket extension by default for EAP-TLS/PEAP/TTLS
Jouni Malinen [Fri, 17 Aug 2012 19:26:28 +0000 (22:26 +0300)]
Disable TLS Session Ticket extension by default for EAP-TLS/PEAP/TTLS

Some deployed authentication servers seem to be unable to handle the TLS
Session Ticket extension (they are supposed to ignore unrecognized TLS
extensions, but end up rejecting the ClientHello instead). As a
workaround, disable use of TLS Sesson Ticket extension for EAP-TLS,
EAP-PEAP, and EAP-TTLS (EAP-FAST uses session ticket, so any server that
supports EAP-FAST does not need this workaround).

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

11 years agoAdd phase1/phase2 parameter for disabling TLS Session Ticket extension
Jouni Malinen [Fri, 17 Aug 2012 19:21:28 +0000 (22:21 +0300)]
Add phase1/phase2 parameter for disabling TLS Session Ticket extension

tls_disable_session_ticket=1 in phase1/phase2 can now be used to disable
use of TLS Session Ticket extension (which is enabled by default in
recent OpenSSL versions). This can be used to work around issues with
broken authentication servers that do not ignore unrecognized TLS
extensions properly.

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

11 years agoOpenSSL: Add mechanism for disabling TLS Session Ticket extension
Jouni Malinen [Fri, 17 Aug 2012 19:18:54 +0000 (22:18 +0300)]
OpenSSL: Add mechanism for disabling TLS Session Ticket extension

This can be used to implement workaround for authentication servers that
do not handle TLS extensions in ClientHello properly.

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

11 years agoSupply the connection scan results to bgscan after init
Yoni Divinsky [Fri, 17 Aug 2012 17:53:44 +0000 (20:53 +0300)]
Supply the connection scan results to bgscan after init

If bgscan is enabled, then bgscan is initiated after the connection,
with no bss scan result information. Since a scan was performed prior to
the connection, the information exists and can be used to initialize the
bgscan's cache.

Signed-hostap: Yoni Divinsky <yoni.divinsky@ti.com>

11 years agohostapd: Disable WPS 2.0 when WPA-TKIP only configuration is set
Avinash Patil [Fri, 17 Aug 2012 16:21:40 +0000 (19:21 +0300)]
hostapd: Disable WPS 2.0 when WPA-TKIP only configuration is set

WSC 2.0 deprecates use of WPA (TKIP) and does not allow WPA/TKIP only
configuration (i.e., WPA2/CCMP needs to be enabled in mixed mode for
WPA/TKIP to be acceptable). Enforce this by disabling WPS if
configuration enables WPA/TKIP without WPA2/CCMP.

Signed-off-by: Avinash Patil <patila@marvell.com>
11 years agoOpenSSL: Silence a compiler warning with OpenSSL 0.9.7
Jouni Malinen [Thu, 16 Aug 2012 19:56:19 +0000 (22:56 +0300)]
OpenSSL: Silence a compiler warning with OpenSSL 0.9.7

The PKCS5_PBKDF2_HMAC_SHA1() function in OpenSSL 0.9.7 did not mark
the salt parameter const even though it was not modified. Hide the
compiler warning with a type cast when an old OpenSSL version is
used.

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

11 years agoOpenSSL: Implement SHA256 HMAC functions using HMAC API
Jouni Malinen [Thu, 16 Aug 2012 19:34:35 +0000 (22:34 +0300)]
OpenSSL: Implement SHA256 HMAC functions using HMAC API

Use the OpenSSL HMAC implementation instead of the internal sha256.c
implementation of HMAC with SHA256.

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

11 years agoMove SHA256-based PRF function into a separate C file
Jouni Malinen [Thu, 16 Aug 2012 19:24:11 +0000 (22:24 +0300)]
Move SHA256-based PRF function into a separate C file

This makes it easier to conditionally build in SHA256 functions based
on which TLS/crypto library is used.

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

11 years agoFIPS: Use OpenSSL CMAC implementation instead of aes-omac1.c
Jouni Malinen [Thu, 16 Aug 2012 19:19:53 +0000 (22:19 +0300)]
FIPS: Use OpenSSL CMAC implementation instead of aes-omac1.c

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

11 years agoFIPS: Mix in OpenSSL RAND_bytes() into random_get_bytes()
Jouni Malinen [Thu, 16 Aug 2012 18:49:41 +0000 (21:49 +0300)]
FIPS: Mix in OpenSSL RAND_bytes() into random_get_bytes()

Make sure that the OpenSSL DRBG gets used when generating
random numbers in FIPS mode.

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

11 years agoOpenSSL: Fix crypto_hash_init() to initialize HMAC context
Jouni Malinen [Thu, 16 Aug 2012 17:39:46 +0000 (20:39 +0300)]
OpenSSL: Fix crypto_hash_init() to initialize HMAC context

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

11 years agoOpenSSL: Implement SHA1 HMAC functions using HMAC API
Jouni Malinen [Thu, 16 Aug 2012 17:38:25 +0000 (20:38 +0300)]
OpenSSL: Implement SHA1 HMAC functions using HMAC API

Use the OpenSSL HMAC implementation instead of the internal sha1.c
implementation of HMAC with SHA1.

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

11 years agoMove SHA1-based PRF function into a separate C file
Jouni Malinen [Thu, 16 Aug 2012 17:23:12 +0000 (20:23 +0300)]
Move SHA1-based PRF function into a separate C file

This makes it easier to conditionally build in SHA1 functions based
on which TLS/crypto library is used.

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

11 years agoOpenSSL: Use library function for PBKDF2 passphrase-to-PSK
Jouni Malinen [Thu, 16 Aug 2012 17:13:02 +0000 (20:13 +0300)]
OpenSSL: Use library function for PBKDF2 passphrase-to-PSK

Use the OpenSSL PKCS5_PBKDF2_HMAC_SHA1() function instead of the
internal implementation in sha1-pbkdf2.c.

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

11 years agoFIPS: Remove MD5 from the CONFIG_FIPS=y build
Jouni Malinen [Thu, 16 Aug 2012 17:03:17 +0000 (20:03 +0300)]
FIPS: Remove MD5 from the CONFIG_FIPS=y build

When CONFIG_FIPS=y is used, do not include MD5 in the build and disable
EAPOL-Key frames that use MD5 (WPA/TKIP and dynamic WEP with IEEE
802.1X).

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

11 years agoFIPS: Do not build md5-non-fips.o unless really needed
Jouni Malinen [Thu, 16 Aug 2012 16:58:15 +0000 (19:58 +0300)]
FIPS: Do not build md5-non-fips.o unless really needed

This is not needed anymore when using OpenSSL keying exporter
functionality for PRF.

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

11 years agoDo not export TLS keys in FIPS mode
Jouni Malinen [Thu, 16 Aug 2012 16:38:15 +0000 (19:38 +0300)]
Do not export TLS keys in FIPS mode

Only allow the TLS library keying material exporter functionality to be
used for MSK derivation with TLS-based EAP methods to avoid exporting
internal TLS keys from the library.

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

11 years agoAllow libdl to be linked in after OpenSSL
Jouni Malinen [Thu, 16 Aug 2012 16:34:38 +0000 (19:34 +0300)]
Allow libdl to be linked in after OpenSSL

OpenSSL-based builds may need libdl in the linker line after the OpenSSL
library. CONFIG_TLS_ADD_DL=y can now be used to force that if needed.

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

11 years agoOpenSSL: Use internal keying material exporter when possible
Jouni Malinen [Thu, 16 Aug 2012 16:29:34 +0000 (19:29 +0300)]
OpenSSL: Use internal keying material exporter when possible

Use SSL_export_keying_material() if possible, i.e., if OpenSSL is
version 1.0.1 or newer and if client random value is used first. This
allows MSK derivation with TLS-based EAP methods (apart from EAP-FAST)
without exporting the master key from OpenSSL.

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

11 years agoEAP-TTLS: Allow TTLS to be built without MSCHAPv2 support
Jouni Malinen [Thu, 16 Aug 2012 16:02:44 +0000 (19:02 +0300)]
EAP-TTLS: Allow TTLS to be built without MSCHAPv2 support

Previously, CONFIG_EAP_MSCHAPV2=y was assumed to be set for
CONFIG_EAP_TTLS=y. Avoid this dependency by making including the
MSCHAPv2 parts in EAP-TTLS conditionally.

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

11 years agoEAP-MD5: Verify that CHAP operation succeeds
Jouni Malinen [Thu, 16 Aug 2012 15:49:02 +0000 (18:49 +0300)]
EAP-MD5: Verify that CHAP operation succeeds

The MD5 operation may be disabled in the security policy so chap_md5()
call can fail.

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

11 years agoMSCHAPv2: Check operation success for NT response generation
Jouni Malinen [Thu, 16 Aug 2012 15:42:27 +0000 (18:42 +0300)]
MSCHAPv2: Check operation success for NT response generation

These functions could fail (e.g., if MD4 is disabled in the security
policy).

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

11 years agoMSCHAPv2: Check challenge_hash() failures
Jouni Malinen [Thu, 16 Aug 2012 15:38:11 +0000 (18:38 +0300)]
MSCHAPv2: Check challenge_hash() failures

In theory, the SHA1 operation may fail (e.g., if SHA1 becomes disallowed
in some security policies), so better check the return code from
challenge_hash().

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

11 years agoOpenSSL: Convert low level AES API use to EVP
Jouni Malinen [Thu, 16 Aug 2012 15:27:23 +0000 (18:27 +0300)]
OpenSSL: Convert low level AES API use to EVP

This allows the AES operations to be used in OpenSSL FIPS mode.

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

11 years agoAdd "make fips" for wpa_supplicant builds with OpenSSL
Jouni Malinen [Thu, 16 Aug 2012 14:53:05 +0000 (17:53 +0300)]
Add "make fips" for wpa_supplicant builds with OpenSSL

This can be used for convenience to build wpa_supplicant with OpenSSL
FIPS object module. CONFIG_FIPS=y is expected to be used in
wpa_supplicant/.config when using this option.

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

11 years agoOpenSSL: Fix memory leak on FIPS error paths
Jouni Malinen [Thu, 16 Aug 2012 14:38:46 +0000 (17:38 +0300)]
OpenSSL: Fix memory leak on FIPS error paths

Do not leave the tls_global context allocated if the global OpenSSL
initialization fails. This was possible in case of FIPS builds if
the FIPS mode cannot be initialized.

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

11 years agoP2P: Use larger GO config timeout if HT40 is used
Jouni Malinen [Wed, 15 Aug 2012 20:19:11 +0000 (23:19 +0300)]
P2P: Use larger GO config timeout if HT40 is used

Increase GO config timeout if HT40 is used since it takes some time
to scan channels for coex purposes before the BSS can be started.

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

11 years agoP2P: Add optional "ht40" argument for p2p_connect
Rajkumar Manoharan [Wed, 15 Aug 2012 20:07:44 +0000 (23:07 +0300)]
P2P: Add optional "ht40" argument for p2p_connect

This can be used to start negotiated GO in 40 MHz channel width
in 5GHz band.

Signed-hostap: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

11 years agoP2P: Enable 40 MHz support for autonomous P2P group addition
Rajkumar Manoharan [Wed, 15 Aug 2012 19:53:01 +0000 (22:53 +0300)]
P2P: Enable 40 MHz support for autonomous P2P group addition

Add optional "ht40" argument for p2p_group_add command to enable 40 MHz
in 5GHz band. This configures the secondary channel, when HT support is
enabled and if the HW supports 40 MHz channel width.

Signed-hostap: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

11 years agoP2P: Move channel validation into a separate function
Rajkumar Manoharan [Wed, 15 Aug 2012 19:44:34 +0000 (22:44 +0300)]
P2P: Move channel validation into a separate function

Signed-hostap: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

11 years agowpa_cli: Use helper functions to implement commands
Jouni Malinen [Wed, 15 Aug 2012 19:40:07 +0000 (22:40 +0300)]
wpa_cli: Use helper functions to implement commands

This simplifies wpa_cli implementation greatly and also reduces
the binary size by one third or so.

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

11 years agowpa_cli: Add helper functions for building and executing commands
Jouni Malinen [Wed, 15 Aug 2012 19:08:21 +0000 (22:08 +0300)]
wpa_cli: Add helper functions for building and executing commands

These helper functions can be used to implement most of the common
wpa_cli commands to simplify the implementation.

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

11 years agobuild: Use updated libnl3 header paths
Dan Williams [Wed, 15 Aug 2012 17:44:33 +0000 (20:44 +0300)]
build: Use updated libnl3 header paths

libnl3's headers live in /usr/include/libnl3 for some time now.

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

11 years agoAllow non-WPA IEEE 802.1X to be select even if WPA is also enabled
Jouni Malinen [Wed, 15 Aug 2012 16:34:04 +0000 (19:34 +0300)]
Allow non-WPA IEEE 802.1X to be select even if WPA is also enabled

If key_mgmt was set to allow both WPA and non-WPA IEEE 802.1X (i.e., to
IEEE8021X WPA-EAP), non-WPA IEEE 802.1X was rejected while preparing
association parameters. Allow this special case to be handled by
selecting non-WPA case if the scan results for the AP do not include
either WPA or RSN elements.

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

11 years agoFix adding extra IEs in sched scan
Eyal Shapira [Mon, 13 Aug 2012 18:48:55 +0000 (21:48 +0300)]
Fix adding extra IEs in sched scan

Refactoring done in commit 46ee0427b13d64dc4695fda24f4f228c99822c11
(IEEE 802.11u: Allow Interworking and HESSID to be configured)
broke adding extra IEs in sched scan. The IEs stopped being added
to the scan params within wpa_supplicant_extra_ies() but no code
was added to add them in wpa_supplicant_req_sched_scan().
Fix this and remove unused params arg in wpa_supplicant_extra_ies().

Signed-hostap: Eyal Shapira <eyal@wizery.com>
intended-for: hostap-1

11 years agoGAS: Fix reporting of GAS query timeouts
Jouni Malinen [Mon, 13 Aug 2012 18:33:00 +0000 (21:33 +0300)]
GAS: Fix reporting of GAS query timeouts

GAS_QUERY_TIMEOUT value was used for two different things - enum for
status callback and #define for internal eloop timeout). The latter
overwrites the former and as such, the timeout reported ended up going
out with value 5 which matches with GAS_QUERY_CANCELLED instead of
GAS_QUERY_TIMEOUT. This value was not used in existing code, so this
should not modify the current behavior. Anyway, the correct reason for
the failure should be reported. Rename the internal #define for the
timeout period to avoid the name conflict. [Bug 463]

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

11 years agoConvert os_realloc() for an array to use os_realloc_array()
Jouni Malinen [Mon, 13 Aug 2012 18:21:23 +0000 (21:21 +0300)]
Convert os_realloc() for an array to use os_realloc_array()

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

11 years agoAdd os_realloc_array() wrapper
Jouni Malinen [Mon, 13 Aug 2012 18:20:09 +0000 (21:20 +0300)]
Add os_realloc_array() wrapper

This function can be used as a wrapper for os_realloc(ptr, nmemb * size)
when a reallocation is used for an array. The main benefit over
os_realloc() is in having an extra check to catch integer overflows in
multiplication. This is similar to the os_zalloc() to os_calloc() move.

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

11 years agoConvert os_zalloc() for an array to use os_calloc()
Jouni Malinen [Mon, 13 Aug 2012 17:44:21 +0000 (20:44 +0300)]
Convert os_zalloc() for an array to use os_calloc()

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

11 years agoAdd os_calloc() wrapper
Jouni Malinen [Mon, 13 Aug 2012 17:42:24 +0000 (20:42 +0300)]
Add os_calloc() wrapper

This function can be used as a wrapper for os_zalloc(nmemb * size) when
an allocation is used for an array. The main benefit over os_zalloc() is
in having an extra check to catch integer overflows in multiplication.

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

11 years agoFix memcmp use in a test program
Jouni Malinen [Mon, 13 Aug 2012 16:57:57 +0000 (19:57 +0300)]
Fix memcmp use in a test program

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

11 years agoWPS: Fix nonce comparisons
Eyal Shapira [Mon, 13 Aug 2012 16:50:33 +0000 (19:50 +0300)]
WPS: Fix nonce comparisons

Multiple memcmps of nonces were actually comparing only the first byte
instead of all 16 bytes. [Bug 462]

Signed-hostap: Eyal Shapira <eyal@wizery.com>
intended-for: hostap-1

11 years agoRemove default ACM=1 from AC_VO and AC_VI
Jouni Malinen [Sun, 12 Aug 2012 08:36:45 +0000 (11:36 +0300)]
Remove default ACM=1 from AC_VO and AC_VI

There is no need to mandate admission control (ACM=1) by default, so
clear that flag in the case the configuration file does not specify
wmm_ac_{vo,vi}_acm value. This gets closer to the values mentioned
in the sample hostapd.conf file and reduces the need to specify WMM
parameters in the configuration file for most common use cases.

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

11 years agowpa_supplicant AP/P2P: Enable WMM param configuration
Yoni Divinsky [Sun, 12 Aug 2012 08:34:07 +0000 (11:34 +0300)]
wpa_supplicant AP/P2P: Enable WMM param configuration

In case of P2P GO and AP mode, wpa_supplicant uses the default hostapd
parameters for WMM. In the default parameters the ACM bit for video and
voice are set to 1, meaning, P2P devices and stations which are
connected to the GO cannot pass voice or video data packets. Allow this
to be changed through wpa_supplicant configuration file with wmm_ac_*
parameters.

Signed-hostap: Yoni Divinsky <yoni.divinsky@ti.com>

11 years agoMove WMM AC parameter parser into a common file
Yoni Divinsky [Sun, 12 Aug 2012 08:33:00 +0000 (11:33 +0300)]
Move WMM AC parameter parser into a common file

This allows the same implementation to be used for wpa_supplicant, too.

Signed-hostap: Yoni Divinsky <yoni.divinsky@ti.com>

11 years agoP2P: Increase GO Negotiation timeouts
Jouni Malinen [Sat, 11 Aug 2012 18:14:57 +0000 (21:14 +0300)]
P2P: Increase GO Negotiation timeouts

p2p_set_timeout() calls in GO Neg Req/Resp TX callbacks used timeout of
100 ms which is the value given in the P2P specification for GO
Negotiation, but this was actually shorter than the
wait-for-offchannel-TX value (200 ms) used for the driver call. In
addition, it looks like some devices (e.g., Galaxy Nexus with JB image)
can take longer time to reply to GO Negotiation Response (somewhere
between 200 and 250 ms has been observed).

Increase the wait-for-GO-Neg-Resp timeout from 100 ms to 200 ms if GO
Negotiation Request frame was acknowledged (this matches with the
offchannel wait timeout that used previously). The no-ack case is left
at 100 ms since we use GO Negotiation Request frame also to discover
whether the peer is on its Listen channel.

Increase the wait-for-GO-Neg-Conf timeout from 100 ms to 250 ms (and
increase the offchannel wait timeout to matching 250 ms) as a workaround
for devices that take over 200 ms to reply to GO Negotiation Response.

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

11 years agoRemove unnecessary bssid_changed check
Jouni Malinen [Sat, 11 Aug 2012 14:54:43 +0000 (17:54 +0300)]
Remove unnecessary bssid_changed check

The os_memcmp of bssid and wpa_s->bssid cannot return 0 in this
code path since identical os_memcmp was already done above.

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

11 years agoDo not proceed with association if get_bssid() returns failure
Masashi Honma [Sat, 11 Aug 2012 14:46:58 +0000 (17:46 +0300)]
Do not proceed with association if get_bssid() returns failure

This is the normal flow for association:

wpa_supplicant <--(EVENT_ASSOC event )--  device driver
wpa_supplicant  --( get_bssid()      )--> device driver
wpa_supplicant <--( return BSSID     )--  device driver

However, a device driver could return EINVAL for get_bssid() because it
recognizes it has already been disconnected. When the wpa_supplicant
received EINVAL, the bssid field could be used uninitialized in the
following flow:

wpa_supplicant <--(EVENT_ASSOC event )--  device driver
                                          device driver (receive deauth)
wpa_supplicant  --( get_bssid()      )--> device driver
wpa_supplicant <--( return EINVAL    )--  device driver

Prevent this by requiring the get_bssid() call to succeed when
processing association events.

11 years agoSME: Correctly check mode HT caps for enabling OBSS scan
Arik Nemtsov [Sat, 11 Aug 2012 14:08:54 +0000 (17:08 +0300)]
SME: Correctly check mode HT caps for enabling OBSS scan

Don't assume the 11g mode is always first in the list of mode (sometimes
it isn't). Traverse the array of modes and check the HT40 capability is
turned on for 11g.

Signed-hostap: Arik Nemtsov <arik@wizery.com>

11 years agoP2P: Move group removal reason to a function parameter
Jouni Malinen [Sat, 11 Aug 2012 09:41:31 +0000 (12:41 +0300)]
P2P: Move group removal reason to a function parameter

wpa_s->removal_reason was set only when calling wpas_p2p_group_delete()
and while couple of call places did not set this, it should really be
set in each case. As such, it works better as a function parameter than
a variable in struct wpa_supplicant.

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

11 years agoP2P: p2p_group_remove should fail on non-P2P interface
Michael Naumov [Sat, 11 Aug 2012 09:06:23 +0000 (12:06 +0300)]
P2P: p2p_group_remove should fail on non-P2P interface

p2p_group_remove should only attempt to remove P2P group
interfaces and fail on non-P2P group interfaces.

Signed-hostap: Michael Naumov <michael.naumov@intel.com>
Signed-hostap: Nirav Shah <nirav.j2.shah@intel.com>

11 years agoAP: Fix erroneous "station tried TKIP" error
Christian Lamparter [Sat, 11 Aug 2012 07:53:03 +0000 (10:53 +0300)]
AP: Fix erroneous "station tried TKIP" error

The commit b5fd8b18335f2a7784a1f0a5eb5dbe45976d9e21
"VHT: Do not allow use of TKIP with VHT" introduced
an off-by-one regression: a WPA/RSN 11n AP would no
longer accept stations to connect, instead it would
produce a bogus error message:
... Station tried to use TKIP with HT association.

Signed-hostapd: Christian Lamparter <chunkeey@googlemail.com>

11 years agoVHT: Add configuration of operating center frequency
Mahesh Palivela [Fri, 10 Aug 2012 16:54:54 +0000 (19:54 +0300)]
VHT: Add configuration of operating center frequency

Signed-hostap: Mahesh Palivela <maheshp@posedge.com>

11 years agoVHT: Add option for requiring use of VHT
Mahesh Palivela [Fri, 10 Aug 2012 16:53:24 +0000 (19:53 +0300)]
VHT: Add option for requiring use of VHT

Signed-hostap: Mahesh Palivela <maheshp@posedge.com>

11 years agoVHT: Add VHT elements into (Re)Association Response
Mahesh Palivela [Fri, 10 Aug 2012 16:51:17 +0000 (19:51 +0300)]
VHT: Add VHT elements into (Re)Association Response

Signed-hostap: Mahesh Palivela <maheshp@posedge.com>

11 years agoVHT: Do not allow use of TKIP with VHT
Mahesh Palivela [Fri, 10 Aug 2012 16:50:37 +0000 (19:50 +0300)]
VHT: Do not allow use of TKIP with VHT

Signed-hostap: Mahesh Palivela <maheshp@posedge.com>

11 years agoVHT: Store VHT capabilities and manage VHT flag for STAs
Mahesh Palivela [Fri, 10 Aug 2012 16:49:18 +0000 (19:49 +0300)]
VHT: Store VHT capabilities and manage VHT flag for STAs

Signed-hostap: Mahesh Palivela <maheshp@posedge.com>

11 years agoVHT: Document vht_oper_chwidth and fix indentation
Mahesh Palivela [Fri, 10 Aug 2012 16:44:16 +0000 (19:44 +0300)]
VHT: Document vht_oper_chwidth and fix indentation

Signed-hostap: Mahesh Palivela <maheshp@posedge.com>

11 years agoVHT: Include VHT capabilities and operation elements in parsing
Mahesh Palivela [Fri, 10 Aug 2012 16:39:43 +0000 (19:39 +0300)]
VHT: Include VHT capabilities and operation elements in parsing

Signed-hostap: Mahesh Palivela <maheshp@posedge.com>

11 years agoReplace non-ASCII characters with ASCII characters
Jouni Malinen [Fri, 10 Aug 2012 16:32:15 +0000 (19:32 +0300)]
Replace non-ASCII characters with ASCII characters

There is no point to use non-ASCII characters in this file when
perfectly fine ASCII characters are available..

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

11 years agoPMKSA: Set cur_pmksa pointer during initial association
Jouni Malinen [Fri, 10 Aug 2012 15:05:03 +0000 (18:05 +0300)]
PMKSA: Set cur_pmksa pointer during initial association

cur_pmksa was left to NULL during the initial association. This can
result in unexpected behavior, e.g., in expiring PMKSA cache entries
since the current entry is not locked in that case. Fix this by updated
cur_pmksa when adding the initial PMKSA entry during msg 1/4 processing.

Signed-hostap: Jouni Malinen <j@w1.fi>
intended-for: hostap-1

11 years agoPMKSA: Do not evict active cache entry when adding new ones
Dan Williams [Fri, 10 Aug 2012 14:55:17 +0000 (17:55 +0300)]
PMKSA: Do not evict active cache entry when adding new ones

If the PMKSA cache is full (i.e., 32 candidates have been seen in scan
results and have not yet expired) then any additional entries can
potentially evict the current/active entry (if it is the oldest entry),
which triggers a pointless local deauthentication. The supplicant
shouldn't replace the current/active entry if it is still valid, but
instead the oldest entry that is *not* the current/active one.

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

11 years agoFix WPA GTK rekeying with multiple VLANs
Michael Braun [Fri, 10 Aug 2012 13:48:35 +0000 (16:48 +0300)]
Fix WPA GTK rekeying with multiple VLANs

When using multiple VLANs, GKeyDoneStations counter is not updated
properly since wpa_auth_for_each_sta() call in wpa_group_setkeys() ends
up iterating through all STAs and not just the STAs of a specific
wpa_group (VLAN). Consequently, GTK rekeying gets initialized multiple
times if more than a single group state machine exists. Fix this by
iterating only through the STAs in the specific wpa_group.

Signed-hostap: Michael Braun <michael-dev@fami-braun.de>
intended-for: hostap-1

11 years agoAdd p2p_go_max_inactivity config option
Eyal Shapira [Fri, 10 Aug 2012 13:28:38 +0000 (16:28 +0300)]
Add p2p_go_max_inactivity config option

This enables setting a different max inactivity timeout for P2P GO.
This timeout is used to detect inactive clients. In some scenarios
it may be useful to have control over this and set a shorter timeout
than the default 300s. For example when running STA and P2P GO interfaces
concurrently, the STA interface may perform scans which may cause the
GO to miss a disassoc / deauth frames from a client and keep assuming
that the client is connected until the inactivity detection kicks in.
300 secs is a bit too long for such scenarios and creates a bad user
experience.

Signed-hostap: Eyal Shapira <eyal@wizery.com>

11 years agoAdd option to use netlink to create and remove VLAN interfaces
Michael Braun [Fri, 10 Aug 2012 09:55:33 +0000 (12:55 +0300)]
Add option to use netlink to create and remove VLAN interfaces

CONFIG_VLAN_NETLINK=y build option can now be used to replace the
ioctl()-based interface for creating and removing VLAN interfaces
with netlink-based interface.

Signed-hostap: M. Braun <michael-dev@fami-braun.de>

11 years agoAdd hostapd configuration option to set VLAN naming scheme
Michael Braun [Fri, 10 Aug 2012 09:38:17 +0000 (12:38 +0300)]
Add hostapd configuration option to set VLAN naming scheme

Signed-hostap: M. Braun <michael-dev@fami-braun.de>

11 years agonl80211: Fix re-enabling of 802.11b rates after P2P use
Jouni Malinen [Fri, 10 Aug 2012 08:48:57 +0000 (11:48 +0300)]
nl80211: Fix re-enabling of 802.11b rates after P2P use

Commit a11241fa114923b47892ad3279966839e9c2741d removed the 802.11b rate
enabling/disabling code from wpa_driver_nl80211_set_mode() and while
doing that, removed the only place where drv->disabled_11b_rates was
set. Fix this by updating the flag in nl80211_disable_11b_rates(). In
addition, re-enable the 802.11b rates when changing to non-P2P mode.

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

11 years agonl80211: Disable 11b rates on configuring P2P interface
Rajkumar Manoharan [Fri, 10 Aug 2012 08:35:33 +0000 (11:35 +0300)]
nl80211: Disable 11b rates on configuring P2P interface

Right now 11b rates are masked out while creating a P2P interface,
but this is always failing as the interface is down. Most drivers
allow to configure rates only when the interface is UP and running.
So let us disable 11b rates when interface type is changed into a
P2P type and it is UP and running.

Signed-hostap: Rajkumar Manoharan <rmanohar@qca.qualcomm.com>

11 years agoSync with linux/nl80211.h in wireless-testing.git
Jouni Malinen [Fri, 10 Aug 2012 08:21:16 +0000 (11:21 +0300)]
Sync with linux/nl80211.h in wireless-testing.git

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