Skip to content

Commit 84a10b1

Browse files
committed
rp23xx: add hardware SHA-256 cryptodev support
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>
1 parent f255cd8 commit 84a10b1

5 files changed

Lines changed: 639 additions & 2 deletions

File tree

arch/arm/src/rp23xx/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,8 @@ if(CONFIG_WATCHDOG)
8585
list(APPEND SRCS rp23xx_wdt.c)
8686
endif()
8787

88+
if(CONFIG_CRYPTO_CRYPTODEV_HARDWARE)
89+
list(APPEND SRCS rp23xx_crypto.c)
90+
endif()
91+
8892
target_sources(arch PRIVATE ${SRCS})

arch/arm/src/rp23xx/Make.defs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,7 @@ endif
8888
ifeq ($(CONFIG_WATCHDOG),y)
8989
CHIP_CSRCS += rp23xx_wdt.c
9090
endif
91+
92+
ifeq ($(CONFIG_CRYPTO_CRYPTODEV_HARDWARE),y)
93+
CHIP_CSRCS += rp23xx_crypto.c
94+
endif

arch/arm/src/rp23xx/hardware/rp23xx_sha256.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
/* Register bit definitions *************************************************/
4949

5050
#define RP23XX_SHA256_CSR_MASK (0x00001317)
51-
#define RP23XX_SHA256_CSR_BSWAP (1 << 18)
51+
#define RP23XX_SHA256_CSR_BSWAP (1 << 12)
5252
#define RP23XX_SHA256_CSR_DMA_SIZE_MASK (0x00000300)
5353
#define RP23XX_SHA256_CSR_ERR_WDATA_NOT_RDY (1 << 4)
5454
#define RP23XX_SHA256_CSR_SUM_VLD (1 << 2)

0 commit comments

Comments
 (0)