Moving keystore to system/security

keystore used to be in frameworks/base/cmds/keystore, but this include
needs to be changed to support the move to system/security
Add state message sent after 'status' command

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Add network connection event for status

We need both supplicant state and network connection state
for proper sync up with framework
Restore OpenSSL ENGINE support

We now use an OpenSSL ENGINE to support keystore functionality.
Use keystore ENGINE for private key operations

The new keystore ENGINE is usable to perform private key operations when
we can't get the actual private key data. This is the case when hardware
crypto is enabled: the private key never leaves the hardware.

Subsequently, we need to be able to talk to OpenSSL ENGINEs that aren't
PKCS#11 or OpenSC. This just changes a few #define variables to allow us
to talk to our keystore engine without having one of those enabled and
without using a PIN.
wpa_supplicant: Fix compilation without BOARD_WPA_SUPPLICANT_DRIVER

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Android.mk: Define ANDROID_P2P

Changes within #ifdef ANDROID_P2P are BRCM additions
which are non BRCM specific and there should be included.
That's in contrast of ANDROID_BRCM_P2P_PATCH which mark
parts that are BRCM implementation specific (like device_ap_sme)
and therefore would be compiled in only when compiling with BRCM
driver.

Change-Id: I031f0908055756b6e85b64c5151c18b8a73b9841
Signed-off-by: Eyal Shapira <eyal@wizery.com>
Allow immediate scan request even if another scan was scheduled later

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Add SSID in supplicant change event
Fix SSID printing in events
Fix null pointer access for SSID printing.
Fix p2p service discovery

- Fix listen timing to improve SD reliability
- Fix SD packet scheduling

Signed-off-by: Eyal Shapira <eyal@wizery.com>
nl80211: Use native cfg80211 sta events (BRCM)

[Eyal - Keep specific BRCM specific stuff under
ANDROID_BRCM_P2P_PATCH and not ANDROID_P2P which
TI solution compiles with]

Change-Id: I0f6222839ac87241f1bfbbb1fdc6469bf6359652
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Eyal Shapira <eyal@wizery.com>
Prep work to configure a prioritized interface (BRCM)

Add a new configurable property which points to the interface
name that should prioritized in case of resolving connection
conflicts.

(This appears to be prep work which doesn't get used however
we include it to better align with JB)

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: Resolve frequency conflicts between STA and P2P (BRCM)

Upon association check whether there's a a frequency
conflict given that no support for multi channel. In case
there's a freq conflict with an existing P2P_GO or P2P_CLI
decide how to resolve it (which one to disable or disconnect)
according to the priority configuration.

Effectively on Android JB, STA is always prioritized over P2P
so in case of a conflict P2P will be disconnected so that STA
can associate on a different channel.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: fix freq conflict resolution in case of P2P and STA

The conflict resolution code doesn't run in case wpa_s SME is used
so moved it up wpa_supplicant_associate.
wpas_p2p_handle_frequency_conflicts assumes use of a different interface
created for p2p group (p2p_group_interface != 0) but that's not
necessarily the case with all drivers. Switch to detect if an iface
is used for P2P_GO by looking at current_ssid->mode.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
nl80211: fix extending shared_freq detection to AP/GO (BRCM)

Commit d3bd0f "nl80211: Extend shared_freq to handle AP/GO mode interfaces"
still discards AP/GO interfaces so effectively shared_freq
won't work on AP/GO interaces like intended.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
nl80211: add parameter to force multi channel concurrency (BRCM)

Add a parameter which can be set from wpa_s commandline
or conf file to force real multi channel.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: Decrease peer expiry time (BRCM)

Changed from 5 min to 30 secs probably in order
to avoid stale peers appearing in the Android UI.

Signed-off-by: Eyal Shapira <eyal@wizery.com>
P2P: Defer p2p scan if scanning on other interfaces (BRCM)

The current defer p2p scan until scan complete works
only when the scanning is done on the same interface.
However in Android case there are scans in progress on the STA
interface so these would fail the p2p_scan and consequently
the p2p find.

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