- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8.2k
drivers: crypto: Add STM32 HASH hardware driver #93923
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
drivers: crypto: Add STM32 HASH hardware driver #93923
Conversation
| Hello @bayrem-gharsellaoui, and thank you very much for your first pull request to the Zephyr project! | 
7a4ca92    to
    9d7a770      
    Compare
  
    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.
It looks good to me.
9d7a770    to
    16a2dea      
    Compare
  
    16a2dea    to
    7962423      
    Compare
  
    | @mathieuchopstm | 
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.
tests/crypto/crypto_hash (or another more adequate in-tree test) should be enabled to run with the added driver.
        d349810
      
    7962423    to
    d349810      
    Compare
  
            
          
                drivers/crypto/crypto_stm32_hash.c
              
                Outdated
          
        
      | return 0; | ||
| } | ||
|  | ||
| static const struct crypto_driver_api stm32_hash_api = { | 
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.
| static const struct crypto_driver_api stm32_hash_api = { | |
| static DEVICE_API(crypto, stm32_hash_funcs) = { | 
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.
Done
| 
 I see... zephyr offers crypto api that includes both - hash and encryption. However, API topic is out of scope of this PR. | 
83534f9    to
    5b096ea      
    Compare
  
    | Hello @ceolin | 
| @bayrem-gharsellaoui you have CI compliance issues that need to be corrected | 
4fc9d5d    to
    67d0df0      
    Compare
  
    | 
 Can you please run the CI again to check if it passes now ? | 
| 
 I'm not sure why this is failing in compliance check: 
 Even though I'm following the correct syntax:  Am I missing something ? | 
| 
 Commit author email should be the same as the Signed-off-by one. | 
| 
 It is: bayrem@debian:~/workspace/zephyr$ git config --global user.email
[email protected]
bayrem@debian:~/workspace/zephyr$ git config --global user.name
bayrem-gharsellaouiThe only thing I have doubt in is that (before the PR I guess) I changed my GitHub email address to be conform with the compliance check | 
| 
 git user name should not be attached. | 
| 
 Should I unset it and push again ? git config --global --unset user.name | 
| Please set  | 
| 
 Then amend your commits with interactive rebase and  | 
Add STM32 HASH driver with SHA-224/256 support for STM32U5 Signed-off-by: Bayrem Gharsellaoui <[email protected]>
Add device tree support for STM32 HASH peripheral on the nucleo_u575zi_q Signed-off-by: Bayrem Gharsellaoui <[email protected]>
Enable crypto.hash test on nucleo_u575zi_q board Signed-off-by: Bayrem Gharsellaoui <[email protected]>
67d0df0    to
    0b9cd05      
    Compare
  
    | 
 @JarmouniA it is Done | 
| 
 | 
| 
 All CI checks have passed | 
| 
 Great! This can now wait for approvals from subsys maintainers and then be mergeable | 
| Hi @bayrem-gharsellaoui! To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge. Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁 | 



Summary
This work uses the crypto hash API implementing the STM32 HASH accelerator, initially supporting only STM32U5, with support for SHA-224 and SHA-256 via the Zephyr crypto API.
Supported Hardware
nucleo_u575zi_qboard (STM32U5 series)Testing
Crypto test suite:
tests/crypto/crypto_hashas an application fornucleo_u575zi_qand it passedManual test sample:
I developed this example application to verify:
Notes
drivers/crypto/crypto_stm32.con purpose for consistency and maintainability.update/finish) is not yet implemented, but can be added later (using theHAL_HASHEx_xxx_Accumulate()APIs)Next Steps