Commit graph

140 commits

Author SHA1 Message Date
Julien Panis
e0f02d93a6 drivers: crypto: cc23x0: Add support for DMA mode
Two DMA channels are assigned to AES channels A and B respectively.
Each channel A/B has an interface to control the conditions that will
generate requests on the related DMA channel: trigger condition,
R/W address, and DMA done action.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-06-11 16:06:55 -07:00
Lin Yu-Cheng
b2e13bd6c3 driver: crypto: add crypto driver for rts5912
Add crypto driver for Realtek rts5912

Signed-off-by: Lin Yu-Cheng <lin_yu_cheng@realtek.com>
2025-06-07 13:29:07 +01:00
Flavio Ceolin
dfde32144a drivers; crypto: Remove TinyCrypt shim
TC crypto driver was depecrated in 4.0 release. Time to
remove it \o/

Signed-off-by: Flavio Ceolin <flavio.ceolin@gmail.com>
2025-05-23 17:41:06 -04:00
Yunshao Chiang
8f8b223ff2 drivers: crypto: add it51xxx sha256 driver
Implement a crypto sha256 driver for it51xxx series.

Signed-off-by: Yunshao Chiang <Yunshao.Chiang@ite.com.tw>
2025-05-16 19:07:37 +02:00
Julien Panis
fa8d5177c1 drivers: crypto: Add support for cc23x0 AES
Add support for AES module to cc23x0 SoC. The driver supports the
following modes:
- ECB encryption only (since decryption is not supported by the HW)
- CTR
- CCM

Signed-off-by: Stoyan Bogdanov <sbogdanov@baylibre.com>
Signed-off-by: Julien Panis <jpanis@baylibre.com>
2025-03-07 19:47:11 +01:00
Benjamin Cabé
6c735705cd drivers: crypto: fix spelling of "below"
s/bellow/below/

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2025-02-19 18:51:13 +01:00
Jilay Pandya
0ab69fb19e drivers: crypto: crypto_ataes132a fix buffer overrun issue
fix buffer overrun issue by assigning more bytes to the param buf

Signed-off-by: Jilay Pandya <jilay.pandya@outlook.com>
2024-12-29 05:51:51 +01:00
Pieter De Gendt
45be45d7e0 drivers: crypto: Place API into iterable section
Add wrapper DEVICE_API macro to all crypto_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-12-06 12:13:37 +01:00
Johan Hedberg
8b02141ca7 Bluetooth: Controller: Replace BT_CTLR with HAS_BT_CTLR
Deprecate BT_CTLR, and add a new HAS_BT_CTLR as a virtual option which
specific users (like BT_LL_SW_SPLIT) select. This also means that we can
remove all places that were forcefully enabling the BT_CTLR option, and
instead we now depend on devicetree to get some local LL HCI driver
enabled which in turn also enables the HAS_BT_CTLR option.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-12-03 10:16:44 +01:00
Valerio Setti
dbda4642cd drivers: crypto: deprecated TinyCrypt shim driver
As part of the deprecation process of TinyCrypt started in #79566,
this commit set the TinyCrypt based crypto shim driver as
deprecated.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-05 13:44:20 -06:00
Reto Schneider
1790eda851 drivers: crypto: Add initial SiM3U1xx support
This driver makes use of the hardware AES acceleration, using DMA
transfers.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-10-24 17:52:05 +02:00
Lucas Dietrich
11abb5e4fc drivers: crypto: Fix pointer type warnings in STM32 AES driver
This patch resolves compiler warnings related to mismatched pointer types
between the STM32L4 and generic STM32 AES HAL by introducing CAST_VEC
macro.

Fix github CI warning

Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
2024-10-11 09:28:12 +02:00
Lucas Dietrich
ad431dcc23 drivers: crypto: Add support for STM32L4 AES accelerator
This patch completes the addition of support for the STM32L4 AES
accelerator by introducing conditional handling for different STM32 AES
HAL variants. Key changes include:

- Created device tree bindings `st,stm32l4-aes` for STM32L4 AES
- Replaced `copy_reverse_words` with `copy_words_adjust_endianness`
to handle endianness conversion for different variants.

Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
2024-10-11 09:28:12 +02:00
Lucas Dietrich
8f0de8455d drivers: crypto: Refactor encryption and decryption functions for STM32 AES
This patch introduces a unified function pointer approach to handle
encryption and decryption operations for the STM32 AES accelerator.

- Replace separate `do_encrypt` and `do_decrypt` functions with a generic
`do_aes` function, using function pointers to AES HAL functions.

Signed-off-by: Lucas Dietrich <ld.adecy@gmail.com>
2024-10-11 09:28:12 +02:00
Saravanan Sekar
c143cbaa7c drivers: crypto: use reset api for crypto peripheral reset
Replace direct HAL api by zephyr reset api framework for crypto
peripheral block reset.

Signed-off-by: Saravanan Sekar <saravanan@linumiz.com>
2024-07-28 07:31:25 +03:00
Ioannis Damigos
0a0bccabd8 drivers/smartbond: Fix PM device runtime support
Removed PM device runtime support from drivers in PD_SYS domain.

Update the rest device drivers to call pm_device_runtime_get/put()
functions when CONFIG_PM_DEVICE_RUNTIME is enabled.

Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
2024-06-18 14:36:38 -04:00
Benjamin Cabé
94ded47fa7 drivers: crypto: make driver API and conf structs const
Save precious RAM by making sure driver API and config structs are
declared as const

Signed-off-by: Benjamin Cabé <benjamin@zephyrproject.org>
2024-06-13 16:42:35 -04:00
Tomi Fontanilles
c1342b3aa9 modules: mbedtls: remove the default enabling of features
In an effort to shave off code size, remove out-of-the-box
enabling of crypto features (except SHA-256).

Configurations are adjusted to enable what they need.

Bonuses:

- When enabled, AES now defaults to using a smaller version
(`CONFIG_MBEDTLS_AES_ROM_TABLES` isn't default enabled anymore,
and if enabled, `CONFIG_MBEDTLS_AES_FEWER_TABLES` defaults to y).

- Conditions around Mbed TLS Kconfig options have been improved
to reflect the reality of the dependencies.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-31 16:33:06 -05:00
Ioannis Karachalios
44e9f2ca8f drivers: crypto: smartbond: Crypto Driver Update
This commit should fix the followings:
1. Suppress compiler warnings
2. Cryptographic mode should first be exercised before
   applying the secure key
3. In-memory word swap operations should be omitted as
   the key should reside in the flash memory and so any
   write access should raise a busfault exception

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-30 16:51:03 -05:00
Tomi Fontanilles
3efdbe6c0c modules: mbedtls: rename CONFIG_MBEDTLS_MAC_*_ENABLED and rm duplicates
Remove the `_MAC` part because those Kconfig options enable only hash
algorithms, nothing MAC-related, and the `_ENABLED` part to align the
naming to the Mbed TLS defines (plus we don't need such a part).

As a bonus, enabling SHA-256 does not automatically enable SHA-224
anymore.

See the migration guide entries for more details on the practical
changes.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-29 08:39:26 +02:00
Chris LaFlash
e94adf1e2b drivers: crypto: stm32: AES CTR IV is 16bytes
AES-CTR IV is the same as the block size 128-bits(16 bytes)
 regardless of key size.

Signed-off-by: Chris LaFlash <chris-github@laflash.com>
2024-05-28 09:54:30 +02:00
Ioannis Karachalios
63eccd3b78 drivers: crypto: smartbond: Add support for PM
This commit should add all the functionality needed for the crypto
driver to work when PM is enabled.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2024-05-23 07:49:37 -04:00
Tomi Fontanilles
9bbff1ac84 drivers: crypto: mbedtls: fix dependency
Explicitly enable SHA-512 now that it is not enabled by default
anymore.

Signed-off-by: Tomi Fontanilles <tomi.fontanilles@nordicsemi.no>
2024-05-03 14:47:52 -07:00
Ruibin Chang
1d74cb74d9 drivers/crypto/crypto_it8xxx2_sha_v2.c: implement sha v2 for it82xx2 series
Implement a new version crypto_it8xxx2_sha_v2 driver for it82xx2 series.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2024-04-24 09:55:46 +02:00
Jun Lin
6057a83060 drivers: entropy: npcx: add rng driver support
This commit add the rng driver support by using the npcx drgb API.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2024-03-14 18:14:04 +00:00
Reto Schneider
d5c3323e81 drivers: crypto: stm32: Allow immutable key
The passed key does not have to be modifiable. Adapting the signature to
reflect this.

This allows the following commit to change cipher_ctx:🔑:bit_stream
to be pointing to an immutable key.

Signed-off-by: Reto Schneider <reto.schneider@husqvarnagroup.com>
2024-03-07 10:58:23 +00:00
Yonatan Schachter
4ef0e1221d sys/util.h: Add IS_ALIGNED macro
Added IS_ALIGNED macro to check if a pointer is aligned to
a given alignment. Additionally, removed a macro with a
conflicting name in drivers/crypto_intel.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2024-02-26 11:46:30 +01:00
Jun Lin
fde31c03c5 driver: crypto: SHA: npcx: fix SHA driver for npcx4 QS chip
The commit fixes the SHA driver because the ROM API has the following
changes from ES to QS chip:
1. base addres: from 0x13c -> 0x148
2. required SHA context buffer size : from 228 -> 240 bytes

This change also adds a check for the pre-allocated buffer size of the
SHA context when the driver initiliazes.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-12-12 09:52:04 +00:00
Ioannis Karachalios
6f6066cdf1 drivers: crypto: smartbond: Support crypto accelerator
Add support for the crypto engine.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
2023-10-26 09:47:23 +02:00
Lukasz Hawrylko
5d113be341 drivers: crypto: add support for stm32wb family
STM32WB MCUs have two AES peripherals: AES1 for application use and AES2
dedicated for network stack. This patch modifies stm32 crypto driver to
use AES1 peripheral when building for STM32WB.

Signed-off-by: Lukasz Hawrylko <lukasz@hawrylko.pl>
2023-10-20 15:05:26 +02:00
Jun Lin
db8855aaa3 driver: crypto: SHA: npcx: change to support npcx4
The pre-alloacted size of the buffer for the SHA ROM API code increases
in npcx4 chip. This commit adds a new property context-buffer-size to
sha0 DT node in npcx9 and npcx4 separately. The driver can pre-allocate
buffer with the correct size based on the property.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2023-10-05 09:14:05 +01:00
Manuel Argüelles
ca3310145f drivers: select nocache only when supported
NOCACHE_MEMORY depends on ARCH_HAS_NOCACHE_MEMORY_SUPPORT, so
don't try to select the symbol if not supported.

Signed-off-by: Manuel Argüelles <manuel.arguelles@nxp.com>
2023-09-26 15:09:51 +02:00
Gerard Marull-Paretas
691facc20f include: always use <> for Zephyr includes
Double quotes "" should only be used for local headers.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-14 13:49:58 +02:00
Erwan Gouriou
e35974c804 drivers: crypto: stm32: Replace buffer len assert by error logic
In case asserts are deactivated, no check is done on buffers length.
Remove asserts and return an error when lengths are not correct.

Check error in case length is set by API user.

Signed-off-by: Erwan Gouriou <erwan.gouriou@st.com>
2023-08-30 10:19:07 +02:00
Fabio Baltieri
323ebef2de drivers: crypto: it8xxx2_evb: fix a shadow variable error
Fix a build error:

crypto_it8xxx2_sha.c:99:26: warning: declaration of 'i' shadows a
previous local [-Wshadow]
   99 |                 for (int i = 0; i < ARRAY_SIZE(sha256_k); i++) {
      |                          ^ crypto_it8xxx2_sha.c:88:13: note:
shadowed declaration is here
   88 |         int i;

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-28 19:17:46 +01:00
Pieter De Gendt
6758777ddf drivers: crypto: Add NXP MCUX DCP driver
Add a shim driver for NXP's Data Co-Processor (DCP) driver.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-07-26 09:09:48 +02:00
Francois Ramu
05a7ad1087 drivers: crypto: stm32h5 CRYP_DATATYPE_8B define in hal
Define only once the CRYP_DATATYPE_8B for the stm32h5 serie
This macro is in modules/hal/stm32/stm32cube/stm32h5xx/d
rivers/include/stm32h5xx_hal_cryp.h

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2023-07-24 13:25:23 +00:00
Dino Li
fa49f77973 drivers/crypto/it8xxx2: add support for SHA256 hardware accelerator
Add SHA256 accelerator support for it8xxx2 series.

This driver passes the following test:
tests/crypto/crypto_hash/

Signed-off-by: Dino Li <Dino.Li@ite.com.tw>
2023-07-07 09:24:47 +02:00
Wojciech Slenska
80217de14e dts: arm: stm32h5: Add aes node
Add hw crypto support in stm32h5 dtsi. Add missing define in driver.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-05-16 18:19:26 +02:00
Manimaran A
3cc7d37b70 drivers: crypto: MEC172x crypto driver supporting hash
Implement zephyr crypto driver hash API's using calls to
MEC172x ROM hash API's. Hardware supports zephyr driver
hash modes: SHA-224, 256, 384, and 512. Driver supports
synchronous (blocking) mode at this time.

Signed-off-by: Manimaran A <manimaran.a@microchip.com>
2023-05-16 12:07:24 +02:00
Gerard Marull-Paretas
1eb683a514 device: remove redundant init functions
Remove all init functions that do nothing, and provide a `NULL` to
*DEVICE*DEFINE* macros.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-19 10:00:25 +02:00
Pieter De Gendt
6b532ff43e treewide: Update clock control API usage
Replace all (clock_control_subsys_t *) casts with (clock_control_subsys_t)

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2023-04-05 10:55:46 +02:00
Henrik Brix Andersen
c41dd36de2 drivers: kconfig: unify menuconfig title strings
Unify the drivers/*/Kconfig menuconfig title strings to the format
"<class> [(acronym)] [bus] drivers".

Including both the full name of the driver class and an acronym makes
menuconfig more user friendly as some of the acronyms are less well-known
than others. It also improves Kconfig search, both via menuconfig and via
the generated Kconfig documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-28 15:06:06 +02:00
Chao Song
96271c77bf drivers: crypto: don't return uninitialized local variable
It should never be intended to return an uninitialized
variable from a function.

Remove the use of the uninitialized variable to fix the bug.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
2023-01-03 13:36:46 +01:00
Jun Lin
885695f425 drivers: crypto: SHA: npcx: add support for SHA hardware accelerator
NPCX9 series chips include a SHA hardware accelerator, which supports
SHA256/SHA384/SHA512 hashing and a library (APIs) in the on-chip ROM.
This commit adds the driver support by wrapping the on-chip ROM APIs.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2022-12-21 10:10:10 +01:00
Flavio Ceolin
13bedbe1c9 intel: ace15: Enabling sha driver by default
Enable intel-adsp-sha driver y default when it is enabled in DT.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-10-31 12:45:33 -07:00
Flavio Ceolin
77a2aaa93e crypto: intel-sha: Rename to intel,adsp-sha
Rename DT binding to intel,adsp-sha.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-10-31 12:45:33 -07:00
Flavio Ceolin
da520fe6fb crypto: intel-sha: Fix assorted warnings
There were multiple warnings due implicit type conversions.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-10-31 12:45:33 -07:00
Flavio Ceolin
6ad8b4626f crypto: intel-sha: Support multiple instances
Support multiple DTS instances in the C code, also
just initialize devices that are not disabled.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2022-10-31 12:45:33 -07:00
Kumar Gala
310190ca01 drivers: crypto: Update Kconfig
* Utilize DT_HAS_<COMPAT>_ENABLED for devicetree based drivers

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-08-30 10:43:12 +00:00