Skip to content

boards/arm/rp23xx: add hardware SHA-256 cryptodev support#18681

Merged
lupyuen merged 1 commit intoapache:masterfrom
karaketir16:crypto-rp23xx
Apr 10, 2026
Merged

boards/arm/rp23xx: add hardware SHA-256 cryptodev support#18681
lupyuen merged 1 commit intoapache:masterfrom
karaketir16:crypto-rp23xx

Conversation

@karaketir16
Copy link
Copy Markdown
Contributor

Add an RP23xx hardware crypto driver for /dev/crypto with SHA-256 support backed by the RP2350 SHA accelerator.

Wire the new driver into the RP23xx ARM build and register CRYPTO_SHA2_256 through cryptodev.

Also fix the RP23xx SHA256 CSR BSWAP bit definition in both the ARM and RISC-V RP23xx headers. The previous value used bit 18, but the RP2350 hardware uses bit 12. Without this fix, the accelerator hashed input words with the wrong byte order and produced incorrect digests.


It is faster than crypto/cryptosoft.c.

NuttShell (NSH) NuttX-12.13.0
nsh> time hash
hash sha256 success
hash sha256 success
hash sha256 success

0.4900 sec

------------------------------------

NuttShell (NSH) NuttX-12.13.0
nsh> time hash
hash sha256 success
hash sha256 success
hash sha256 success

0.0400 sec

@karaketir16 karaketir16 requested a review from jerpelea as a code owner April 6, 2026 19:07
@karaketir16 karaketir16 changed the title rp23xx: add hardware SHA-256 cryptodev support boards/arm/rp23xx: add hardware SHA-256 cryptodev support Apr 6, 2026
@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: L The size of the change in this PR is large labels Apr 7, 2026
xiaoxiang781216
xiaoxiang781216 previously approved these changes Apr 7, 2026
@simbit18
Copy link
Copy Markdown
Contributor

simbit18 commented Apr 7, 2026

Hi @karaketir16 please fix

../nuttx/tools/checkpatch.sh -c -u -m -g  f255cd870bcef2979f04e4945b736a5dec9974fb..HEAD
Used config files:
    1: .codespellrc
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/rp23xx/rp23xx_crypto.c:313:79: error: Long line found
Error: /home/runner/work/nuttx/nuttx/nuttx/arch/arm/src/rp23xx/rp23xx_crypto.c:462:79: error: Long line found
Some checks failed. For contributing guidelines, see:
  https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md
Error: Process completed with exit code 1.

Add an RP23xx hardware crypto driver for /dev/crypto with SHA-256
support backed by the RP2350 SHA accelerator.

Wire the new driver into the RP23xx ARM build and register
CRYPTO_SHA2_256 through cryptodev.

Also fix the RP23xx SHA256 CSR BSWAP bit definition in both the ARM and
RISC-V RP23xx headers. The previous value used bit 18, but the RP2350
hardware uses bit 12. Without this fix, the accelerator hashed input
words with the wrong byte order and produced incorrect digests.

Signed-off-by: karaketir16 <osmankaraketir@gmail.com>
@karaketir16
Copy link
Copy Markdown
Contributor Author

https://github.com/apache/nuttx/actions/runs/24106742084/job/70331973802#step:10:615

2026-04-07T22:40:30.5983580Z gzip: stdin: not in gzip format
2026-04-07T22:40:30.5986757Z tar: Child returned status 1
2026-04-07T22:40:30.5987301Z tar: Error is not recoverable: exiting now
2026-04-07T22:40:30.5987676Z make[3]: *** [Makefile:34: libyuv.tar.gz] Error 2

I don't know why it failed, seems irrelevant with this PR.

@lupyuen
Copy link
Copy Markdown
Member

lupyuen commented Apr 8, 2026

@karaketir16 I restarted the build.

@lupyuen
Copy link
Copy Markdown
Member

lupyuen commented Apr 8, 2026

BTW we're testing the new NuttX Build Monitor (pic below), which will help us discover build problems: https://lupyuen.github.io/nuttx-github-jobs/build-monitor

The build seems to be failing due to problems at chromium.googlesource.com: #18562 (comment)

Screenshot 2026-04-08 at 10 38 21 AM

https://lupyuen.github.io/nuttx-github-jobs/build-monitor

@lupyuen
Copy link
Copy Markdown
Member

lupyuen commented Apr 8, 2026

Here's the fix for the failing build, let's wait for it to be merged:

@lupyuen lupyuen merged commit d09bfc0 into apache:master Apr 10, 2026
89 of 193 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Arch: risc-v Issues related to the RISC-V (32-bit or 64-bit) architecture Size: L The size of the change in this PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants