Skip to content
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

Add STM32MP13 HAL support for more SHA types #8231

Merged
merged 2 commits into from
Dec 2, 2024

Conversation

LinuxJedi
Copy link
Member

Description

This adds STM32 HAL support for:

  • SHA384
  • SHA512 (with -224 and -256)
  • SHA3 (all variants apart from SHAKE)

The partial FIFO block calculations have been adjusted based in the STM32 code to support the larger hash sizes.

This should work with other chips such as the STM32U5xx, but is not enabled for that yet.

Testing

Tested using the wolfCrypt test suite and benchmark suite on an STM32MP135F-DK.

error    test passed!
MEMORY   test passed!
base64   test passed!
asn      test passed!
RANDOM   test passed!
MD5      test passed!
SHA      test passed!
SHA-224  test passed!
SHA-256  test passed!
SHA-384  test passed!
SHA-512  test passed!
SHA-512/224  test passed!
SHA-512/256  test passed!
SHA-3    test passed!
Hash     test passed!
HMAC-MD5 test passed!
HMAC-SHA test passed!
HMAC-SHA224 test passed!
HMAC-SHA256 test passed!
HMAC-SHA384 test passed!
HMAC-SHA512 test passed!
HMAC-SHA3   test passed!
HMAC-KDF    test passed!
PRF         test passed!
TLSv1.3 KDF test passed!
GMAC     test passed!
Chacha   test passed!
POLY1305 test passed!
ChaCha20-Poly1305 AEAD test passed!
DES      test passed!
DES3     test passed!
AES      test passed!
AES192   test passed!
AES256   test passed!
AES-CBC  test passed!
AES-GCM  test passed!
RSA      test passed!
DH       test passed!
ECC      test passed!
ECC buffer test passed!
CURVE25519 test passed!
ED25519  test passed!
logging  test passed!
time     test passed!
mutex    test passed!
Test complete
SHA-384                     86 MiB took 1.000 seconds,   85.938 MiB/s
SHA-512                     86 MiB took 1.000 seconds,   85.840 MiB/s
SHA-512/224                 86 MiB took 1.000 seconds,   86.035 MiB/s
SHA-512/256                 86 MiB took 1.000 seconds,   85.938 MiB/s
SHA3-224                    84 MiB took 1.000 seconds,   84.473 MiB/s
SHA3-256                    85 MiB took 1.000 seconds,   85.156 MiB/s
SHA3-384                    89 MiB took 1.000 seconds,   89.453 MiB/s
SHA3-512                    92 MiB took 1.000 seconds,   91.699 MiB/s

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

This adds STM32 HAL support for:

* SHA384
* SHA512 (with -224 and -256)
* SHA3 (all variants apart from SHAKE)

The partial FIFO block calculations have been adjusted based in the
STM32 code to support the larger hash sizes.

This should work with other chips such as the STM32U5xx, but is not
enabled for that yet.
@LinuxJedi LinuxJedi requested a review from dgarske November 27, 2024 15:07
@LinuxJedi
Copy link
Member Author

SHAKE hardware acceleration is also possible if we need it.

Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes all look good. I'll need to do some regression testing on other STM32 parts to make sure the hashing changes do not break anything.

wolfcrypt/src/port/st/stm32.c Show resolved Hide resolved
@dgarske dgarske self-assigned this Nov 27, 2024
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @LinuxJedi
Tested successfully on STM32U585, STM32U5A9 and STM32H7.
Also pushed a small issue with wolfssl_examples.c broken from a previous PR.

@LinuxJedi
Copy link
Member Author

Thanks for running those tests. I have some STM32Fs here if you want me to run additional tests, but I don't envisage them being different. Good catch on your commit.

@LinuxJedi LinuxJedi mentioned this pull request Nov 29, 2024
4 tasks
@dgarske dgarske self-requested a review November 29, 2024 16:40
@dgarske dgarske removed their assignment Nov 29, 2024
@dgarske
Copy link
Contributor

dgarske commented Nov 29, 2024

@wolfSSL-Bot this PR is ready for merge but it needs an additional reviewer.

@JacobBarthelmeh JacobBarthelmeh merged commit 015d47b into wolfSSL:master Dec 2, 2024
143 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants