Add autoscan parameters support in config file

Signed-hostap: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Add automatic scanning support

Like bgscan, autoscan is an optional module based feature to automate
scanning but while disconnected or inactive.

Instead of requesting directly a scan, it only sets the scan_interval
and the sched_scan_interval. So, if the driver supports sched_scan,
autoscan will be able to tweak its interval. Otherwise, the tweaked
scan_interval will be used. If scan parameters needs to be tweaked, an
autoscan_params pointer in wpa_s will provide those. So req_scan /
req_sched_scan will not set the scan parameters as they usually do, but
instead will use this pointer.

Modules will not have to request a scan directly, like bgscan does.
Instead, it will need to return the interval it wants after each
notification.

Signed-hostap: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
D-Bus: Add AutoScan interface method to set/unset autoscan parameters

Signed-hostap: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Add ctrl iface command for autoscan

Signed-hostap: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Add autoscan command into wpa_cli

Signed-hostap: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Add autoscan module named exponential

This module will compute the interval on a base exponential. Thus,
params to this module are following this format: <base>:<limit>

Signed-hostap: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Add a simple periodic autoscan module

This module will sets a fixed scanning interval. Thus, the parameter to
this module is following this format: <fixed interval>

Signed-hostap: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Write autoscan parameter to config file on updates

Signed-hostap: Jouni Malinen <j@w1.fi>
Fix autoscan exponential to start with the base value

Initial implementation used base^2 as the starting value.

Signed-hostap: Jouni Malinen <j@w1.fi>
Fix autoscan exponential to limit interval in all cases

The first time the limit is exceeded could result in using larger
value - avoid that by limiting the interval also in that case.

Signed-hostap: Jouni Malinen <j@w1.fi>
Start autoscan for first connection attempt

Use wpa_supplicant_set_state() to initialize state to DISCONNECT so that
autoscan gets initialized properly. This needs a change in
autoscan_init() to avoid extra scan request that would postpone the
first scan request when an interface is added.

Signed-hostap: Jouni Malinen <j@w1.fi>
Cancel pending scan request on DISCONNECT command

Previously, a pending scan request could be left running when processing
DISCONNECT command from control interface. This can result in unexpected
scan, so cancel the request to avoid this.

Signed-hostap: Jouni Malinen <j@w1.fi>
Reinitialize autoscan on explicit reassocciate/reconnect command

This clears the exponential scan interval back to the base value
when a reconnection is requested explicitly.

Signed-hostap: Jouni Malinen <j@w1.fi>
Allow autoscan parameters to be changed in SCANNING state

Signed-hostap: Jouni Malinen <j@w1.fi>
WPS: Fix NFC password token building with WPS 2.0

The earlier WPS 2.0 changes did not increase the wpabuf size when
adding a new attribute to the NFC password token. This could result
in aborting the application on wpabuf overflow if NFC out-of-band
mechanism is used with WPS 2.0 enabled.

Signed-hostap: Jouni Malinen <j@w1.fi>
intended-for: hostap-1
WPS: Fix potential memory leak with NFC password token

The old stored public key hash needs to be freed before replacing
the pointer with the new value.

Signed-hostap: Jouni Malinen <j@w1.fi>
WPS: Add support for OOB dev password lengths 16..31

Previously, only the maximum length 32 octets for OOB device password
was accepted. Since the specification allows a shorter password to be
used with limited OOB mechanism (e.g., small NFC tag), we should accept
lengths 16..32.

Signed-hostap: Jouni Malinen <j@w1.fi>
WPS: Fix OOB Device Password use for EAP-WSC peer

The OOB Device Password is passed in as a hexdump of the real Device
Password (16..32 octets of arbitrary binary data). The hexdump needs to
be converted to binary form before passing it for WPS processing.

Signed-hostap: Jouni Malinen <j@w1.fi>
Add dh5_init_fixed() to allow fixed DH parameters to be used

This allows pre-configured private and public key to be used when
initializing DH for group 5.

Signed-hostap: Jouni Malinen <j@w1.fi>
NDEF: Skip unnecessary wpabuf to ptr/len conversion

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