Skip to content

Commit

Permalink
nrf_security: Minor compliance fixes
Browse files Browse the repository at this point in the history
No funtional change here, just fixes spacing
issues causing compliance failures in
nrf_security and TFM.

Signed-off-by: Georgios Vasilakis <[email protected]>
  • Loading branch information
Vge0rge authored and carlescufi committed Oct 4, 2024
1 parent ce4acf2 commit f456180
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion include/tfm/platform_otp_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern "C" {
#endif

enum tfm_otp_element_id_t {
PLAT_OTP_ID_LCS = UINT32_MAX -1,
PLAT_OTP_ID_LCS = UINT32_MAX - 1,
PLAT_OTP_ID_MAX = UINT32_MAX,
};

Expand Down
4 changes: 1 addition & 3 deletions modules/trusted-firmware-m/tfm_boards/external_core.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ if(NOT PSA_CRYPTO_EXTERNAL_CORE)
return()
endif()

# Note that

# Adjusting includes from spe-CMakeLists.txt which has the following heading:
#
# This CMake script is prepard by TF-M for building the non-secure side
Expand Down Expand Up @@ -47,7 +45,7 @@ if(TARGET psa_interface)
# Mbed TLS (mbedcrypto) PSA headers
${ARM_MBEDTLS_PATH}/library
${ARM_MBEDTLS_PATH}/include
${ARM_MBEDTLS_PATH}/include/library
${ARM_MBEDTLS_PATH}/include/library
)
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ install(
FILES
${OBERON_PSA_CORE_PATH}/include/mbedtls/build_info.h
${OBERON_PSA_CORE_PATH}/include/mbedtls/config_psa.h
DESTINATION
DESTINATION
${INSTALL_INTERFACE_INC_DIR}/mbedtls
)

Expand Down
6 changes: 3 additions & 3 deletions subsys/nrf_security/cmake/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -167,16 +167,16 @@ endmacro()
#
macro(nrf_security_add_zephyr_options_library lib_name)
if(TARGET zephyr_interface)
# Add an an filtered version of zephyr_interface (PSA crypto interface filtered out)
# Add an filtered version of zephyr_interface (PSA crypto interface filtered out)
target_compile_options(${lib_name} PRIVATE $<TARGET_PROPERTY:zephyr_interface,INTERFACE_COMPILE_OPTIONS>)
target_compile_definitions(${lib_name} PRIVATE $<TARGET_PROPERTY:zephyr_interface,INTERFACE_COMPILE_DEFINITIONS>)
# Ensure that the PSA crypto interface include folder isn't added in library builds (filtered out)
target_include_directories(${lib_name}
target_include_directories(${lib_name}
PRIVATE
$<FILTER:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_INCLUDE_DIRECTORIES>,EXCLUDE,${PSA_CRYPTO_CONFIG_INTERFACE_PATH_REGEX}>
)
# Ensure that the PSA crypto interface include folder isn't added in library builds (filtered out)
target_include_directories(${lib_name}
target_include_directories(${lib_name}
PRIVATE
$<FILTER:$<TARGET_PROPERTY:zephyr_interface,INTERFACE_SYSTEM_INCLUDE_DIRECTORIES>,EXCLUDE,${PSA_CRYPTO_CONFIG_INTERFACE_PATH_REGEX}>
)
Expand Down
6 changes: 3 additions & 3 deletions subsys/nrf_security/cmake/generate_configs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ macro(generate_mbedcrypto_interface_configs)
# Empty out previous versions of interface config-files
file(REMOVE_RECURSE ${generated_include_path})

# Generate MBEDCRYPTO_CONFIG_FILE
# Generate MBEDCRYPTO_CONFIG_FILE
if(CONFIG_MBEDTLS_LEGACY_CRYPTO_C)
include(${NRF_SECURITY_ROOT}/cmake/legacy_crypto_config.cmake)
else()
Expand All @@ -56,7 +56,7 @@ macro(generate_mbedcrypto_interface_configs)

# Note: Interface doesn't need PSA_CRYPTO_USER_CONFIG_FILE

# Restore the backup configurations
# Restore the backup configurations
kconfig_restore_backup_config(CONFIG_MBEDTLS_PSA_CRYPTO_SPM)
kconfig_restore_backup_config(CONFIG_MBEDTLS_PSA_CRYPTO_C)
kconfig_restore_backup_config(CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
Expand Down Expand Up @@ -129,7 +129,7 @@ macro(generate_mbedcrypto_library_configs)
# Generate the PSA_CRYPTO_USER_CONFIG_FILE (PSA_NEED configurations)
include(${NRF_SECURITY_ROOT}/cmake/psa_crypto_config.cmake)

# Restore the backup configurations
# Restore the backup configurations
kconfig_restore_backup_config(CONFIG_MBEDTLS_PSA_CRYPTO_C)
kconfig_restore_backup_config(CONFIG_MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER)
kconfig_restore_backup_config(CONFIG_MBEDTLS_PSA_CRYPTO_SPM)
Expand Down
2 changes: 1 addition & 1 deletion subsys/nrf_security/cmake/nrf_config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
# Convert all platform and TLS/DTLS and X.509 Kconfig variables for Mbed TLS
# Convert all platform and TLS/DTLS and X.509 Kconfig variables for Mbed TLS
# (strip CONFIG_)

# TF-M
Expand Down
2 changes: 1 addition & 1 deletion subsys/nrf_security/configs/config_extra.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
set(PSA_CRYPTO_EXTERNAL_CORE ON CACHE BOOL "Enable building PSA core externally")

# This file is populated with paths needed building nrf_security with and without TF-M
# It is added to circumvent issues with install-targets inside TF-M and to unify the
# It is added to circumvent issues with install-targets inside TF-M and to unify the
# CMake code with Zephyr builds
set(NRFXLIB_DIR ${ZEPHYR_NRFXLIB_MODULE_DIR} CACHE STRING "nrfxlib folder")
set(NRF_SECURITY_ROOT ${NRF_DIR}/subsys/nrf_security CACHE STRING "nrf_security root folder")
Expand Down
2 changes: 1 addition & 1 deletion subsys/nrf_security/configs/nrf-config.h.template
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/
/* The include guards used here ensures that a different Mbed TLS config is not
* added to the build and used by accident. Hence, this guard is not
* added to the build and used by accident. Hence, this guard is not
* equivalent to naming of this file.
*/
#ifndef MBEDTLS_CONFIG_FILE_H
Expand Down
38 changes: 19 additions & 19 deletions subsys/nrf_security/include/crypto_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ typedef mbedtls_svc_key_id_t psa_key_handle_t;
*/
static inline int psa_key_handle_is_null(psa_key_handle_t handle)
{
return mbedtls_svc_key_id_is_null(handle);
return mbedtls_svc_key_id_is_null(handle);
}

/** Open a handle to an existing persistent key.
Expand Down Expand Up @@ -104,7 +104,7 @@ static inline int psa_key_handle_is_null(psa_key_handle_t handle)
* results in this error code.
*/
psa_status_t psa_open_key(mbedtls_svc_key_id_t key,
psa_key_handle_t *handle);
psa_key_handle_t *handle);

/** Close a key handle.
*
Expand Down Expand Up @@ -160,7 +160,7 @@ psa_status_t psa_close_key(psa_key_handle_t handle);
* a future version of the library.
*/
#define PSA_DH_FAMILY_CUSTOM \
((psa_dh_family_t) MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(0x7e))
((psa_dh_family_t) MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(0x7e))

/**
* \brief Set domain parameters for a key.
Expand All @@ -179,15 +179,15 @@ psa_status_t psa_close_key(psa_key_handle_t handle);
* \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription
*/
static inline psa_status_t MBEDTLS_DEPRECATED psa_set_key_domain_parameters(
psa_key_attributes_t *attributes,
psa_key_type_t type, const uint8_t *data, size_t data_length)
psa_key_attributes_t *attributes,
psa_key_type_t type, const uint8_t *data, size_t data_length)
{
(void) data;
if (data_length != 0) {
return PSA_ERROR_NOT_SUPPORTED;
}
psa_set_key_type(attributes, type);
return PSA_SUCCESS;
(void) data;
if (data_length != 0) {
return PSA_ERROR_NOT_SUPPORTED;
}
psa_set_key_type(attributes, type);
return PSA_SUCCESS;
}

/**
Expand All @@ -205,21 +205,21 @@ static inline psa_status_t MBEDTLS_DEPRECATED psa_set_key_domain_parameters(
* \retval #PSA_SUCCESS \emptydescription
*/
static inline psa_status_t MBEDTLS_DEPRECATED psa_get_key_domain_parameters(
const psa_key_attributes_t *attributes,
uint8_t *data, size_t data_size, size_t *data_length)
const psa_key_attributes_t *attributes,
uint8_t *data, size_t data_size, size_t *data_length)
{
(void) attributes;
(void) data;
(void) data_size;
*data_length = 0;
return PSA_SUCCESS;
(void) attributes;
(void) data;
(void) data_size;
*data_length = 0;
return PSA_SUCCESS;
}

/** Safe output buffer size for psa_get_key_domain_parameters().
*
*/
#define PSA_KEY_DOMAIN_PARAMETERS_SIZE(key_type, key_bits) \
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(1u)
MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(1u)
#endif /* MBEDTLS_DEPRECATED_REMOVED */

/**@}*/
Expand Down

0 comments on commit f456180

Please sign in to comment.