-
Notifications
You must be signed in to change notification settings - Fork 7.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(wpa_supplicant): Add optimized PSK impl (IDFGH-14280) #15073
base: master
Are you sure you want to change the base?
Conversation
👋 Hello ivq, we appreciate your contribution to this project! 📘 Please review the project's Contributions Guide for key guidelines on code, documentation, testing, and more. 🖊️ Please also make sure you have read and signed the Contributor License Agreement for this project. Click to see more instructions ...
Review and merge process you can expect ...
|
Signed-off-by: Chien Wong <[email protected]>
|
||
void fast_psk_f(const char *password, size_t password_len, const uint8_t *ssid, size_t ssid_len, uint32_t count, uint8_t digest[SHA1_OUTPUT_SZ]) | ||
{ | ||
struct fast_psk_context ctx_, *ctx = &ctx_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Big stack usage(276 bytes). Maybe replace with malloc?
@ivq Thank you for the contribution, give me some time to go through this. |
PUT_UINT32_BE(count, ctx->inner.block[1].bytes, ssid_len); | ||
pad_blocks(&ctx->inner, SHA1_BLOCK_SZ + ssid_len + 4); | ||
|
||
sha1_setup(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calling task will hold the SHA1 lock for a long time so other tasks may suffer from starvation. If this could be an issue, we could mitigate.
Description
Add an optimized Wi-Fi PSK implementation.
Resolves #15072 .
ESP32 is not supported as it makes the impl complex a lot as the SHA-1 of ESP32 does not support interleaving operation. fastpbkdf2 has handled the oddness of it and I do not want to do it again.
Also, it is using typical SHA-1 mode rather than DMA mode as DMA mode would be far more complex: There are GDMA and non-GDMA DMA, and the DMA is a shared resource so proper locking is needed and so on. It would be hard not to adjust the hal architecture when using DMA mode. I just want it to be simple.
For benchmark result, see #15072.
Main issue of the impl is that it is not a generic PBKDF2 and depends on hal directly, I believe. However, this is a trade-off we have to pay for optimal efficiency.
Related
Testing
Test cases are to be added.
Checklist
Before submitting a Pull Request, please ensure the following: