Skip to content

Commit

Permalink
boards: enbables support for s32z270 hse crypto
Browse files Browse the repository at this point in the history
Enable test for s32z270 hash crypto.

Enable samples for cipher cryptoEndable samples for EBC, CBC,
CTR mode of cipher crypto.

Signed-off-by: Ha Duong Quang <[email protected]>
  • Loading branch information
haduongquang committed Oct 9, 2024
1 parent 519a733 commit f861b34
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 1 deletion.
18 changes: 18 additions & 0 deletions boards/nxp/s32z2xxdc2/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ The boards support the following hardware features:
+-----------+------------+-------------------------------------+
| LPI2C | on-chip | i2c |
+-----------+------------+-------------------------------------+
| HSE | on-chip | crypto |
+-----------+------------+-------------------------------------+

Other hardware features are not currently supported by the port.

Expand Down Expand Up @@ -163,6 +165,22 @@ ADC is provided through ADC SAR controller with 2 instances. Each ADC SAR instan
.. note::
All channels of an instance only run on 1 group channel at the same time.

CRYPTO
======

The Hardware Security Engine (HSE) supports cryptographic operations, including hashing and
symmetric ciphers, with capabilities for ECB, CBC, and CTR modes using RAM-based key catalogs
with 128-bit key lengths.

.. note::
Applications must format key catalogs before executing the first service.
The NXP S32 HSE CRYPTO provides a Kconfig option, `CONFIG_CRYPTO_NXP_S32_HSE_FORMAT_KEY_CATALOG`,

Check failure on line 177 in boards/nxp/s32z2xxdc2/doc/index.rst

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SphinxLint

boards/nxp/s32z2xxdc2/doc/index.rst:177 default role used (hint: for inline literals, use double backticks) (default-role)

Check failure on line 177 in boards/nxp/s32z2xxdc2/doc/index.rst

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SphinxLint

boards/nxp/s32z2xxdc2/doc/index.rst:177 default role used (hint: for inline literals, use double backticks) (default-role)
which is used for testing purposes to format both the NVM and RAM key catalogs.

By default, only MU0 is activated for use by the HSE to listen for requests, while other MUs
remain deactivated. If applications require the use of additional MUs, they must be activated
beforehand.

Programming and Debugging
*************************

Expand Down
1 change: 1 addition & 0 deletions boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ supported:
- counter
- adc
- i2c
- crypto
vendor: nxp
1 change: 1 addition & 0 deletions boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu0_D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ supported:
- counter
- adc
- i2c
- crypto
vendor: nxp
1 change: 1 addition & 0 deletions boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ supported:
- counter
- adc
- i2c
- crypto
vendor: nxp
1 change: 1 addition & 0 deletions boards/nxp/s32z2xxdc2/s32z2xxdc2_s32z270_rtu1_D.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ supported:
- counter
- adc
- i2c
- crypto
vendor: nxp
5 changes: 5 additions & 0 deletions samples/drivers/crypto/boards/s32z2xxdc2_s32z270_rtu0.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 NXP
# SPDX-License-Identifier: Apache-2.0

# Only used for test
CONFIG_CRYPTO_NXP_S32_HSE_FORMAT_KEY_CATALOG=y
9 changes: 9 additions & 0 deletions samples/drivers/crypto/boards/s32z2xxdc2_s32z270_rtu0.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

&mub0 {
status = "okay";
};
5 changes: 5 additions & 0 deletions samples/drivers/crypto/boards/s32z2xxdc2_s32z270_rtu1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 NXP
# SPDX-License-Identifier: Apache-2.0

# Only used for test
CONFIG_CRYPTO_NXP_S32_HSE_FORMAT_KEY_CATALOG=y
9 changes: 9 additions & 0 deletions samples/drivers/crypto/boards/s32z2xxdc2_s32z270_rtu1.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

&mub0 {
status = "okay";
};
2 changes: 1 addition & 1 deletion samples/drivers/crypto/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ CONFIG_CRYPTO_LOG_LEVEL_DBG=y
CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y

CONFIG_MAIN_STACK_SIZE=4096
CONFIG_MAIN_STACK_SIZE=8192
2 changes: 2 additions & 0 deletions samples/drivers/crypto/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ LOG_MODULE_REGISTER(main);
#define CRYPTO_DEV_COMPAT st_stm32_aes
#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_mcux_dcp)
#define CRYPTO_DEV_COMPAT nxp_mcux_dcp
#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_s32_crypto_hse_mu)
#define CRYPTO_DEV_COMPAT nxp_s32_crypto_hse_mu
#elif CONFIG_CRYPTO_NRF_ECB
#define CRYPTO_DEV_COMPAT nordic_nrf_ecb
#elif DT_HAS_COMPAT_STATUS_OKAY(renesas_smartbond_crypto)
Expand Down
5 changes: 5 additions & 0 deletions tests/crypto/crypto_hash/boards/s32z2xxdc2_s32z270_rtu0.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 NXP
# SPDX-License-Identifier: Apache-2.0

# Only used for test
CONFIG_CRYPTO_NXP_S32_HSE_FORMAT_KEY_CATALOG=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

&mub0 {
status = "okay";
};
5 changes: 5 additions & 0 deletions tests/crypto/crypto_hash/boards/s32z2xxdc2_s32z270_rtu1.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Copyright 2024 NXP
# SPDX-License-Identifier: Apache-2.0

# Only used for test
CONFIG_CRYPTO_NXP_S32_HSE_FORMAT_KEY_CATALOG=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/

&mub0 {
status = "okay";
};
3 changes: 3 additions & 0 deletions tests/crypto/crypto_hash/src/main.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2022 Intel Corporation
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -13,6 +14,8 @@
#define CRYPTO_DRV_NAME CONFIG_CRYPTO_MBEDTLS_SHIM_DRV_NAME
#elif DT_HAS_COMPAT_STATUS_OKAY(renesas_smartbond_crypto)
#define CRYPTO_DEV_COMPAT renesas_smartbond_crypto
#elif DT_HAS_COMPAT_STATUS_OKAY(nxp_s32_crypto_hse_mu)
#define CRYPTO_DEV_COMPAT nxp_s32_crypto_hse_mu
#else
#error "You need to enable one crypto device"
#endif
Expand Down

0 comments on commit f861b34

Please sign in to comment.