PruteanuVlad opened a new pull request, #18688:
URL: https://github.com/apache/nuttx/pull/18688

   ## Summary
   
   This adds support for the PBKDF2 algorithm in the ESP32 crypto driver. Here, 
it will take advantage of the hardware-accelerated implementation of SHA.
   
   The ESP32 hardware SHA engine does not support context save and restore: 
once `esp32_sha_finish()` is called, the hardware state is reset and cannot be 
resumed from a snapshot. This means the standard approach of saving and 
restoring `hw_ictx`/`hw_octx` via `memcpy` does not work here.
   To work around this, `esp32_pbkdf2_rekey()` rebuilds the HMAC key schedule 
from scratch before every `authcompute()` call.
   
   Additionally, `authcompute()` XORs `crd_key` in place with `HMAC_OPAD_VAL` 
and never undoes it. To keep the key clean across iterations, `esp32_pbkdf2` 
maintains `key_backup` and copies it into a scratch buffer `key_work` before 
each `authcompute()` call, so the `opad` mutation never corrupts the source.
   
   ## Impact
   
   Impact on user: this PR completes the support for the hardware accelerated 
PBKDF2 on ESP32, improving platform support
   Impact on build process: none
   Impact on documentation: added PBKDF2 support
   Impact on security: this implementation has been appropriately tested, see 
testing section.
   Impact on compatibility: none
   
   ## Testing
   
   
   Development was done using ESP32 DevkitC.
   Building was done on Ubuntu 24.04 VM.
   For testing, I ran the recently added PBKDF2 test which follows the official 
RFC documentation
   Results:
   
   ```
   nsh> pbkdf2
   hmac PBKDF2 SHA1 success
   hmac PBKDF2 SHA1 success
   hmac PBKDF2 SHA1 success
   hmac PBKDF2 SHA1 success
   hmac PBKDF2 SHA1 success
   hmac PBKDF2 SHA1 success
   hmac PBKDF2 SHA256 success
   hmac PBKDF2 SHA256 success
   hmac PBKDF2 SHA256 success
   hmac PBKDF2 SHA256 success
   hmac PBKDF2 SHA256 success
   hmac PBKDF2 SHA256 success
   ```


-- 
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]

Reply via email to