daniel-p-carvalho opened a new pull request, #20564:
URL: https://github.com/apache/nuttx/pull/20564
## Summary
WPA3-Personal (SAE) for the PIC32MZ-W1 Wi-Fi driver, as a station and as
a Soft-AP, using the chip's BA414E public key engine.
**Draft: stacked on #20557** (Wi-Fi support). The first three commits are
#20557's; only the last two belong to this PR. I will rebase it and mark
it ready once #20557 is merged.
Commits of this PR:
1. **arch/mips/pic32mz: add WPA3-Personal for the PIC32MZ-W1 Wi-Fi.**
* `pic32mz_ba414e.c/.h` (`CONFIG_PIC32MZ_W1_BA414E`): driver for the
BA414E public key engine: modular add, subtract, multiply and
exponentiation; P-256 point add, double, multiply and on-curve check.
Interrupt driven (CRYPTO1/CRYPTO1F), one operation at a time.
* `pic32mz_w1_wlan_crypto.c`: the big number and elliptic curve services
the WLAN library calls for SAE now use the engine (they reported an
error in #20557). When the library passes a completion callback, the
operation completes at once and the callback is queued and run from
the WLAN thread, as the library expects.
* `pic32mz_w1_wlan.c`: WPA3-Personal 11i settings (SAE, management frame
protection required) and the SAE password, selected with WPA version
3 (`IW_AUTH_WPA_VERSION_WPA3`, `wapi psk wlan0 <passphrase> 3 3`).
* Optional self-test (`CONFIG_PIC32MZ_W1_BA414E_SELFTEST`): known-answer
tests of every primitive when the microcode is loaded.
2. **boards/mips/pic32mz/ev49n51a: enable WPA3-Personal.** BA414E enabled in
`ev49n51a:wlan`; documentation (WPA3-Personal section, microcode
download and license, microcode file option, limitations).
## Microcode and license
The BA414E runs a microcode program that comes from Microchip's MPLAB
Harmony [crypto](https://github.com/Microchip-MPLAB-Harmony/crypto)
repository (`drivers/ba414e/src/drv_ba414e.c`), under Microchip's license
(`mplab_harmony_license.md`), which only allows its use with Microchip
devices. As for the WLAN library in #20557, it is not added to the NuttX
tree. Two options:
* `CONFIG_PIC32MZ_W1_BA414E_UCODE_BUILTIN` (default): `Make.defs` downloads
`drv_ba414e.c` (pinned to v3.9.0) from the `context` target and generates
a C file with its microcode array. The rule checks that the 810 values
are there and deletes a bad download. `distclean` removes both files.
* `CONFIG_PIC32MZ_W1_BA414E_UCODE_FILE`: the microcode is read from a file
(`/etc/ba414e.bin` by default) on first use, so nothing is downloaded at
build time. The format (810 little-endian 32-bit values, 3240 bytes) is
documented in the Kconfig help, the driver header and the board page.
All the driver code is new and Apache-2.0. Register addresses come from
Microchip's PIC32MZ-W device pack (`[DFP]`). The engine's programming model
(operation codes, operand slots, status bits, microcode packing) is not in
the data sheet; it was taken from Microchip's Harmony BA414E driver and
the library interface from the Harmony Wi-Fi driver, and both are tagged
`[EX]` as in #20557. Only facts were used; no code was copied.
## Impact
* PIC32MZ-W1 / EV49N51A only; new option `PIC32MZ_W1_BA414E` (default n,
depends on `PIC32MZ_W1_WLAN`). Without it the driver behaves as in
#20557: WPA3 is rejected with `-ENOTSUP`.
* `ev49n51a:wlan` enables it, so an XC32 build of that configuration also
downloads `drv_ba414e.c`. In CI (Pinguino GCC) the Wi-Fi options are
dropped, as explained in #20557, so nothing is downloaded there.
* Not supported: WPA2/WPA3 transition mode and enterprise security.
With management frame protection (always on with WPA3), unprotected
Public Action frames from the AP are dropped by the library with a
"decap action fail" message; this limitation was already documented in
#20557.
## Testing
Hardware built from the EV49N51A design (WFI32E01PE, silicon B0), XC32
v6.00, host Ubuntu Linux x86_64 (Qualcomm QCA6174 Wi-Fi), Android phone
hotspot.
* Self-test (BA414E microcode downloaded at build time): all primitives
pass; P-256 point multiply 1.5 ms, modular exponentiation (256 bit)
0.34 ms.
* Station, WPA3-Personal (phone hotspot set to WPA3): SAE association, the
microcode is loaded on the first connection, DHCP, ping to 8.8.8.8
(10/10) and to the gateway (50/50).
* Soft-AP, WPA3-Personal, channel 6, with the host as station
(`key_mgmt=SAE`, PMF required): the host joins (4-way handshake
PTK=CCMP), the microcode is loaded when the AP starts, 300 pings of
1400 B with 0% loss.
* Regression: station WPA2-Personal (home access point), DHCP, ping to
8.8.8.8 (10/10), with the BA414E enabled.
Build checks: `./tools/checkpatch.sh -g` clean; `refresh.sh` leaves
`ev49n51a:wlan` unchanged; `ev49n51a:wlan` builds with XC32 without
warnings with the microcode downloaded, read from a file, with and without
the self-test, and without the BA414E; `ev49n51a:wlan` with Pinguino GCC
as in CI; `distclean` removes the downloaded files even when the option
was disabled before.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]