intel_sha_set_resume_length_dw1() never reports errors
and always returns 0.
The error check at the call site is therefore dead code.
Make the function void and drop the unused error handling.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
intel_sha_set_ctl_enable() never reports errors
and always returns 0.
The error check at the call site is therefore dead code.
Make the function void and drop the unused error handling.
Signed-off-by: Gaetan Perrot <gaetan.perrot@spacecubics.com>
rts5913_sha256_update was changed in #94218, but this function passes
it's input into rts5912_sha256_process also.
Signed-off-by: Jeremy Bettis <jbettis@google.com>
Using "pkt->out_len" as the output length of "psa_cipher_[en|de]crypt"
caused a crash in RISCV 64 bits platforms due to misaligned address
access.
The solution is to add a temporary value on the stack to store this lenght
and only after the [en|de]cryption copy it to "pkt->out_len".
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
drivers/crypto/crypto_mbedtls_shim.c:310:3: error: label followed by a
declaration is a C23 extension [-Werror,-Wc23-extensions]
uint16_t tag_len = ctx->mode_params.ccm_info.tag_len;
^
Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
Retrieve the desired tag length from the "struct cipher_ctx" being passed
to "cipher_begin_session()" when using CCM.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Add device tree node for MU instances that will be used by HSE and RTU
for s32z270.
Add support hash crypto for NXP S32 with Algo 2:
SHA224, SHA256, SHA384 and SHA512.
Add support cipher crypto with ECB, CBC and CTR mode by using ram key
catalog.
Add support 128/256 bits ram key length.
Signed-off-by: Ha Duong Quang <ha.duongquang@nxp.com>
Add a new function to free an mbedtls_shim session:
'mbedtls_free_session()'. Together with 'mbedtls_get_unused_session()',
these will be the only entry points to acquire/release sessions.
In this way it's easier to ensure that the mutex is properly held while
setting the 'in_use' parameter.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Move mbedtls_get_unused_session_index() at the top of the file and leave
cipher and hash functions below.
Signed-off-by: Valerio Setti <vsetti@baylibre.com>
Use the "zephyr-keep-sorted-start/stop" comment to have CI check
the alphabetical order of includes, to help reducing the chance
of conflicts while contributing drivers.
Signed-off-by: Josuah Demangeon <me@josuah.net>
Use STM32_CLOCK_INFO(), STM32_DT_INST_CLOCK_INFO(),
STM32_CLOCK_INFO_BY_NAME() and STM32_DT_INST_CLOCK_INFO_BY_NAME()
helper macros in STM32 drivers.
Using these macros ensure the clock division factor is properly
populated according to DT information. Prior these changes some
drivers only got the bus and bits position information and missed
the clock division information which is fine only when this division
factor information is 0.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
- **Fix session mutex handling:** Ensure the `mtls_sessions_lock` is
always released in `mtls_get_unused_session_index` on failure
to prevent deadlocks.
- **Protect `in_use` flag:** Added mutex protection when setting
`in_use = false` in free functions.
- **Cleanup on setup failure:** Added calls to `mbedtls_*_free()`
in `mtls_session_setup()` when key initialization fails.
- **Free logic fix:** Corrected `if/else` structure in
`mtls_session_free()` to ensure the correct context is freed.
Signed-off-by: Badr Bacem KAABIA <badrbacemkaabia@gmail.com>
Remove erroneous calculation of `apkt->pkt->out_len` in
`mtls_ccm_decrypt_auth` and `mtls_gcm_decrypt_auth`.
The output length should be handled by the caller or the
AEAD decryption process itself.
Signed-off-by: Badr Bacem KAABIA <badrbacemkaabia@gmail.com>
Coverity reported an untrusted loop bound caused by a missing check on
the count value in ataes132a_send_command() for the response received
from the device. As per datasheet section 6.1, count should be at least
3 bytes (1 byte for count, and 2 bytes for the 16 bits CRC).
While I'm expecting this condition to be very rare, it doesn't hurt to
implement a proper checking and report an error if count<3.
Coverity CID: 434625
Signed-off-by: Loic Domaigne <tech@domaigne.com>
Previous commit made the input buffer of the hash packet constant.
Let's therefore adapt typing where used, and remove inappropriate
casts of constant buffers to non-constant ones.
All the "backend" hashing functions already take a constant input,
these changes only affect the "plumbing" between the Zephyr crypto
API and the actual implementation where applicable.
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
Use a temporary variable to store and compare the reference time
instead of calling the time function multiple times,
which may lead to slight mismatches in comparison due to timing drift.
Signed-off-by: Elmo Lan <elmo_lan@realtek.com>
stm32 crypto driver requires a reset control hence ensure that
CONFIG_RESET is properly selected to allow proper build.
Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Coverity reported a memory - illegal accesses when using memset in
ataes132a_aes_ecb_block(). This can happen when the input block is
exactly 16 bytes: memset(¶m_buffer[19], 0x0, 0) is called. But this
is an undefined behaviour in C even if size is 0, as ¶m_buffer[19]
is an invalid pointer.
The fix consists of simply skipping memset() in this case, since there's
nothing to zero out.
Coverity CID: 434642
Signed-off-by: Loic Domaigne <tech@domaigne.com>
Utilize a code spell-checking tool to scan for and correct spelling errors
in `Kconfig` files within the `drivers` directory.
Additionally, incorporates a fix recommended by the reviewer.
Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
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>
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>
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>
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>
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>
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>
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>
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>