]> git.ipfire.org Git - thirdparty/hostap.git/log
thirdparty/hostap.git
3 years agoOpenSSL: Update security level drop for TLS 1.0/1.1 with OpenSSL 3.0
Jouni Malinen [Tue, 11 Jan 2022 15:37:32 +0000 (17:37 +0200)] 
OpenSSL: Update security level drop for TLS 1.0/1.1 with OpenSSL 3.0

OpenSSL 3.0 dropped these older TLS versions from the security level 2
to 1, so need to drop the security level all the way to 0 if TLS v1.0 or
v1.1 is explicitly enabled.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agotests: Update capability checks to include OpenSSL 3.0
Jouni Malinen [Tue, 11 Jan 2022 15:21:40 +0000 (17:21 +0200)] 
tests: Update capability checks to include OpenSSL 3.0

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agotests: Do not use SAE group 26
Jouni Malinen [Tue, 11 Jan 2022 12:09:43 +0000 (14:09 +0200)] 
tests: Do not use SAE group 26

This group should not be used with SAE and as such, it could cause
confusing test errors here. Use an acceptable group instead.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoOpenSSL: Fix compressed form encoding for subjectPublicKey with 3.0
Jouni Malinen [Tue, 11 Jan 2022 12:00:43 +0000 (14:00 +0200)] 
OpenSSL: Fix compressed form encoding for subjectPublicKey with 3.0

It looks like EC_KEY_set_conv_form() for the EC_KEY within the EVP_PKEY
does not take effect for i2d_PUBKEY() with OpenSSL 3.0, so allocate a
new wrapper EVP_PKEY after the conversion format change to be able to
return the correctly encoded (compressed) value here. This is required
for DPP to work correctly.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoOpenSSL: Load legacy provider when needed for OpenSSL 3.0
Jouni Malinen [Tue, 11 Jan 2022 10:43:19 +0000 (12:43 +0200)] 
OpenSSL: Load legacy provider when needed for OpenSSL 3.0

Number of the older algorithms have now been moved into a separate
provider in OpenSSL 3.0 and they are not available by default.
Explicitly load the legacy provider when such an algorithm is needed for
the first time.

In addition, at least for now, load the legacy providers when initiating
TLS context to maintain existing functionality for various private key
formats.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoOpenSSL: Clean up EVP_PKEY_get{0,1}_EC_KEY() use
Jouni Malinen [Tue, 11 Jan 2022 10:20:12 +0000 (12:20 +0200)] 
OpenSSL: Clean up EVP_PKEY_get{0,1}_EC_KEY() use

Use get1 whenever actually modifying the EC_KEY parameters and mark the
variable used with get0 const to be compatible with OpenSSL 3.0.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoOpenSSL: Speed up crypto_ec_point_compute_y_sqr()
Jouni Malinen [Mon, 10 Jan 2022 14:30:52 +0000 (16:30 +0200)] 
OpenSSL: Speed up crypto_ec_point_compute_y_sqr()

Optimize the calculation by computing (x^2 + a) first to get rid of one
separate multiplication by x.

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agoDPP: Remove dpp-listen radio work when stopping
Chenming Huang [Mon, 13 Dec 2021 07:57:58 +0000 (15:57 +0800)] 
DPP: Remove dpp-listen radio work when stopping

The radio work starting may be delayed. If the DPP listen operation is
stopped before the radio work starts, the pending dpp-listen radio work
won't get cleaned up, which might lead to failing to start the next DPP
listen operation.

Issue scenario: DPP start -> dpp-listen radio work added but not started
-> DPP stop, pending radio work not cleaned up -> radio work start ->
trying to start DPP but failing because a dpp-listen work already
exists.

This commit removes the potential pending dpp-listen radio
work when DPP stops.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoSAE: Make sure BSS entry is available to determine RSNXE information
Shivani Baranwal [Tue, 7 Dec 2021 08:25:24 +0000 (13:55 +0530)] 
SAE: Make sure BSS entry is available to determine RSNXE information

wpa_supplicant may use wrong SAE authentication method if it doesn't
have the scan result for the target BSS since RSNXE information is not
available.

For example, STA might use the hunting-and-pecking loop method for SAE
authentication even though AP supports SAE H2E and STA is configured
with sae_pwe=2.

This is possible in cases like EXTERNAL_AUTH triggered by the driver
during roaming. To avoid this update scan results to fetch the target
BSS scan result from the driver.

Signed-off-by: Shivani Baranwal <quic_shivbara@quicinc.com>
3 years agoAdd new vendor attributes to avoid coex unsafe frequencies
Mukul Sharma [Thu, 16 Dec 2021 18:14:02 +0000 (23:44 +0530)] 
Add new vendor attributes to avoid coex unsafe frequencies

Add additional attributes in
QCA_NL80211_VENDOR_SUBCMD_AVOID_FREQUENCY_EXT vendor sub command to
avoid usage of unsafe frequencies on wifi interfaces sent from userspace
to the driver/firmware. The driver/firmware shall use restrictions and
power cap accordingly to restrict the usage of these frequencies on
operating interface(s).

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agotests: Fix DPP PKEXv2 capability checks
Jouni Malinen [Tue, 14 Dec 2021 16:25:43 +0000 (18:25 +0200)] 
tests: Fix DPP PKEXv2 capability checks

At least for the time being PKEXv2 needs CONFIG_DPP3=y to work in a
testable manner. Couple of the test cases did not cover this correctly
and resulted in failures (instead of skipping the tests) when the
default build configuration was used. Fix that by checking for DPP
version 3.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoDPP3: Update version capability indication for hostapd
Jouni Malinen [Tue, 14 Dec 2021 17:43:54 +0000 (19:43 +0200)] 
DPP3: Update version capability indication for hostapd

The "GET_CAPABILITY dpp" command in wpa_supplicant was already extended
to cover DPP version 3, but the matching change for hostapd was
forgotten. Add that now.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoUpdate supported channel width set (HT40) after channel switch
peterhuang [Wed, 18 Aug 2021 10:48:53 +0000 (18:48 +0800)] 
Update supported channel width set (HT40) after channel switch

hostapd should update Supported Channel Width Set of HT Capability
Information field after channel switching done. Otherwise, it would
continue to use the old setting.

Signed-off-by: peterhuang <peterhuang@realtek.com>
3 years agoFix channel switch wrapper when switching from HT to VHT/HE
peterhuang [Wed, 18 Aug 2021 10:57:28 +0000 (18:57 +0800)] 
Fix channel switch wrapper when switching from HT to VHT/HE

Because ieee80211ac and ieee80211ax were not updated before channel
switch is done, hostapd didn't build the Channel Switch Wrapper element
when it switched from HT to bandwidth more than 40 MHz of VHT/HE. fix
this by allowing hostapd_eid_wb_chsw_wrapper() to determine internally
when the element needs to be added based on the new channel instead of
the old configuration.

Signed-off-by: peterhuang <peterhuang@realtek.com>
3 years agoUpdate ieee80211ac when channel switching
peterhuang [Thu, 19 Aug 2021 11:22:06 +0000 (19:22 +0800)] 
Update ieee80211ac when channel switching

hostapd will build wrong beacon_after in hostapd_fill_csa_settings() if
it doesn't update ieee80211ac when channel switching.

Signed-off-by: peterhuang <peterhuang@realtek.com>
3 years agomesh: Make forwarding configurable
Daniel Golle [Tue, 31 Aug 2021 07:44:07 +0000 (10:44 +0300)] 
mesh: Make forwarding configurable

Allow mesh_fwding (dot11MeshForwarding) to be specified in a mesh BSS
config, pass that to the driver (only nl80211 implemented for now) and
announce forwarding capability accordingly.

Signed-off-by: José Pekkarinen <jose.pekkarinen@unikie.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
3 years agoACS/DFS: Support min_tx_power configuration
Alan Young [Thu, 11 Nov 2021 16:40:05 +0000 (16:40 +0000)] 
ACS/DFS: Support min_tx_power configuration

If min_tx_power is specified (default 0 dBm, i.e., no constraint), ACS
and DFS will not consider channels whose available max_tx_power is less
than the configured value.

This may be useful to exclude SRD (Short Range Device) channels which
may be limited to 13.9 dBm (25 mW) in some regulatory domains.

Signed-off-by: Alan Young <consult.awy@gmail.com>
3 years agotests: remotehost: Disable pipe buffering
Janusz Dziedzic [Sun, 24 Oct 2021 19:47:49 +0000 (21:47 +0200)] 
tests: remotehost: Disable pipe buffering

Before, we could loose some events because of pipe buffering. I saw this
problem when running "ubus listen" or "logread -f" and waiting some
specific events. After disabling buffering this works much better.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
3 years agoMBO: Fix the allowed range of mbo_assoc_disallow values
Janusz Dziedzic [Sun, 24 Oct 2021 19:48:34 +0000 (21:48 +0200)] 
MBO: Fix the allowed range of mbo_assoc_disallow values

This parameter was added with the commit message indicating the valid
reason code values to be 1-5, but with the implementation allowed only
1. There are five defined reason code values for the Association
Disallowed attribute, so extend the allowed range to cover all those
values.

Fixes: fb9a1c3e285d ("hostapd: Add MBO IE to Beacon, Probe Response, Association Response")
Signed-off-by: Janusz Dziedzic <janusz.dziedzic@gmail.com>
3 years agoD-Bus: Interworking network selection
Damien Dejean [Wed, 8 Dec 2021 07:45:32 +0000 (07:45 +0000)] 
D-Bus: Interworking network selection

Add the "InterworkingSelect" method to the DBus API to trigger an
Interworking scan with ANQP fetches. When a BSS that matches a
configured credential is found, the result is emitted using the signal
"InterworkingAPAdded". Completion of the full InterworkingSelect
operation is indicated with the "InterworkingSelectDone" signal.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
3 years agoD-Bus: Interworking/Hotspot 2.0 credential operations
Damien Dejean [Wed, 8 Dec 2021 07:45:31 +0000 (07:45 +0000)] 
D-Bus: Interworking/Hotspot 2.0 credential operations

Add "AddCred", "RemoveCred", and "RemoveAllCreds" methods to the D-Bus
API of the network interface to allow the caller to manipulate a set of
Interworking credentials similarly to the way this was enabled through
the control interface.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
3 years agoMove credential removal operations into helper functions
Damien Dejean [Wed, 8 Dec 2021 07:45:31 +0000 (07:45 +0000)] 
Move credential removal operations into helper functions

This allows the same functions to be used for both the control interface
and the D-Bus interface.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
3 years agoHS 2.0: Crypto engine support for creds
Damien Dejean [Wed, 8 Dec 2021 07:45:30 +0000 (07:45 +0000)] 
HS 2.0: Crypto engine support for creds

Add the support of engine, engine_id, ca_cert_id, cert_id, and key_id
parameters to credential blocks for Hotspot 2.0.

Signed-off-by: Damien Dejean <damiendejean@chromium.org>
3 years agotests: Fix a typo in a couple of error messages
Jouni Malinen [Sun, 12 Dec 2021 14:44:14 +0000 (16:44 +0200)] 
tests: Fix a typo in a couple of error messages

Signed-off-by: Jouni Malinen <j@w1.fi>
3 years agowlantest: Add the missing command line option -W to the usage text
Gokul Sivakumar [Wed, 3 Nov 2021 16:50:24 +0000 (22:20 +0530)] 
wlantest: Add the missing command line option -W to the usage text

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
3 years agowlantest: Delete each entry from the WEP list before freeing the entry
Gokul Sivakumar [Wed, 3 Nov 2021 16:50:23 +0000 (22:20 +0530)] 
wlantest: Delete each entry from the WEP list before freeing the entry

To be consistent with how all the other dl lists like passphrase, PMK,
and PTK lists are freed, delete each entry from the WEP list before
freeing the entry.

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
3 years agowlantest: Replace the duplicate functions with reuse of cli.h
Gokul Sivakumar [Wed, 3 Nov 2021 16:50:22 +0000 (22:20 +0530)] 
wlantest: Replace the duplicate functions with reuse of cli.h

The definitions of max_args, get_cmd_arg_num(), and tokenize_cmd() are
already shared by the hostapd_cli and wpa_cli commands by including the
cli.h header. So follow the same for wlantest_cli and remove the
duplicate function defitions.

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
3 years agowlantest: Add new cli "help" command
Gokul Sivakumar [Wed, 3 Nov 2021 16:50:21 +0000 (22:20 +0530)] 
wlantest: Add new cli "help" command

Having a help cli command to view all the supported commands is helpful
when running the wlantest_cli manually instead via the python test
scripts.

$ wlantest_cli help
commands:
  ping = test connection to wlantest
  terminate = terminate wlantest
  list_bss = get BSS list
  list_sta <BSSID> = get STA list
  flush = drop all collected BSS data
  clear_sta_counters <BSSID> <STA> = clear STA counters
  clear_bss_counters <BSSID> = clear BSS counters
  get_sta_counter <counter> <BSSID> <STA> = get STA counter value
  get_bss_counter <counter> <BSSID> = get BSS counter value
  inject <frame> <prot> <sender> <BSSID> <STA/ff:ff:ff:ff:ff:ff>
  send <prot> <raw frame as hex dump>
  version = get wlantest version
  add_passphrase <passphrase> = add a known passphrase
  add_wepkey <WEP key> = add a known WEP key
  info_sta <field> <BSSID> <STA> = get STA information
  info_bss <field> <BSSID> = get BSS information
  clear_tdls_counters <BSSID> <STA1> <STA2> = clear TDLS counters
  get_tdls_counter <counter> <BSSID> <STA1> <STA2> = get TDLS counter value
  get_bss_counter <counter> <BSSID> = get BSS counter value
  relog = re-open log-file (allow rolling logs)
  get_tx_tid <BSSID> <STA> <TID> = get STA TX TID counter value
  get_rx_tid <BSSID> <STA> <TID> = get STA RX TID counter value
  help = show this usage help

$ wlantest_cli help add_passphrase
commands:
  add_passphrase <passphrase> = add a known passphrase

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
3 years agowlantest: Properly free allocated memory on error exit paths
Gokul Sivakumar [Wed, 3 Nov 2021 16:50:20 +0000 (22:20 +0530)] 
wlantest: Properly free allocated memory on error exit paths

In the cases when a failure is experienced, the value "-1" was returned
from the main() function without doing any cleanup or deinit.

For example, if wlantest was started with the following set of command
line arguments then later when returning after a failure from main()
function, the memory allocated as part of handling the "-p" getopt
command line option was not freed. To fix memory leaks in this case,
properly free the previously allocated memory with the help of
wlantest_deinit() before returning from main().

$ sudo valgrind --leak-check=full --show-leak-kinds=all --verbose \
> --track-origins=yes --log-file=valgrind-out.txt \
> ./wlantest -i hwsim0 -dd -c -p "asdfasdfasdfasdf" -W "abcd"
Invalid WEP key 'abcd'

Memory leak reported by Valgrind when running wlantest as mentioned above.

==513454== HEAP SUMMARY:
==513454==     in use at exit: 128 bytes in 1 blocks
==513454==   total heap usage: 4 allocs, 3 frees, 5,720 bytes allocated
==513454==
==513454== Searching for pointers to 1 not-freed blocks
==513454== Checked 76,936 bytes
==513454==
==513454== 128 bytes in 1 blocks are definitely lost in loss record 1 of 1
==513454==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==513454==    by 0x1396CA: os_zalloc (in /home/ubuntu/hostap/wlantest/wlantest)
==513454==    by 0x10C345: add_passphrase (wlantest.c:125)
==513454==    by 0x10C345: main (wlantest.c:425)
==513454==
==513454== LEAK SUMMARY:
==513454==    definitely lost: 128 bytes in 1 blocks
==513454==    indirectly lost: 0 bytes in 0 blocks
==513454==      possibly lost: 0 bytes in 0 blocks
==513454==    still reachable: 0 bytes in 0 blocks
==513454==         suppressed: 0 bytes in 0 blocks
==513454==
==513454== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)

Signed-off-by: Gokul Sivakumar <gokulkumar792@gmail.com>
3 years agoD-Bus: Capture group ifname before switching to global P2P instance
Hassoubi, Hicham [Fri, 3 Dec 2021 20:10:07 +0000 (20:10 +0000)] 
D-Bus: Capture group ifname before switching to global P2P instance

The P2P DBus interface was using the wrong interface name when calling
wpas_p2p_invite_group(). Capture the group interface name before calling
the method to fix this.

Signed-off-by: Hicham Hassoubi <Hicham_hassoubi@bose.com>
3 years agoSME: No need for OBSS scan if HT40 is disabled
Ernst Sjöstrand [Thu, 9 Dec 2021 13:08:56 +0000 (13:08 +0000)] 
SME: No need for OBSS scan if HT40 is disabled

Signed-off-by: Ernst Sjöstrand <ernst.sjostrand@verisure.com>
3 years agoRevert "Extract BSS coex 40 MHz check into a separate function"
Matthew Wang [Fri, 10 Dec 2021 17:59:23 +0000 (09:59 -0800)] 
Revert "Extract BSS coex 40 MHz check into a separate function"

This reverts commit 3af78a4e043ede6488eae081d854bad89500aec2.

This commit prepares a refactor for another patch, which is being
reverted.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
3 years agoRevert "STA OBSS: Add check for overlapping BSSs"
Matthew Wang [Fri, 10 Dec 2021 17:59:22 +0000 (09:59 -0800)] 
Revert "STA OBSS: Add check for overlapping BSSs"

This reverts commit 3204795d7a43bcbda8b695dd96d11f3000de7340.

The commit adds an additional check that checks for overlapping BSSs in
addition to the existing 40 MHz intolerance subfield checks. The commit
cites IEEE Std 802.11-2016, 11.16.12, which defines the proper behavior
for a 20/40 MHz HT STA and AP, but the standard actually doesn't say
anything about overlapping BSSs. Specifically, the standard states that
the only BSSs that belong in the Intolerant channel report are those
that satisfy trigger event A, defined as channels with BSSs that don't
contain the HT capabilities element (which wpa_supplicant already did
before). Note that we also include channels with BSSs that have the 40
MHz intolerance bit set in the Intolerant channel report.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
3 years agotests: DPP PKEXv2
Jouni Malinen [Tue, 7 Dec 2021 15:11:59 +0000 (17:11 +0200)] 
tests: DPP PKEXv2

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoDPP2: PKEXv2 core protocol changes
Jouni Malinen [Tue, 7 Dec 2021 15:04:48 +0000 (17:04 +0200)] 
DPP2: PKEXv2 core protocol changes

Add support for PKEXv2 core protocol. This defines a new PKEX Exchange
Request message type with protocol negotiation and different rules for
key derivation with PKEXv2 or newer is used.

This does not change existing behavior for PKEX, i.e., the PKEXv1
variant will still be used by default.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agotests: DPP3 protocol version during network introduction
Jouni Malinen [Fri, 3 Dec 2021 19:17:28 +0000 (21:17 +0200)] 
tests: DPP3 protocol version during network introduction

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoDPP: Testing functionality to omit Protocol Version from Peer Discovery
Jouni Malinen [Fri, 3 Dec 2021 19:16:21 +0000 (21:16 +0200)] 
DPP: Testing functionality to omit Protocol Version from Peer Discovery

Allow the dpp_test parameter to be used to request the Protocol Version
attributed to be omitted from the Peer Discovery Request/Response
message.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoDPP3: Verify version match during Network Introduction
Jouni Malinen [Fri, 3 Dec 2021 19:04:03 +0000 (21:04 +0200)] 
DPP3: Verify version match during Network Introduction

Verify that the Protocol Version attribute is used appropriate in Peer
Discovery Request/Response messages in cases where the signed Connector
includes the version information.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoDPP3: Use Connector version instead of current version in Peer Discovery
Jouni Malinen [Fri, 3 Dec 2021 14:33:46 +0000 (16:33 +0200)] 
DPP3: Use Connector version instead of current version in Peer Discovery

Generate Peer Discovery Request/Response messages using the protected
version from the Connector, if present, instead of the currently
supported protocol version which might be higher than the one that got
included into the signed Connector during provisioning earlier.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoDPP3: Add version member to Connector
Jouni Malinen [Fri, 3 Dec 2021 10:22:58 +0000 (12:22 +0200)] 
DPP3: Add version member to Connector

Indicate the protocol version number that the Enrollee used during the
DPP exchange that resulted in the generation of the Connector.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoDPP3: Add build option for version 3 functionality
Jouni Malinen [Fri, 3 Dec 2021 10:09:18 +0000 (12:09 +0200)] 
DPP3: Add build option for version 3 functionality

CONFIG_DPP3=y can now be used to configure hostapd and wpa_supplicant
builds to include DPP version 3 functionality. This functionality is
still under design and the implementation is experimental and not
suitable to be enabled in production uses before the specification has
been finalized.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
3 years agoReject ap_vendor_elements if its length is odd
Chaoli Zhou [Fri, 19 Nov 2021 14:13:29 +0000 (22:13 +0800)] 
Reject ap_vendor_elements if its length is odd

Align the process logic for ap_vendor_elements and ap_assocresp_elements
parsing by using the wpabuf_parse_bin() helper function in both.

Signed-off-by: Chaoli Zhou <zchaoli@codeaurora.org>
3 years agoFix bool type values for setband
Jouni Malinen [Fri, 26 Nov 2021 21:30:15 +0000 (23:30 +0200)] 
Fix bool type values for setband

wpa_add_scan_freqs_list() was updated to use bool for the is_6ghz
argument, but these callers were missed when updating the values from
0/1 to false/true.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoP2P: Remove 6 GHz channels from full scan if 6 GHz not enabled for P2P
Sreeramya Soratkal [Tue, 28 Sep 2021 15:33:15 +0000 (21:03 +0530)] 
P2P: Remove 6 GHz channels from full scan if 6 GHz not enabled for P2P

The channels included for the scan to connect to a P2P GO are optimized
such that the P2P GO preferred channel and the common channels are
included for the first few scans followed by a full scan in which all
the channels supported by the local device are included. This results in
P2P client including the 6 GHz channels for the full scan after GO
Negotiation even when 6 GHz channels are not used for the P2P
connection.

Exclude the 6 GHz channels from the full scan if 6 GHz channels are
supported but are not used for P2P connection.

Signed-off-by: Sreeramya Soratkal <ssramya@codeaurora.org>
3 years agoAdd a QCA vendor attribute to indicate puncture pattern in ACS
Aditya Sathish [Mon, 11 Oct 2021 09:31:34 +0000 (15:01 +0530)] 
Add a QCA vendor attribute to indicate puncture pattern in ACS

Add a QCA vendor attribute to indicate the puncture pattern derived
by the automatic channel selection algorithm.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoUpdate AKMP, cipher, PMF for driver-based SME while roaming
Vinay Gannevaram [Thu, 11 Nov 2021 07:09:28 +0000 (12:39 +0530)] 
Update AKMP, cipher, PMF for driver-based SME while roaming

After roaming to a new AP using driver-based SME and roaming trigger,
update proto type, AKMP suite, and pairwise cipher suite based on the
(Re)Association Request frame. Update PMF, group cipher, and group mgmt
cipher based on the AP's RSNE into wpa_sm. group_mgmt_cipher needs to be
updated based on PMF capabilities of STA and roamed AP.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agomesh: Enable 160 MHz bandwidth support for 6 GHz in IEEE 802.11s mesh
Pradeep Kumar Chitrapu [Thu, 9 Sep 2021 17:46:16 +0000 (10:46 -0700)] 
mesh: Enable 160 MHz bandwidth support for 6 GHz in IEEE 802.11s mesh

Since the 6 GHz band has no DFS channels, enable 6 GHz 160 MHz bandwidth
as the default configuration for IEEE 802.11s mesh.

example:
network={
 ssid="6gmesh160"
 key_mgmt=SAE
 mode=5
 frequency=6275
 psk="1234567890"
}

Signed-off-by: P Praneesh <ppranees@codeaurora.org>
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
3 years agomesh: Enable MFP by default for 6 GHz 11s mesh
Pradeep Kumar Chitrapu [Thu, 9 Sep 2021 17:46:15 +0000 (10:46 -0700)] 
mesh: Enable MFP by default for 6 GHz 11s mesh

IEEE Std 802.11ax-2021 mandates 6 GHz STA to use Management Frame
Protection (MFP) when RSN is enabled.

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
3 years agomesh: Enable 80 MHz support for 11s mesh in 6 GHz
Pradeep Kumar Chitrapu [Thu, 9 Sep 2021 17:46:14 +0000 (10:46 -0700)] 
mesh: Enable 80 MHz support for 11s mesh in 6 GHz

Add support for 80 MHz bandwidth operation in 6 GHz 11s mesh.

example:
    network={
        ssid="6GHz-mesh-node"
        key_mgmt=SAE
        mode=5
        frequency=6195
        psk="1234567890"
    }

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
3 years agomesh: Change channel to frequency based lookup for starting mesh
Pradeep Kumar Chitrapu [Thu, 9 Sep 2021 17:46:13 +0000 (10:46 -0700)] 
mesh: Change channel to frequency based lookup for starting mesh

Channel numbers of the 6 GHz band overlap those of the 2.4 GHz and 5 GHz
bands. Thus converting to frequency based mesh channel selection helps
accommodate 6 GHz mesh.

Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
3 years agotests: RNR element generation
Jouni Malinen [Tue, 9 Nov 2021 16:24:46 +0000 (18:24 +0200)] 
tests: RNR element generation

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoRNR: Do not allow FILS Discovery and unsolicited Probe Response simultaneously
Aloka Dixit [Tue, 27 Jul 2021 23:42:26 +0000 (16:42 -0700)] 
RNR: Do not allow FILS Discovery and unsolicited Probe Response simultaneously

Reduced neighbor report has a field to indicate whether unsolicited
Probe Response transmission is active. Add a check to return failure if
both FILS discovery and unsolicited Probe Response are enabled at the
same time to ensure that RNR includes valid data.

Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoRNR: Allow Probe Response frame for a colocated 6 GHz AP
Muna Sinada [Tue, 27 Jul 2021 23:42:25 +0000 (16:42 -0700)] 
RNR: Allow Probe Response frame for a colocated 6 GHz AP

When a Probe Request frame from a station includes an SSID matching that
of a co-located 6 GHz AP, AP should respond with a Probe Response frame
that includes Reduced Neighbor Report element containing information
regarding the requested BSS.

Signed-off-by: Muna Sinada <msinada@codeaurora.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoRNR: Update Beacon frames for 6 GHz colocation
Aloka Dixit [Tue, 27 Jul 2021 23:42:24 +0000 (16:42 -0700)] 
RNR: Update Beacon frames for 6 GHz colocation

Update 2.4/5 GHz Beacon frames every time Beacon frames for co-located 6
GHz AP(s) are set. This is required for 6 GHz out-of-band discovery so
that lower band Beacon frames will include RNR element with 6 GHz AP
information irrespective of the AP bring-up order. Similarly, RNR is
included in FILS Discovery frames by default in 6 GHz-only mode,
updating the Beacon frames will remove it when co-located 2.4/5 GHz
interfaces are brought up.

This change also ensures that the changes in 6 GHz AP configuration such
as new channel and bandwidth get reflected in the lower bands Beacon
frames.

Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoRNR: Addition in Beacon, Probe Response, and FILS Discovery frames
John Crispin [Tue, 27 Jul 2021 23:42:23 +0000 (16:42 -0700)] 
RNR: Addition in Beacon, Probe Response, and FILS Discovery frames

Add Reduced Neighbor Report element in Beacon, Probe Response, and FILS
Discovery frames.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoRNR: Additions for a 6 GHz AP
John Crispin [Tue, 27 Jul 2021 23:42:22 +0000 (16:42 -0700)] 
RNR: Additions for a 6 GHz AP

Include Reduced Neighbor Report element in Beacon and Probe Response
frames by default if the reporting AP is 2.4/5 GHz and it is co-located
with a 6 GHz AP. Similarly, include RNR by default in FILS Discovery
frames if the AP is a standalone 6 GHz AP.

Signed-off-by: John Crispin <john@phrozen.org>
Co-developed-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoRNR: Add co-located BSSes
John Crispin [Tue, 27 Jul 2021 23:42:21 +0000 (16:42 -0700)] 
RNR: Add co-located BSSes

Calculate the length and include data for the BSSes active on the same
radio as the reporting BSS in the Reduced Neighbor Report element. This
element is included in Beacon and Probe Response frames.

Signed-off-by: John Crispin <john@phrozen.org>
Co-developed-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Signed-off-by: Pradeep Kumar Chitrapu <pradeepc@codeaurora.org>
Co-developed-by: Muna Sinada <msinada@codeaurora.org>
Signed-off-by: Muna Sinada <msinada@codeaurora.org>
Co-developed-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoRNR: Add data from neighbor database
John Crispin [Tue, 27 Jul 2021 23:42:20 +0000 (16:42 -0700)] 
RNR: Add data from neighbor database

Include data from the existing neighbor database in the Reduced Neighbor
Report element in Beacon frames if the configuration option 'rnr' is
enabled for the BSS.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Muna Sinada <msinada@codeaurora.org>
Co-developed-by: Aloka Dixit <alokad@codeaurora.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoRNR: Add configuration option
John Crispin [Tue, 27 Jul 2021 23:42:19 +0000 (16:42 -0700)] 
RNR: Add configuration option

Adds configuration option 'rnr' to enable the reduced neighbor report
elements in Beacon and Probe Response frames.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoRNR: Define element format
John Crispin [Tue, 27 Jul 2021 23:42:18 +0000 (16:42 -0700)] 
RNR: Define element format

Add definitions for the fields described in IEEE Std 802.11-2020 and
IEEE Std 802.11ax-2021, 9.4.2.170 Reduced Neighbor Report element.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Muna Sinada <msinada@codeaurora.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoShare a common error path for SET_NEIGHBOR control interface command
Jouni Malinen [Mon, 8 Nov 2021 21:42:02 +0000 (23:42 +0200)] 
Share a common error path for SET_NEIGHBOR control interface command

Instead of constructing a custom error handler freeing the same set of
allocated memory areas on various error cases, share the success path
freeing implementation for the error cases as well.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoRNR: Add bss_parameters to the neighbor_db
John Crispin [Tue, 27 Jul 2021 23:42:17 +0000 (16:42 -0700)] 
RNR: Add bss_parameters to the neighbor_db

Add a new field to include BSS Parameter subfield in the neighbor
database as described in IEEE Std 802.11ax-2021, Figure 9-632a (BSS
Parameters subfield format). This field holds information related to
multiple BSSID, access point co-location, and 20 TU probe response
active/inactive state.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoRNR: Short SSID assignment
John Crispin [Tue, 27 Jul 2021 23:42:16 +0000 (16:42 -0700)] 
RNR: Short SSID assignment

Calculate and store short SSID in hostapd_data context during config
load time and in neighbor report.

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Aloka Dixit <alokad@codeaurora.org>
3 years agoUpdate AKMP and proto for driver-based SME while roaming
Vinay Gannevaram [Thu, 28 Oct 2021 17:51:00 +0000 (23:21 +0530)] 
Update AKMP and proto for driver-based SME while roaming

After roaming to a new AP using driver-based SME and roaming trigger,
AKMP and proto were not updated in wpa_sm. Hence, update AKMP and proto
used with roamed AP when association event received from the driver in
SME offloaded to the driver scenario to avoid incorrect AKMP details in
wpa_supplicant similarly to how the cipher suite updates were added in
commit 2b3e64a0fb5f ("Update ciphers to address GTK renewal failures
while roaming") .

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd QCA vendor attribute to configure ARP/NS offload feature
Will Huang [Tue, 2 Nov 2021 07:01:19 +0000 (15:01 +0800)] 
Add QCA vendor attribute to configure ARP/NS offload feature

Add a QCA vendor attribute QCA_WLAN_VENDOR_ATTR_CONFIG_ARP_NS_OFFLOAD to
configure ARP/NS offload feature.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoOpenSSL: Fix build with OpenSSL 1.0.2
Jouni Malinen [Wed, 3 Nov 2021 14:02:07 +0000 (16:02 +0200)] 
OpenSSL: Fix build with OpenSSL 1.0.2

OpenSSL 1.0.2 did not define the 'bytes' argument to
X509_NAME_add_entry_by_NID() to be const like it did for the previously
used X509_NAME_add_entry_by_txt(). Add a backwards compatible version of
this call to avoid compilation issues.

Fixes: d51939f2c4b5 ("DPP: Move CSR routines to use crypto.h")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agotests: Fix DPP test cases for BoringSSL
Cedric Izoard [Fri, 29 Oct 2021 09:05:33 +0000 (11:05 +0200)] 
tests: Fix DPP test cases for BoringSSL

When checking DPP capabilities the Brainpool flag was not always set
when needed, leading to run a test with the Brainpool curves not
supported by BoringSSL.

Use a short form for the DER length of EC privateKey with NIST P-521
curve. Indeed BoringSSL returns an error when parsing DER sequence 30 81
50 ... because the length 81 50 could have been encoded as 50 and
according comment in BoringSSL:
ITU-T X.690 section 10.1 (DER length forms) requires encoding the
length with the minimum number of octets.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Replace dpp_bootstrap_key_der() with crypto_ec_key_get_subject_public_key()
Cedric Izoard [Fri, 29 Oct 2021 09:05:32 +0000 (11:05 +0200)] 
DPP: Replace dpp_bootstrap_key_der() with crypto_ec_key_get_subject_public_key()

As BoringSSL version of i2d_PUBKEY() doesn't respect the
POINT_CONVERSION_COMPRESSED flag redefine a specific
crypto_ec_key_get_subject_public_key() version for BoringSSL based on
dpp_bootstrap_key_der().

The only other user of crypto_ec_key_get_subject_public_key() is SAE-PK
for which the public key should also be formatted using compressed
format.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Use ECDH from crypto.h
Cedric Izoard [Fri, 29 Oct 2021 09:05:31 +0000 (11:05 +0200)] 
DPP: Use ECDH from crypto.h

Use crypto.h API to implement ECDH in DPP. This needs a new
initialization function in crypto.h to initialize an ECDH with a given
EC key.

Using crypto_ecdh_set_peerkey() to generate the ECDH secret in an
intermediate and dynamically allocated buffer removed the need for the
DPP-specific workaround for inconsistent length returned by
EVP_PKEY_derive() since that crypto_ecdh_set_peerkey() implementation
already had functionality for covering the changing secret_len value
from commit d001fe31ab0a ("OpenSSL: Handle EVP_PKEY_derive() secret_len
changes for ECDH").

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoOpenSSL: Clear the correct flag in crypto_ec_key_get_ecprivate_key()
Cedric Izoard [Fri, 29 Oct 2021 09:05:30 +0000 (11:05 +0200)] 
OpenSSL: Clear the correct flag in crypto_ec_key_get_ecprivate_key()

In case the public key was not included in the EC private key ASN.1
sequence, the flag that was cleared was not the right one. Fix this by
using EC_KEY_set_enc_flags() for both setting and clearing the
EC_PKEY_NO_PUBKEY flag instead of trying to clear that with the
unrelated EC_KEY_clear_flags() function.

Fixes: 2d5772e691f6 ("DPP: Factorize conversion to ASN.1 ECPrivateKey")
Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoIgnore CONFIG_WIFI_DISPLAY without CONFIG_P2P
Masashi Honma [Sun, 31 Oct 2021 23:03:37 +0000 (08:03 +0900)] 
Ignore CONFIG_WIFI_DISPLAY without CONFIG_P2P

Wi-Fi Display functionality needs P2P to be enabled. Ignore
CONFIG_WIFI_DISPLAY if CONFIG_P2P is not enabled for the build. This
avoids following compilation issue with invalid build configuration:

../src/ap/ap_drv_ops.c: In function 'hostapd_build_ap_extra_ies':
../src/ap/ap_drv_ops.c:163:10: error: 'struct hostapd_data' has no member named 'p2p_group'
  163 |  if (hapd->p2p_group) {
      |          ^~
../src/ap/ap_drv_ops.c:165:35: error: 'struct hostapd_data' has no member named 'p2p_group'
  165 |   a = p2p_group_assoc_resp_ie(hapd->p2p_group, P2P_SC_SUCCESS);
      |                                   ^~

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
3 years agoFix compiler error on CONFIG_AP without CONFIG_P2P builds
Masashi Honma [Sun, 31 Oct 2021 23:03:37 +0000 (08:03 +0900)] 
Fix compiler error on CONFIG_AP without CONFIG_P2P builds

/usr/bin/ld: /home/honma/git/hostap/build/wpa_supplicant/ap.o: in function `wpas_conf_ap_he_6ghz':
/home/honma/git/hostap/wpa_supplicant/ap.c:245: undefined reference to `wpas_p2p_get_sec_channel_offset_40mhz'

Fixes: e5173e8b12a8 ("P2P: Enable multiple channel widths for P2P in 6 GHz band")
Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
3 years agowolfSSL: Fix a link error when WPS NFC is disabled
Masashi Honma [Wed, 27 Oct 2021 01:10:57 +0000 (10:10 +0900)] 
wolfSSL: Fix a link error when WPS NFC is disabled

/usr/bin/ld: /home/honma/git/hostap/build/wpa_supplicant/src/wps/wps.o: in function `wps_deinit':
/home/honma/git/hostap/wpa_supplicant/../src/wps/wps.c:184: undefined reference to `dh5_free'
/usr/bin/ld: /home/honma/git/hostap/build/wpa_supplicant/src/wps/wps_common.o: in function `wps_derive_keys':
/home/honma/git/hostap/wpa_supplicant/../src/wps/wps_common.c:83: undefined reference to `dh5_derive_shared'
/usr/bin/ld: /home/honma/git/hostap/wpa_supplicant/../src/wps/wps_common.c:84: undefined reference to `dh5_free'
/usr/bin/ld: /home/honma/git/hostap/build/wpa_supplicant/src/wps/wps_attr_build.o: in function `wps_build_public_key':
/home/honma/git/hostap/wpa_supplicant/../src/wps/wps_attr_build.c:68: undefined reference to `dh5_free'
/usr/bin/ld: /home/honma/git/hostap/wpa_supplicant/../src/wps/wps_attr_build.c:69: undefined reference to `dh5_init'
collect2: error: ld returned 1 exit status
make: *** [Makefile:1892: wpa_supplicant] Error 1

Signed-off-by: Masashi Honma <masashi.honma@gmail.com>
3 years agoDPP: Use crypto_ec_key_get_subject_public_key() when possible
Cedric Izoard [Mon, 28 Jun 2021 16:25:25 +0000 (18:25 +0200)] 
DPP: Use crypto_ec_key_get_subject_public_key() when possible

Keep the locally defined ASN.1 sequence DPP_BOOTSTRAPPING_KEY for now to
avoid losing a workaround for BoringSSL from commit 746c1792ac28 ("DPP:
Build bootstrapping key DER encoding using custom routine").

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Move CSR routines to use crypto.h
Cedric Izoard [Mon, 28 Jun 2021 16:25:37 +0000 (18:25 +0200)] 
DPP: Move CSR routines to use crypto.h

Add basic CSR API in crypto.h.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Move dpp_pkcs7_certs() into crypto_pkcs7_get_certificates()
Cedric Izoard [Mon, 28 Jun 2021 16:25:38 +0000 (18:25 +0200)] 
DPP: Move dpp_pkcs7_certs() into crypto_pkcs7_get_certificates()

Move implementation of dpp_pkcs7_certs() into OpenSSL specific files.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Move debug print of EC key to crypto.h
Cedric Izoard [Mon, 28 Jun 2021 16:25:36 +0000 (18:25 +0200)] 
DPP: Move debug print of EC key to crypto.h

Move the crypto lib specific print of an EC key in dpp_debug_print_key()
to crypto.h.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Remove direct call to OpenSSL in dpp_test_gen_invalid_key()
Cedric Izoard [Mon, 28 Jun 2021 16:25:35 +0000 (18:25 +0200)] 
DPP: Remove direct call to OpenSSL in dpp_test_gen_invalid_key()

Instead of generating EC point with random coordinates, generate a
valid EC point and then corrupt the coordinates after exporting them
in binary format.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Add crypto_ec_key_cmp() in crypto.h and use it
Cedric Izoard [Mon, 28 Jun 2021 16:25:34 +0000 (18:25 +0200)] 
DPP: Add crypto_ec_key_cmp() in crypto.h and use it

This gets rid of one more direct OpenSSL call in the DPP implementation.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Use crypto_ec_key_group() to compare EC key's group
Cedric Izoard [Mon, 28 Jun 2021 16:25:33 +0000 (18:25 +0200)] 
DPP: Use crypto_ec_key_group() to compare EC key's group

Remove one more direct call to OpenSSL using crypto_ec_key_group() to
compare group of c-sign-key and ppKey when creating Configurator from
backup data.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Use crypto API for reconfig part
Cedric Izoard [Mon, 28 Jun 2021 16:25:32 +0000 (18:25 +0200)] 
DPP: Use crypto API for reconfig part

Rewrite functions related to reconfig feature using EC point/bignum
primitives defined in crypto.h API.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Update connector signing to use crypto.h
Cedric Izoard [Mon, 28 Jun 2021 16:25:31 +0000 (18:25 +0200)] 
DPP: Update connector signing to use crypto.h

Add two new functions in crypto.h that "wrap" around already defined
signing function with (r,s) interface instead of DER Ecdsa-Sig-Value.

Using those functions implies to compute the hash to sign manually
before.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Remove unused EVP_PKEY_CTX variable
Cedric Izoard [Mon, 28 Jun 2021 16:25:30 +0000 (18:25 +0200)] 
DPP: Remove unused EVP_PKEY_CTX variable

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Use crypto.h for authentication computation
Cedric Izoard [Mon, 28 Jun 2021 16:25:30 +0000 (18:25 +0200)] 
DPP: Use crypto.h for authentication computation

Rewrite dpp_auth_derive_l_responder/initiator() using EC point/bignum
primitives defined in crypto.h API.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Update PKEX part to use crypto.h API
Cedric Izoard [Mon, 28 Jun 2021 16:25:28 +0000 (18:25 +0200)] 
DPP: Update PKEX part to use crypto.h API

Rewrite EC point/bignum computation done in PKEX protocol using EC
point/bignum primitives already defined in crypto.h and couple of small
new helper functions.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Use crypto_ec_key_parse_priv() when possible
Cedric Izoard [Mon, 28 Jun 2021 16:25:27 +0000 (18:25 +0200)] 
DPP: Use crypto_ec_key_parse_priv() when possible

Function crypto_ec_key_parse_priv() already parses ASN.1 ECPrivateKey so
use it when possible.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Use crypto_ec_key_parse_pub() in dpp_get_subject_public_key()
Cedric Izoard [Mon, 28 Jun 2021 16:25:26 +0000 (18:25 +0200)] 
DPP: Use crypto_ec_key_parse_pub() in dpp_get_subject_public_key()

The extra validation steps through the OpenSSL X509 API are not really
necessary here and they most duplicate checks that happen implicitly
within d2i_PUBKEY() and the EVP_PKEY_get0_EC_KEY() checks in
crypto_ec_key_parse_pub().

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Move dpp_set_pubkey_point_group() to crypto.h
Cedric Izoard [Mon, 28 Jun 2021 16:25:24 +0000 (18:25 +0200)] 
DPP: Move dpp_set_pubkey_point_group() to crypto.h

Move code of dpp_set_pubkey_point_group() into crypto.h API. This
function initializes an EC public key using coordinates of the EC point
in binary format.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoOpenSSL: Add Brainpool curves to crypto_ec_key_group()
Cedric Izoard [Mon, 28 Jun 2021 16:25:23 +0000 (18:25 +0200)] 
OpenSSL: Add Brainpool curves to crypto_ec_key_group()

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Replace dpp_get_pubkey_point() with crypto_ec_key_get_pubkey_point()
Cedric Izoard [Mon, 28 Jun 2021 16:25:23 +0000 (18:25 +0200)] 
DPP: Replace dpp_get_pubkey_point() with crypto_ec_key_get_pubkey_point()

Move code of dpp_get_pubkey_point() to a crypto library specific
function crypto_ec_key_get_pubkey_point().

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Factorize conversion to ASN.1 ECPrivateKey
Cedric Izoard [Mon, 28 Jun 2021 16:25:22 +0000 (18:25 +0200)] 
DPP: Factorize conversion to ASN.1 ECPrivateKey

Add crypto_ec_key_get_ecprivate_key() function in crypto.h and use it
when possible in DPP code.

This function converts a struct crypto_ec_key into a DER encoded ASN.1
ECPrivateKey.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoOpenSSL: Mark crypto_ec_key_gen() key compressed
Cedric Izoard [Mon, 28 Jun 2021 16:25:21 +0000 (18:25 +0200)] 
OpenSSL: Mark crypto_ec_key_gen() key compressed

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Move dpp_gen_keypair() to crypto
Cedric Izoard [Mon, 28 Jun 2021 16:25:21 +0000 (18:25 +0200)] 
DPP: Move dpp_gen_keypair() to crypto

Move code in dpp_gen_keypair() to function crypto_ec_key_gen() in
crypto.h.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoDPP: Replace EVP_PKEY by struct crypto_ec_key
Cedric Izoard [Mon, 28 Jun 2021 16:25:20 +0000 (18:25 +0200)] 
DPP: Replace EVP_PKEY by struct crypto_ec_key

To remove direct dependency to OpenSSL in DPP replace EVP_PKEY
by struct crypto_ec_key in all structures and function prototypes.

All direct calls to EVP_PKEY_free() are replaced by calls to
crypto_ec_key_deinit().

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoOpenSSL: Use EVP_PKEY as struct crypto_ec_key
Cedric Izoard [Mon, 28 Jun 2021 16:25:19 +0000 (18:25 +0200)] 
OpenSSL: Use EVP_PKEY as struct crypto_ec_key

Remove definition of struct crypto_ec_key and directly cast struct
crypto_ec_key * to EVP_PKEY * (and vice versa).

Indeed EVP_PKEY already has a pointer to EC_KEY and removing this
intermediate structure allows smoother transition in removing direct
OpenSSL dependency in DPP.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoComplete documentation in crypto.h
Cedric Izoard [Mon, 28 Jun 2021 16:25:18 +0000 (18:25 +0200)] 
Complete documentation in crypto.h

Add missing documentation for crypto_ecdh and crypt_ec_key functions.

Signed-off-by: Cedric Izoard <cedric.izoard@ceva-dsp.com>
3 years agoSAE: Fix sm->cur_pmksa assignment
Hu Wang [Mon, 25 Oct 2021 10:58:38 +0000 (16:28 +0530)] 
SAE: Fix sm->cur_pmksa assignment

Commit b0f457b6191 ("SAE: Do not expire the current PMKSA cache entry")
depends on sm->cur_pmksa to determine if it is the current PMKSA cache
entry, but sm->cur_pmksa was not always correct for SAE in the current
implementation.

Set sm->cur_pmksa in wpa_sm_set_pmk() (which is used with SAE), and skip
clearing of sm->cur_pmksa for SAE in wpa_find_assoc_pmkid(). This latter
case was added by commit c2080e8657f8 ("Clear current PMKSA cache
selection on association/roam") for driver-based roaming indication and
Suite B, so skipping it for SAE should be fine.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoAdd QCA vendor attribute to configure priority of vendor scan
Shiva Krishna Pittala [Fri, 1 Oct 2021 08:35:00 +0000 (14:05 +0530)] 
Add QCA vendor attribute to configure priority of vendor scan

Add the attribute QCA_WLAN_VENDOR_ATTR_SCAN_PRIORITY to configure the
priority of vendor scan relative to other scan requests. Add the valid
values that this attribute can take.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agotests: Configuration file comment with "" after #
Jouni Malinen [Fri, 22 Oct 2021 14:45:14 +0000 (17:45 +0300)] 
tests: Configuration file comment with "" after #

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
3 years agoFix handling of complex configuration lines with mixed "" and #
xinpeng wang [Tue, 14 Sep 2021 05:09:20 +0000 (13:09 +0800)] 
Fix handling of complex configuration lines with mixed "" and #

The original code wants to remove # comments unless they are within a
double quoted string, but it doesn’t consider the "" after #, for
example in the following line: a=b #"a=c"

Signed-off-by: xinpeng wang <wangxinpeng@uniontech.com>