mech_eap.git
12 years agowpa_cli: Correct return value of wpa_cli_cmd_p2p_peers
David Spinadel [Thu, 24 Nov 2011 19:19:52 +0000 (21:19 +0200)]
wpa_cli: Correct return value of wpa_cli_cmd_p2p_peers

Signed-off-by: David Spinadel <david.spinadel@intel.com>
12 years agoAdd test program for RC4 (test vectors from RFC 6229)
Jouni Malinen [Thu, 24 Nov 2011 18:54:20 +0000 (20:54 +0200)]
Add test program for RC4 (test vectors from RFC 6229)

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

12 years agoAndroid: Move WPA_BUILD check in Android.mk
Dmitry Shmidt [Wed, 23 Nov 2011 15:58:44 +0000 (17:58 +0200)]
Android: Move WPA_BUILD check in Android.mk

This is part of commit e61a2d6db6113da5fad91660764afdb0596dbc46 from
Android wpa_supplicant_8.git.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
12 years agoAndroid: Remove the simulator target from all makefiles
Jeff Brown [Wed, 23 Nov 2011 15:56:41 +0000 (17:56 +0200)]
Android: Remove the simulator target from all makefiles

This is commit bbda627478b0e9a312fea4662cd7cd8d6bdf82bf from
Android wpa_supplicant_8.git.

12 years agoMove wpa_sm_remove_pmkid() call to PMKSA cache entry freeing
Jouni Malinen [Sun, 20 Nov 2011 10:53:29 +0000 (12:53 +0200)]
Move wpa_sm_remove_pmkid() call to PMKSA cache entry freeing

This makes it clearer that the PMKSA caching entry gets removed from
the driver regardless of how the internal entry from wpa_supplicant
gets cleared. In practice, this call was skipped only for the case
when the entry for the current AP was being updated, so the previous
version was likely to work with all drivers. Anyway, it is cleaner
to explicitly remove the old entry even in that case before the new
entry gets added.

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

12 years agoFix wired EAPOL authenticator
Jouni Malinen [Sun, 20 Nov 2011 10:42:47 +0000 (12:42 +0200)]
Fix wired EAPOL authenticator

Commit 940a0ce9702095bb079bd97857a2605516f83157 moved the STA associated
check from driver_*.c into ieee802_1x_receive(), but failed to take into
account that wired networks and driver_wired.c do not mark the STA entry
associated. Fix this by skipping the check if the driver wrapper is
using a wired network.

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

12 years agoAvoid possible compiler warning in os_gmtime()
Jouni Malinen [Sun, 20 Nov 2011 10:19:28 +0000 (12:19 +0200)]
Avoid possible compiler warning in os_gmtime()

Use time_t instead of os_time_t variable with the gmtime() call to
avoid possible compiler warnings.

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

12 years agowpa_gui-qt4: Improve scan results signal display
Kel Modderman [Sat, 19 Nov 2011 18:10:37 +0000 (20:10 +0200)]
wpa_gui-qt4: Improve scan results signal display

Display signal strength in dBm with visual indicator in the form of a
bar for scan results displayed by wpa_gui-qt4. Any signal > -35dBm is
treated as full signal bar, signals between range of -95<->-35dBm are
displayed linearly. Convert WEXT signal level value to scale that
nl80211 typically reports in dBm. The condition which differentiates
8-bit WEXT dBm and regular dBm is probably fragile, but there is
currently no way to know what the driver is going to report for signal
strength.

Signed-off-by: Kel Modderman <kel@otaku42.de>
12 years agonl80211: Set offchannel-OK selectively
Johannes Berg [Sat, 19 Nov 2011 17:56:34 +0000 (19:56 +0200)]
nl80211: Set offchannel-OK selectively

It's not really valid to send off-channel in all cases,
so pass whether it should be allowed or not and don't
set it in the AP case.

Also, to get the right ifindex for hostapd, pass a bss
pointer instead of the drv pointer.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agonl80211: Move preq NL handle into BSS
Johannes Berg [Sat, 19 Nov 2011 17:48:49 +0000 (19:48 +0200)]
nl80211: Move preq NL handle into BSS

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agonl80211: Add no_ack support for NL80211_CMD_FRAME
Jouni Malinen [Sat, 19 Nov 2011 17:32:05 +0000 (19:32 +0200)]
nl80211: Add no_ack support for NL80211_CMD_FRAME

This is needed to allow no-ACK operation with Probe Response frames
in P2P Listen state.

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

12 years agonl80211: Implement noack policy for send_mlme
Helmut Schaa [Sat, 19 Nov 2011 17:22:13 +0000 (19:22 +0200)]
nl80211: Implement noack policy for send_mlme

Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>

12 years agoP2P: Send Listen state Probe Response frames without retries
Jouni Malinen [Sat, 19 Nov 2011 17:15:10 +0000 (19:15 +0200)]
P2P: Send Listen state Probe Response frames without retries

Use the no-ACK send_mlme request to transmit Probe Response frames
in P2P Listen state. This reduces number of unnecessary transmissions
if the peer device has already moved away from the channel. It will most
likely go through Search state multiple times anyway, so even if the
response were to be lost, a new retry will happen at higher layer.

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

12 years agoAvoid excessive probe response retries
Helmut Schaa [Sat, 19 Nov 2011 17:09:49 +0000 (19:09 +0200)]
Avoid excessive probe response retries

Some client implementations only wait a few ms after sending a probe
request while scanning. Since probe responses are always sent at a low
rate this can eat quite some airtime and it might be impossible to get
the frame out before the client leaves the channel again. If the client
leaves before all probe reponses where acked this can cause the probe
reponse to be retried quite often consuming even more airtime.

Hence, add a new noack flag to the driver's send_mlme callback that
allows hostapd to request whether the driver should expect an ACK for
this frame or not.

Use the new noack-policy only for broadcast probe requests that contain
a wildcard SSID.

Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>

12 years agoAllow MLME frames to be sent without expecting an ACK (no retries)
Helmut Schaa [Sat, 19 Nov 2011 17:02:05 +0000 (19:02 +0200)]
Allow MLME frames to be sent without expecting an ACK (no retries)

In some situations it might be benefical to send a unicast frame without
the need for getting it ACKed (probe responses for example). In order to
achieve this add a new noack parameter to the drivers send_mlme callback
that can be used to advise the driver to not wait for an ACK for this
frame.

Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>

12 years agoDo not try to add wildcard SSID into active sched_scan
Jouni Malinen [Sat, 19 Nov 2011 15:01:53 +0000 (17:01 +0200)]
Do not try to add wildcard SSID into active sched_scan

Even though scan_ssid should not really be set for wildcard SSID,
better verify that here explicitly insead of assuming that the
SSID is set.

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

12 years agoEAP-pwd: Remove struct eap_pwd_hdr
Jouni Malinen [Sat, 19 Nov 2011 14:52:52 +0000 (16:52 +0200)]
EAP-pwd: Remove struct eap_pwd_hdr

This structure was not really used for anything apart from figuring out
length of the EAP-pwd header (and even that in a way that would not work
with fragmentation). Since the bitfields in the structure could have
been problematic depending on target endianness, remove this unnecessary
structure.

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

12 years agoEAP-pwd: Fix zero-padding of input to H()
Dan Harkins [Sat, 19 Nov 2011 14:47:25 +0000 (16:47 +0200)]
EAP-pwd: Fix zero-padding of input to H()

Another niceness of OpenSSL is that if the high-order bit of a 521-bit
big num is not set then BN_bn2bin() will just return 65 bytes instead of
66 bytes with the 1st (big endian, after all) being all zero. When this
happens the wrong number of octets are mixed into function H(). So
there's a whole bunch of "offset" computations and BN_bn2bin() dumps the
big number into a buffer + offset. That should be obvious in the patch
too.

12 years agoEAP-pwd: Fix KDF for group 21
Dan Harkins [Sat, 19 Nov 2011 14:43:49 +0000 (16:43 +0200)]
EAP-pwd: Fix KDF for group 21

The previous EAP-pwd KDF implemented has an issue with group 21, that is
an elliptic curve group based on a 521 bit prime. 521 is not an even
multiple of 8, and therein lies the problem.

OpenSSL's BN library interprets a string of bits as in big-endian format
so all the calls of BN_bin2bn() will take the binary blob of bits and
turn it into a big number in big-endian format. In the EAP-pwd KDF, I am
stretching the key to "primebitlen". When that is not an even multiple
of 8 I have to mask off the excess. But I was masking off the excess
bits in the 1st octet (big endian after all) but that isn't right. The
KDF produces a string of endian-less bits. The 521st bit is the first
bit in the last octet, not the 7th bit in the first octet. So that has
been fixed and you can see in the attached diff what I'm doing.

12 years agoEAP-pwd: Document group configuration for hostapd authentication server
Dan Harkins [Sat, 19 Nov 2011 14:32:21 +0000 (16:32 +0200)]
EAP-pwd: Document group configuration for hostapd authentication server

12 years agonl80211: Support in-kernel station poll
Johannes Berg [Sat, 19 Nov 2011 12:23:46 +0000 (14:23 +0200)]
nl80211: Support in-kernel station poll

If the kernel supports this, don't use manual null
data frame transmissions. This is one thing to get
rid of cooked monitor interfaces.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agonl80211: Use non-receiving socket for EAPOL TX
Johannes Berg [Sat, 19 Nov 2011 12:00:53 +0000 (14:00 +0200)]
nl80211: Use non-receiving socket for EAPOL TX

The non-monitor TX currently uses a normal L2 abstraction
socket, but that will also receive frames we don't want,
so use a plain socket that isn't bound for RX. This might
be possible using the L2 abstraction, but we need a plain
socket later for getting TX status events here.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agonl80211: Use device AP SME capability
Johannes Berg [Sat, 19 Nov 2011 11:42:49 +0000 (13:42 +0200)]
nl80211: Use device AP SME capability

This changes the auto-detection of whether or not the device contains
the AP SME away from monitor interface addition failing to the explicit
attribute in nl80211. Keep the old auto-detection for a little while so
that ath6kl isn't broken right away.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agonl80211: Sync with wireless-testing.git linux/nl80211.h
Jouni Malinen [Sat, 19 Nov 2011 11:40:07 +0000 (13:40 +0200)]
nl80211: Sync with wireless-testing.git linux/nl80211.h

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

12 years agoAP: Add explicit EAPOL TX status event
Johannes Berg [Sat, 19 Nov 2011 11:00:30 +0000 (13:00 +0200)]
AP: Add explicit EAPOL TX status event

The new event can be used when EAPOL TX status can't be reported as a
complete 802.11 frame but is instead reported as just the EAPOL data as
originally passed to hapd_send_eapol().

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agoOpenSSL: Read certificate chain from server_cert file
Maciej Szmigiero [Sat, 19 Nov 2011 10:06:59 +0000 (12:06 +0200)]
OpenSSL: Read certificate chain from server_cert file

Currently OpenSSL implementation of TLS in hostapd loads only top
certificate in server certificate file. Change this to try to the
whole chain first and only if that fails, revert to old behavior.

Signed-off-by: Maciej Szmigiero <mhej@o2.pl>
12 years agowpa_supplicant: Make objects depend on the .config file
Alan T. DeKok [Sat, 19 Nov 2011 09:46:39 +0000 (11:46 +0200)]
wpa_supplicant: Make objects depend on the .config file

The source code compiles into different objects depending on
the contents of .config. Therefore, the objects should depend
on .config.

Previously, only the executables depended on .config. This meant
that they were re-linked when .config changed. But that relink
process used the old (and now wrong) objects.

12 years agonl80211: Implement shared_freq
Jithu Jance [Sat, 19 Nov 2011 09:23:49 +0000 (11:23 +0200)]
nl80211: Implement shared_freq

This patch implements shared_freq handler for driver_nl80211.c. If a
"p2p_group_add" happens after legacy STA association, then this patch
will help to start the GO on the same frequency. This is useful when
supplicant is started on multiple interface running over a singly "PHY"
and the station interface is not used for the P2P device operations.

For example, wpa_supplicant -iwlan0 ..  -N -iwlan1 ... and wlan0 is used
for station connection and wlan1 as the P2P device interface.

Signed-hostap: Jithu Jance <jithu@broadcom.com>

12 years agonl80211: Make MLME failure messages unique
Ben Greear [Fri, 18 Nov 2011 21:41:52 +0000 (23:41 +0200)]
nl80211: Make MLME failure messages unique

Without this, it is impossible to tell exactly which
MLME code returned the error.

Also, convert to wpa_dbg so that we get device names
in the messages.

Signed-hostap: Ben Greear <greearb@candelatech.com>

12 years agoP2P: Clear WPS method when GO negotiation fails
Johannes Berg [Fri, 18 Nov 2011 21:34:53 +0000 (23:34 +0200)]
P2P: Clear WPS method when GO negotiation fails

When GO negotation fails the WPS method is currently not cleared, which
can result in GO negotiation being resumed when a GO negotiation request
frame is received from the peer. That is unexpected as locally we
already gave up.

This manifests itself in getting

1319574733.955685: wlan0: P2P-GO-NEG-FAILURE status=-1
1319574733.955723: P2P: Removing pending group interface p2p-wlan0-0
...
1319574736.648378: wlan0: P2P: Starting GO Negotiation with previously
authorized peer
...
1319574736.650115: wlan0: P2P: Sending GO Negotiation Response
...
1319574736.988038: wlan0: P2P-GO-NEG-SUCCESS
1319574736.988233: P2P: No pending group interface
1319574736.988268: P2P: Create a new interface p2p-wlan0-1 for the group

Clear the WPS method to avoid this situation. I wasn't
able to test this though, but given the log I can only
assume this is how the situation happened.

Reported-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agoP2P: Simplify code in wpas_p2p_connect()
Johannes Berg [Fri, 18 Nov 2011 21:32:03 +0000 (23:32 +0200)]
P2P: Simplify code in wpas_p2p_connect()

There's some duplicated code there that can be simplified
with just a single new variable.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agonl80211: Fix UNSPEC signal quality reporting
Dan Williams [Fri, 18 Nov 2011 21:23:45 +0000 (23:23 +0200)]
nl80211: Fix UNSPEC signal quality reporting

r->level got assigned so it's clearly not INVALID; instead
r->qual should be invalid.

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

12 years agoP2P: Indicate GO Negotiation failure on peer expiration
Jithu Jance [Fri, 18 Nov 2011 21:13:03 +0000 (23:13 +0200)]
P2P: Indicate GO Negotiation failure on peer expiration

If P2P device expires while a GO Negotiation is in progress, currently
p2p->go_neg_peer is cleared without indicating GO Nego failure. This
will result in pending group interfaces to be left over. This patch will
indicate GO Negotiation failure and will remove any pending group
interfaces.

This patch addresses a corner case in GO-Negotiation case. Consider the
scenario where two devices A and B are in discovery stage and Device B
vanishes [moves out of range] when a connect is issued on the Device A.
Then Device A keeps on retrying the GO Negotiation Request till the
retry limit is reached. On reaching retry limit, the pending group
interface is removed. But suppose if the peer entry in the device list
expires before the retry limit is reached, then pending group interface
was not removed.

Signed-off-by: Jithu Jance <jithu@broadcom.com>
12 years agosched scan: Fix passive scanning
Eyal Shapira [Fri, 18 Nov 2011 21:05:57 +0000 (23:05 +0200)]
sched scan: Fix passive scanning

Scan wasn't initiated in case the config contained only networks without
scan_ssid. In such a case we want scan to be initiated without any SSIDs
to actively scan but include all the SSIDs in the filter list. Also
added some debug logs to easily see which SSIDs were included in which
list.

Cc: Luciano Coelho <coelho@ti.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
12 years agoUse NULL instead of 0 for pointers
Jouni Malinen [Fri, 18 Nov 2011 20:07:30 +0000 (22:07 +0200)]
Use NULL instead of 0 for pointers

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

12 years agoP2P: Fix collection of member-in-group information for peer entries
Jouni Malinen [Fri, 18 Nov 2011 19:58:18 +0000 (21:58 +0200)]
P2P: Fix collection of member-in-group information for peer entries

Invalid use of memcpy instead of memcmp in comparison resulted in the
GO interface address getting set incorrectly if the GO did not show up
in scan results anymore.

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

12 years agoMark local functions static
Jouni Malinen [Fri, 18 Nov 2011 19:53:36 +0000 (21:53 +0200)]
Mark local functions static

These functions are not used outside the file in which they are defined.

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

12 years agoInclude wpa_auth_glue.h to verify function prototypes
Jouni Malinen [Fri, 18 Nov 2011 19:53:03 +0000 (21:53 +0200)]
Include wpa_auth_glue.h to verify function prototypes

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

12 years agoInclude list.h after trace.h to avoid offsetof refinition
Jouni Malinen [Fri, 18 Nov 2011 19:43:43 +0000 (21:43 +0200)]
Include list.h after trace.h to avoid offsetof refinition

trace.h may end up including system header files that define offsetof,
so include the compatibility definition from list.h only after this.

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

12 years agoInclude wpa_supplicant_i.h to verify function prototype match
Jouni Malinen [Fri, 18 Nov 2011 19:41:37 +0000 (21:41 +0200)]
Include wpa_supplicant_i.h to verify function prototype match

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

12 years agoRemove incorrect le16 type cast
Jouni Malinen [Fri, 18 Nov 2011 19:39:10 +0000 (21:39 +0200)]
Remove incorrect le16 type cast

HT_INFO_OPERATION_MODE_OP_MODE_MASK is used with variables in host
byte order, so it should not be claimed as le16.

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

12 years agoFix the debug message in the previous commit
Jouni Malinen [Thu, 17 Nov 2011 21:05:19 +0000 (23:05 +0200)]
Fix the debug message in the previous commit

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

12 years agoSet Secure=1 for EAPOL-Key msg 3/4 in WPA conditional on 2/4
Jouni Malinen [Thu, 17 Nov 2011 20:59:31 +0000 (22:59 +0200)]
Set Secure=1 for EAPOL-Key msg 3/4 in WPA conditional on 2/4

This is a workaround for Windows 7 supplicant rejecting WPA msg 3/4
in case it used Secure=1 in msg 2/4. This can happen, e.g., when
rekeying PTK after EAPOL-Key Error Request (Michael MIC failure)
from the supplicant.

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

12 years agoUse a single define for maximum number of EAP methods
Jouni Malinen [Thu, 17 Nov 2011 18:06:33 +0000 (20:06 +0200)]
Use a single define for maximum number of EAP methods

This cleans up the code a bit by not having to deal with theoretical
possibility of maximum number of EAP methods to be different between
various components in hostapd.

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

12 years agoRemove unused header file inclusion
Jouni Malinen [Thu, 17 Nov 2011 18:01:19 +0000 (20:01 +0200)]
Remove unused header file inclusion

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

12 years agoWPS: Use strdup to initialize dev_password for PBC
Jouni Malinen [Thu, 17 Nov 2011 17:58:33 +0000 (19:58 +0200)]
WPS: Use strdup to initialize dev_password for PBC

Some static analyzers complain about memset with '0' value. This was
used correctly here, but since use of strdup is about as good an option,
use that to silence the invalid warnings.

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

12 years agoAvoid 0-length memmove from buffer end to keep static analyzers happier
Jouni Malinen [Thu, 17 Nov 2011 17:54:26 +0000 (19:54 +0200)]
Avoid 0-length memmove from buffer end to keep static analyzers happier

This avoid incorrect errors from some static analyzers that do not like
memmove with pointers just after the end of a buffer even if the number
of bytes to move is zero.

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

12 years agoP2P: Cancel previous operation before starting new p2p_listen
Jouni Malinen [Thu, 17 Nov 2011 14:21:11 +0000 (16:21 +0200)]
P2P: Cancel previous operation before starting new p2p_listen

Some drivers do not handle concurrent remain-on-channel operation
requests, so run p2p_stop_find() prior to starting p2p_listen. This
addresses some issues with P2P_LISTEN command being issues again
while already in Listen state.

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

12 years agoRemove obsolete build tests
Jouni Malinen [Thu, 17 Nov 2011 11:41:54 +0000 (13:41 +0200)]
Remove obsolete build tests

These have not been updated for years and do not really work
anymore.

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

12 years agonl80211: Get rid of family/cache objects
Johannes Berg [Wed, 16 Nov 2011 14:42:49 +0000 (16:42 +0200)]
nl80211: Get rid of family/cache objects

All we really need is the family ID, and we can
get that with genl_ctrl_resolve() and then don't
need to worry about family/cache objects.

Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agoP2P: Deal with a peer associating while connected
Johannes Berg [Wed, 16 Nov 2011 14:36:40 +0000 (16:36 +0200)]
P2P: Deal with a peer associating while connected

If a P2P client associates with the group while it is
already associated, two member entries may be added to
the group which also confuses num_members counting.

Deal with this by removing the existing entry first
before adding a new one.

I think the way Reinette ran into this was due to our
tx_sync implementation in iwlagn, mac80211 might have
queued two association frames thinking the first one
just failed, but both only went out after the sync was
really successful (which tx_sync doesn't wait for).

Reported-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-hostap: Johannes Berg <johannes.berg@intel.com>

12 years agowpa_supplicant: Set configured auth_algs for AP mode
Vasanthakumar Thiagarajan [Wed, 16 Nov 2011 14:30:36 +0000 (16:30 +0200)]
wpa_supplicant: Set configured auth_algs for AP mode

In AP mode, authentication algorithm is reset in
hostapd_config_defaults_bss() and never set to the configured one. This
would pass the default auth_algs (OPEN|SHARED) to driver regardless of
what the wpa_supplicant configuration is requesting.

Signed-off-by: Vasanthakumar Thiagarajan <vthiagar@qca.qualcomm.com>
12 years agoP2P: Wait until ongoing scan completes before starting P2P find
Jouni Malinen [Tue, 15 Nov 2011 19:25:21 +0000 (21:25 +0200)]
P2P: Wait until ongoing scan completes before starting P2P find

The P2P_FIND command was failing if it was issued at the moment when
a scan operation was in progress. Avoid returning failure in this
case by scheduling the P2P find to start once the ongoing scan is
completed.

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

12 years agoWEXT: Use linux/wireless.h instead of wireless_copy.h
Jouni Malinen [Tue, 15 Nov 2011 18:03:00 +0000 (20:03 +0200)]
WEXT: Use linux/wireless.h instead of wireless_copy.h

WEXT is not really changing anymore and more or less all Linux
distros come with linux/wireless.h that is recent enough to
allow the driver wrappers to be build.

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

12 years agoAndroid: Update libnl use to match with Android ICS
Jouni Malinen [Tue, 15 Nov 2011 16:37:10 +0000 (18:37 +0200)]
Android: Update libnl use to match with Android ICS

The libnl_2 library uses static linking and different path for
header files in the Android ICS release.

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

12 years agoAndroid: Fix D-Bus P2P interface location in Android.mk
Jouni Malinen [Tue, 15 Nov 2011 16:35:58 +0000 (18:35 +0200)]
Android: Fix D-Bus P2P interface location in Android.mk

This was supposed to be in the new D-Bus interface block, not in
the old one.

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

12 years agoAndroid: Fix hostapd_cli build
Jouni Malinen [Tue, 15 Nov 2011 16:34:57 +0000 (18:34 +0200)]
Android: Fix hostapd_cli build

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

12 years agoAndroid: Fix hostapd build
Jouni Malinen [Tue, 15 Nov 2011 16:34:09 +0000 (18:34 +0200)]
Android: Fix hostapd build

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

12 years agowlantest: Fix handling of PTK rekeying
Jouni Malinen [Mon, 14 Nov 2011 20:33:26 +0000 (22:33 +0200)]
wlantest: Fix handling of PTK rekeying

Use a temporary PTK buffer during 4-way handshake when rekeying PTK
so that the new EAPOL-Key frame MIC values are checked against the
new PTK and frames are decrypted using the old PTK. Take the new
PTK into use once msg 4/4 is processed and clear RSC counters at
that point (including moving of RSC update to avoid setting RSC
based on the msg 4/4).

In addition, add a workaround to handle supplicant implementations that
set Secure bit to one during PTK rekeying 4-way handshake in msg 2/4.
This was previously assumed to be msg 4/4, but the key data contents
can be used to figure out whether this is msg 2/4 even if the Secure
bit is set to one.

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

12 years agoDo not add P2P IE into Beacon/Probe Response if P2P is disabled
Jouni Malinen [Mon, 14 Nov 2011 14:26:45 +0000 (16:26 +0200)]
Do not add P2P IE into Beacon/Probe Response if P2P is disabled

P2P IE was incorrectly added in wpa_supplicant AP mode even if P2P
function was not actually enabled.

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

12 years agoAP: Only enable WPS for open and WPA/WPA2-Personal configuration
Jouni Malinen [Mon, 14 Nov 2011 14:16:29 +0000 (16:16 +0200)]
AP: Only enable WPS for open and WPA/WPA2-Personal configuration

When wpa_supplicant AP mode is used, WPS was enabled by default
regardless of security mode. This is not desired for WEP, so change
the AP configuration to enable WPS only for open and WPA/WPA2-Personal
networks.

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

12 years agoFix P2P IE configuration for GO mode
Jouni Malinen [Mon, 14 Nov 2011 14:10:54 +0000 (16:10 +0200)]
Fix P2P IE configuration for GO mode

Commit c2ff13c533306ac06f08fd03fca9e04cc994cabd broke this with a
copy-paste typo that ended up adding the Probe Request P2P IE into the
Beacon frame (i.e., Beacon frame had two P2P IEs while Probe Response
had none).

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

12 years agoMake crypto_hash_init() easier for static analyzers
Jouni Malinen [Sun, 13 Nov 2011 21:24:08 +0000 (23:24 +0200)]
Make crypto_hash_init() easier for static analyzers

Avoid zero-length memset at the end of the buffer. This is not really
needed, but it makes the code a bit easier for static analyzers.

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

12 years agoMake crypto_hash_init() easier for static analyzers
Jouni Malinen [Sun, 13 Nov 2011 21:19:19 +0000 (23:19 +0200)]
Make crypto_hash_init() easier for static analyzers

Avoid zero-length memset at the end of the buffer. This is not really
needed, but it makes the code a bit easier for static analyzers.

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

12 years agoMake radius_msg_add_attr_user_password() easier for static analyzers
Jouni Malinen [Sun, 13 Nov 2011 21:14:57 +0000 (23:14 +0200)]
Make radius_msg_add_attr_user_password() easier for static analyzers

Explicitly validate data_len so that static analyzers do not get
confused about the padlen validation. This is not really needed, but it
makes the code a bit easier for static analyzers.

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

12 years agoMake fips186_2_prf() easier for static analyzers
Jouni Malinen [Sun, 13 Nov 2011 20:59:33 +0000 (22:59 +0200)]
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.

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

12 years agoMake phase2_method initialization easier for static analyzers
Jouni Malinen [Sun, 13 Nov 2011 20:47:14 +0000 (22:47 +0200)]
Make phase2_method initialization easier for static analyzers

data->phase2_method cannot really be NULL if
eap_fast_init_phase2_method() returns success, but this construction
seems to be too difficult for some static analyzers. While this change
is not really needed in practice, it makes it easier to go through
warnings from such analyzers.

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

12 years agoMake time_adv use easier for static analyzers
Jouni Malinen [Sun, 13 Nov 2011 20:45:16 +0000 (22:45 +0200)]
Make time_adv use easier for static analyzers

hapd->time_adv cannot really be NULL if hostapd_update_time_adv()
returns success, but this construction seems to be too difficult
for some static analyzers. While this change is not really needed
in practice, it makes it easier to go through warnings from such
analyzers.

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

12 years agonl80211: Verify that global driver pointer is not NULL
Jouni Malinen [Sun, 13 Nov 2011 20:39:57 +0000 (22:39 +0200)]
nl80211: Verify that global driver pointer is not NULL

driver_nl80211.c assumes that global driver pointer is set, so better
make this more consistent.

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

12 years agoP2P: Verify that assoc req IEs are available for group update
Jouni Malinen [Sun, 13 Nov 2011 20:33:32 +0000 (22:33 +0200)]
P2P: Verify that assoc req IEs are available for group update

Do not call p2p_group_notif_assoc() if the driver did not return
IEs from the association request.

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

12 years agoRemove unnecessary include file inclusion
Jouni Malinen [Sun, 13 Nov 2011 20:13:04 +0000 (22:13 +0200)]
Remove unnecessary include file inclusion

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

12 years agoUse shared SHA-256 define for the block size
Jouni Malinen [Sun, 13 Nov 2011 19:43:31 +0000 (21:43 +0200)]
Use shared SHA-256 define for the block size

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

12 years agoMake sha256_process() easier for static analyzers
Jouni Malinen [Sun, 13 Nov 2011 19:36:23 +0000 (21:36 +0200)]
Make sha256_process() easier for static analyzers

md->curlen cannot indicate full buffer size here since the buffered
data is processed whenever the full block size of data is available.
Avoid invalid warnings from static analyzers on memcpy() outside the
buffer length by verifying that curlen is smaller than block size.

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

12 years agoTLS: Fix double-free on error path
Jouni Malinen [Sun, 13 Nov 2011 18:57:32 +0000 (20:57 +0200)]
TLS: Fix double-free on error path

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

12 years agodbus: Remove unused default string for bridge_ifname
Jouni Malinen [Sun, 13 Nov 2011 18:54:44 +0000 (20:54 +0200)]
dbus: Remove unused default string for bridge_ifname

wpa_s->bridge_ifname is an array and cannot be NULL.

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

12 years agoAdd REAUTHENTICATE ctrl_iface command
Jouni Malinen [Sun, 13 Nov 2011 17:47:51 +0000 (19:47 +0200)]
Add REAUTHENTICATE ctrl_iface command

This can be used to trigger EAPOL reauthentication which can be useful
for testing purposes.

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

12 years agoUse a pre-processor macro to simplify event_to_string()
Jouni Malinen [Sun, 13 Nov 2011 17:06:37 +0000 (19:06 +0200)]
Use a pre-processor macro to simplify event_to_string()

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

12 years agoPrint human readable driver event names
Ben Greear [Sun, 13 Nov 2011 17:01:38 +0000 (19:01 +0200)]
Print human readable driver event names

This makes it easier to understand the event related logs.

Signed-hostap: Ben Greear <greearb@candelatech.com>

12 years agoMove wpa_scan_results_free() into shared C file
Jouni Malinen [Sun, 13 Nov 2011 16:56:26 +0000 (18:56 +0200)]
Move wpa_scan_results_free() into shared C file

Replace the inline helper function with a new C file that can be used
for common driver API related function.

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

12 years agoCorrect a spelling mistake
Fu Yingang [Sun, 13 Nov 2011 16:35:15 +0000 (18:35 +0200)]
Correct a spelling mistake

The word "targer" in the comments for pending_bssid of
wpa_supplicant data structure should be "target".

12 years agoPEAP: Verify peap_prfplus() result
Jouni Malinen [Sun, 13 Nov 2011 09:29:17 +0000 (11:29 +0200)]
PEAP: Verify peap_prfplus() result

This function can fail in theory since the SHA-1 functions are
allowed to return an error. While this does not really happen in
practice (we would not get this far if SHA-1 does not work), it is
cleaner to include the error handling here to keep static analyzers
happier. [Bug 421]

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

12 years agoRemove station functionality from hostap and madwifi driver wrappers
Jouni Malinen [Sun, 13 Nov 2011 09:13:13 +0000 (11:13 +0200)]
Remove station functionality from hostap and madwifi driver wrappers

This has been obsoleted by the more generic Linux WEXT (driver_wext.c)
support. The hostap and madwifi driver wrappers can now be used only
with hostapd. The old station interface remains available in releases up
to 1.x.

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

12 years agoRemove unmaintained driver wrappers
Jouni Malinen [Sun, 13 Nov 2011 08:57:46 +0000 (10:57 +0200)]
Remove unmaintained driver wrappers

The driver wrappers broadcom, iphone, osx, and ralink have not been
maintained for a while and it does not look like they will be in the
future either. As such, remove them from the development branch. The
previous versions will be included in older releases up to 1.x.

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

12 years agoAdd test-https for testing internal TLS client functionality
Jouni Malinen [Sun, 13 Nov 2011 08:49:27 +0000 (10:49 +0200)]
Add test-https for testing internal TLS client functionality

This tool can be used to test the internal TLS client implementation
against HTTPS servers.

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

12 years agoTLS: Add preliminary support for partial message processing
Jouni Malinen [Sun, 13 Nov 2011 08:47:04 +0000 (10:47 +0200)]
TLS: Add preliminary support for partial message processing

Reassemble partial TLS records to make the internal TLS client
implementation more convenient for stream sockets.

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

12 years agoTLS: Fix block cipher padding validation
Jouni Malinen [Sun, 13 Nov 2011 08:42:06 +0000 (10:42 +0200)]
TLS: Fix block cipher padding validation

The padding validation was done on the last padding-length octets in the
buffer which misses the first padding octet (the last octet is the
padding length). Fix the starting offset for the comparison loop to get
the first octet verified. [Bug 420]

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

12 years agoTLS: Clean up TLS record layer processing
Jouni Malinen [Sat, 5 Nov 2011 11:04:02 +0000 (13:04 +0200)]
TLS: Clean up TLS record layer processing

Return number of user input bytes from tlsv1_record_receive() to
move this detail into the proper record layer processing. In addition,
ignore unknown content types at record layer and allow processing to
continue after warning level TLS alerts to provide minimal workaround
for closure alerts.

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

12 years agoAdd random.c into libcrypto.a
Jouni Malinen [Sat, 5 Nov 2011 11:02:31 +0000 (13:02 +0200)]
Add random.c into libcrypto.a

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

12 years agoFix test-x509v3 build
Jouni Malinen [Fri, 4 Nov 2011 20:10:54 +0000 (22:10 +0200)]
Fix test-x509v3 build

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

12 years agoMove AP events for STA connected/disconnected into one function
Jouni Malinen [Thu, 3 Nov 2011 20:17:41 +0000 (22:17 +0200)]
Move AP events for STA connected/disconnected into one function

Instead of trying to remember to add wpa_msg() calls for every possible
path where a STA becomes authorized or unauthorized, use
ap_sta_set_authorized() to send these events more consistently.

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

12 years agoFix some recent wpa_msg() calls in hostapd use correct context
Jouni Malinen [Thu, 3 Nov 2011 20:04:17 +0000 (22:04 +0200)]
Fix some recent wpa_msg() calls in hostapd use correct context

wpa_msg() has to use hapd->msg_ctx instead of hapd as the context
pointer to work properly in wpa_supplicant AP mode.

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

12 years agohostapd: Send an event when an inactive station is removed
Nicolas Cavallari [Thu, 3 Nov 2011 19:58:22 +0000 (21:58 +0200)]
hostapd: Send an event when an inactive station is removed

Currently, there is no events over the control interface
when a AP disconnects a station due to inactivity.  With
this patch, an "AP-STA-DISCONNECTED" event will be sent.

Signed-hostap: Nicolas Cavallari <nicolas.cavallari@lri.fr>

12 years agondis: Work around lack of C99 designated initializers in MSVC
Jouni Malinen [Thu, 3 Nov 2011 16:45:21 +0000 (18:45 +0200)]
ndis: Work around lack of C99 designated initializers in MSVC

Use a driver_ndis.c specific initialization function to fill in the
wpa_driver_ops information to make it easier to modify struct
wpa_driver_ops in the future. Being able to build driver_ndis.c
with MSVC was the only reason for having to maintain the same order
of function pointers in struct wpa_driver_ops and for having to
update driver_ndis.c for all changes in that structure.

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

12 years agowpa_cli: Fix compiler warnings on unused functions
Jouni Malinen [Thu, 3 Nov 2011 16:02:28 +0000 (18:02 +0200)]
wpa_cli: Fix compiler warnings on unused functions

Some of the parameter completion functions are only used if
CONFIG_P2P=y.

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

12 years agoInclude time.h to fix Windows builds
Jouni Malinen [Thu, 3 Nov 2011 16:00:57 +0000 (18:00 +0200)]
Include time.h to fix Windows builds

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

12 years agoRemove obsoleted Qt3-based wpa_gui
Jouni Malinen [Thu, 3 Nov 2011 15:48:31 +0000 (17:48 +0200)]
Remove obsoleted Qt3-based wpa_gui

This code has not been maintained for years and there is no plan on
doing so either in the future. The Qt4-based wpa_gui-qt4 version can be
used as a replacement for this older wpa_gui version.

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

12 years agoRemove kerneldoc2doxygen.pl from hostap.git
Jouni Malinen [Thu, 3 Nov 2011 11:02:04 +0000 (13:02 +0200)]
Remove kerneldoc2doxygen.pl from hostap.git

This is a separate tool for preparing source code files for Doxygen.
It does not need to be distributed with hostap.git and it can now be
downloaded separately from http://w1.fi/tools/kerneldoc2doxygen-hostap.pl
by anyone who wants to build the developers' documents with Doxygen.

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

12 years agoUpdate version number to 2.0-devel
Jouni Malinen [Thu, 3 Nov 2011 10:19:44 +0000 (12:19 +0200)]
Update version number to 2.0-devel

hostap.git is now a development branch for 2.0 with 1.x releases
having been forked to hostap-1.git.

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

12 years agodbus: Fix some build combination without new D-Bus interface
Jouni Malinen [Wed, 2 Nov 2011 08:48:26 +0000 (10:48 +0200)]
dbus: Fix some build combination without new D-Bus interface

Include common/defs.h to get full enum definitions to avoid compiler
errors without CONFIG_CTRL_IFACE_DBUS_NEW.

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

12 years agoFix Android library configuration with OpenSSL build
Jouni Malinen [Tue, 1 Nov 2011 08:39:49 +0000 (10:39 +0200)]
Fix Android library configuration with OpenSSL build

Commit bf9d5518d55e314cad2dbac0715ce151b2807691 did not split
LOCAL_SHARED_LIBRARIES properly and ended up removing the needed
libraries.

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