Reads requested length of random data from the TRNG. Generate nbytes of random bytes and store them in p_rngbuf buffer. More...
Detailed Description
Hardware acceleration for the mbedCrypto implementation of the Arm PSA Crypto API.
Overview
Note
The PSA Crypto module does not provide any interfaces to the user. This release uses the mbedTLS version 3.6.2 which conforms to the PSA Crypto API 1.0 specification. Consult the Arm documentation at https://armmbed.github.io/mbed-crypto/psa/#application-programming-interface for further information. FSP 3.0 onward adopts a change by Arm where mbedCrypto has been integrated back to MbedTLS and the term mbedCrypto has been deprecated. The mbedCrypto term in FSP now refers to the crypto portion of the MbedTLS module.
The following build time configurations are defined in arm/mbedtls/config.h:
Configuration
Options
Default
Description
Hardware Acceleration
Hardware Acceleration > Key Format
AES
MCU Specific Options
Select AES key formats used
ECC
MCU Specific Options
Select ECC key formats used
RSA
MCU Specific Options
Select RSA key formats used
Hardware Acceleration > Hash
SHA256/224
MCU Specific Options
Defines MBEDTLS_SHA256_ALT and MBEDTLS_SHA256_PROCESS_ALT.
SHA512/384
MCU Specific Options
Defines MBEDTLS_SHA512_ALT and MBEDTLS_SHA512_PROCESS_ALT.
SHA3_224/256/384/512
MCU Specific Options
Defines MBEDTLS_SHA3_ALT and MBEDTLS_SHA3_PROCESS_ALT.
Hardware Acceleration > Cipher
AES
MCU Specific Options
Defines MBEDTLS_AES_ALT, MBEDTLS_AES_SETKEY_ENC_ALT, MBEDTLS_AES_SETKEY_DEC_ALT, MBEDTLS_AES_ENCRYPT_ALT and MBEDTLS_AES_DECRYPT_ALT
Hardware Acceleration > Public Key Cryptography (PKC)
Hardware Acceleration > Public Key Cryptography (PKC) > RSA 3072
Key Generation
MCU Specific Options
Enables RSA 3072 Key Generation.
Signing
MCU Specific Options
Enables RSA 3072 Key Signing.
Verification
MCU Specific Options
Enables RSA 3072 Verify.
Hardware Acceleration > Public Key Cryptography (PKC) > RSA 4096
Key Generation
MCU Specific Options
Enables RSA 4096 Key Generation.
Signing
MCU Specific Options
Enables RSA 4096 Key Signing.
Verification
MCU Specific Options
Enables RSA 4096 Verify.
ECC
MCU Specific Options
Defines MBEDTLS_ECP_ALT
ECDSA
MCU Specific Options
Defines MBEDTLS_ECDSA_SIGN_ALT and MBEDTLS_ECDSA_VERIFY_ALT
ECDH
MCU Specific Options
Defines MBEDTLS_ECDH_ALT
RSA 1024
MCU Specific Options
Defines MBEDTLS_RSA_1024_ALT. RSA 1024 Key Generation, Signing and Verification are also enabled.
RSA 2048
MCU Specific Options
Defines MBEDTLS_RSA_ALT. RSA 2048 Key Generation, Signing and Verification are also enabled.
TRNG
Enabled
Enabled
Defines MBEDTLS_ENTROPY_HARDWARE_ALT.
Crypto Engine Initialization
Enabled
Enabled
MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT
Platform
Platform > Alternate
MBEDTLS_PLATFORM_SETBUF_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_SETBUF_ALT
MBEDTLS_PLATFORM_EXIT_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_EXIT_ALT
MBEDTLS_PLATFORM_TIME_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_TIME_ALT
MBEDTLS_PLATFORM_FPRINTF_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_FPRINTF_ALT
MBEDTLS_PLATFORM_PRINTF_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_PRINTF_ALT
MBEDTLS_PLATFORM_SNPRINTF_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_SNPRINTF_ALT
MBEDTLS_PLATFORM_VSNPRINTF_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_VSNPRINTF_ALT
MBEDTLS_PLATFORM_NV_SEED_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_NV_SEED_ALT
MBEDTLS_PLATFORM_MS_TIME_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_MS_TIME_ALT
MBEDTLS_PLATFORM_ZEROIZE_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_ZEROIZE_ALT
MBEDTLS_PLATFORM_GMTIME_R_ALT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_GMTIME_R_ALT
MBEDTLS_HAVE_ASM
Define
Undefine
Undefine
MBEDTLS_HAVE_ASM
MBEDTLS_NO_UDBL_DIVISION
Define
Undefine
Undefine
MBEDTLS_NO_UDBL_DIVISION
MBEDTLS_NO_64BIT_MULTIPLICATION
Define
Undefine
Undefine
MBEDTLS_NO_64BIT_MULTIPLICATION
MBEDTLS_HAVE_SSE2
Define
Undefine
Undefine
MBEDTLS_HAVE_SSE2
MBEDTLS_HAVE_TIME
Define
Undefine
Undefine
MBEDTLS_HAVE_TIME
MBEDTLS_HAVE_TIME_DATE
Define
Undefine
Undefine
MBEDTLS_HAVE_TIME_DATE
MBEDTLS_PLATFORM_MEMORY
Define
Undefine
Define
MBEDTLS_PLATFORM_MEMORY
MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
Define
Undefine
Undefine
MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
MBEDTLS_TIMING_ALT
Define
Undefine
Undefine
MBEDTLS_TIMING_ALT
MBEDTLS_NO_PLATFORM_ENTROPY
Define
Undefine
Define
MBEDTLS_NO_PLATFORM_ENTROPY
MBEDTLS_ENTROPY_C
Define
Undefine
Define
MBEDTLS_ENTROPY_C
MBEDTLS_PLATFORM_C
Define
Undefine
Define
MBEDTLS_PLATFORM_C
MBEDTLS_PLATFORM_STD_CALLOC
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_CALLOC
MBEDTLS_PLATFORM_STD_CALLOC value
Manual Entry
calloc
MBEDTLS_PLATFORM_STD_CALLOC value
MBEDTLS_PLATFORM_STD_FREE
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_FREE
MBEDTLS_PLATFORM_STD_FREE value
Manual Entry
free
MBEDTLS_PLATFORM_STD_FREE value
MBEDTLS_PLATFORM_STD_SETBUF
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_SETBUF
MBEDTLS_PLATFORM_STD_SETBUF value
Manual Entry
setbuf
MBEDTLS_PLATFORM_STD_SETBUF value
MBEDTLS_PLATFORM_STD_EXIT
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_EXIT
MBEDTLS_PLATFORM_STD_EXIT value
Manual Entry
exit
MBEDTLS_PLATFORM_STD_EXIT value
MBEDTLS_PLATFORM_STD_TIME
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_TIME
MBEDTLS_PLATFORM_STD_TIME value
Manual Entry
time
MBEDTLS_PLATFORM_STD_TIME value
MBEDTLS_PLATFORM_STD_FPRINTF
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_FPRINTF
MBEDTLS_PLATFORM_STD_FPRINTF value
Manual Entry
fprintf
MBEDTLS_PLATFORM_STD_FPRINTF value
MBEDTLS_PLATFORM_STD_PRINTF
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_PRINTF
MBEDTLS_PLATFORM_STD_PRINTF value
Manual Entry
printf
MBEDTLS_PLATFORM_STD_PRINTF value
MBEDTLS_PLATFORM_STD_SNPRINTF
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_SNPRINTF
MBEDTLS_PLATFORM_STD_SNPRINTF value
Manual Entry
snprintf
MBEDTLS_PLATFORM_STD_SNPRINTF value
MBEDTLS_PLATFORM_STD_EXIT_SUCCESS
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_EXIT_SUCCESS
MBEDTLS_PLATFORM_STD_EXIT_SUCCESS value
Manual Entry
0
MBEDTLS_PLATFORM_STD_EXIT_SUCCESS value
MBEDTLS_PLATFORM_STD_EXIT_FAILURE
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_EXIT_FAILURE
MBEDTLS_PLATFORM_STD_EXIT_FAILURE value
Manual Entry
1
MBEDTLS_PLATFORM_STD_EXIT_FAILURE value
MBEDTLS_PLATFORM_STD_NV_SEED_READ
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_NV_SEED_READ
MBEDTLS_PLATFORM_STD_NV_SEED_READ value
Manual Entry
mbedtls_platform_std_nv_seed_read
MBEDTLS_PLATFORM_STD_NV_SEED_READ value
MBEDTLS_PLATFORM_STD_NV_SEED_WRITE
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_NV_SEED_WRITE
MBEDTLS_PLATFORM_STD_NV_SEED_WRITE value
Manual Entry
mbedtls_platform_std_nv_seed_write
MBEDTLS_PLATFORM_STD_NV_SEED_WRITE value
MBEDTLS_PLATFORM_STD_NV_SEED_FILE
Define
Undefine
Undefine
MBEDTLS_PLATFORM_STD_NV_SEED_FILE
MBEDTLS_PLATFORM_STD_NV_SEED_FILE value
Manual Entry
MBEDTLS_PLATFORM_STD_NV_SEED_FILE value
MBEDTLS_PLATFORM_CALLOC_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_CALLOC_MACRO
MBEDTLS_PLATFORM_CALLOC_MACRO value
Manual Entry
calloc
MBEDTLS_PLATFORM_CALLOC_MACRO value
MBEDTLS_PLATFORM_FREE_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_FREE_MACRO
MBEDTLS_PLATFORM_FREE_MACRO value
Manual Entry
free
MBEDTLS_PLATFORM_FREE_MACRO value
MBEDTLS_PLATFORM_EXIT_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_EXIT_MACRO
MBEDTLS_PLATFORM_EXIT_MACRO value
Manual Entry
exit
MBEDTLS_PLATFORM_EXIT_MACRO value
MBEDTLS_PLATFORM_SETBUF_MACRO
Define
Undefine
Define
MBEDTLS_PLATFORM_SETBUF_MACRO
MBEDTLS_PLATFORM_SETBUF_MACRO value
Manual Entry
dummy_setbuf
MBEDTLS_PLATFORM_SETBUF_MACRO value
MBEDTLS_PLATFORM_TIME_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_TIME_MACRO
MBEDTLS_PLATFORM_TIME_MACRO value
Manual Entry
time
MBEDTLS_PLATFORM_TIME_MACRO value
MBEDTLS_PLATFORM_TIME_TYPE_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_TIME_TYPE_MACRO
MBEDTLS_PLATFORM_TIME_TYPE_MACRO value
Manual Entry
time_t
MBEDTLS_PLATFORM_TIME_TYPE_MACRO value
MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO
MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO value
Manual Entry
int64_t
MBEDTLS_PLATFORM_MS_TIME_TYPE_MACRO value
MBEDTLS_PRINTF_MS_TIME
Define
Undefine
Undefine
MBEDTLS_PRINTF_MS_TIME
MBEDTLS_PRINTF_MS_TIME value
Manual Entry
PRId64
MBEDTLS_PRINTF_MS_TIME value
MBEDTLS_PLATFORM_FPRINTF_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_FPRINTF_MACRO
MBEDTLS_PLATFORM_FPRINTF_MACRO value
Manual Entry
fprintf
MBEDTLS_PLATFORM_FPRINTF_MACRO value
MBEDTLS_PLATFORM_PRINTF_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_PRINTF_MACRO
MBEDTLS_PLATFORM_PRINTF_MACRO value
Manual Entry
printf
MBEDTLS_PLATFORM_PRINTF_MACRO value
MBEDTLS_PLATFORM_SNPRINTF_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_SNPRINTF_MACRO
MBEDTLS_PLATFORM_SNPRINTF_MACRO value
Manual Entry
snprintf
MBEDTLS_PLATFORM_SNPRINTF_MACRO value
MBEDTLS_PLATFORM_VSNPRINTF_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_VSNPRINTF_MACRO
MBEDTLS_PLATFORM_VSNPRINTF_MACRO value
Manual Entry
vsnprintf
MBEDTLS_PLATFORM_VSNPRINTF_MACRO value
MBEDTLS_PLATFORM_NV_SEED_READ_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_NV_SEED_READ_MACRO
MBEDTLS_PLATFORM_NV_SEED_READ_MACRO value
Manual Entry
mbedtls_platform_std_nv_seed_read
MBEDTLS_PLATFORM_NV_SEED_READ_MACRO value
MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO
Define
Undefine
Undefine
MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO
MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO value
Manual Entry
mbedtls_platform_std_nv_seed_write
MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO value
General
MBEDTLS_PSA_CRYPTO_DRIVERS
Define
Undefine
Undefine
MBEDTLS_PSA_CRYPTO_DRIVERS
MBEDTLS_DEPRECATED_WARNING
Define
Undefine
Undefine
MBEDTLS_DEPRECATED_WARNING
MBEDTLS_DEPRECATED_REMOVED
Define
Undefine
Define
MBEDTLS_DEPRECATED_REMOVED
MBEDTLS_CHECK_RETURN_WARNING
Define
Undefine
Undefine
MBEDTLS_CHECK_RETURN_WARNING
MBEDTLS_ERROR_STRERROR_DUMMY
Define
Undefine
Define
MBEDTLS_ERROR_STRERROR_DUMMY
MBEDTLS_MEMORY_DEBUG
Define
Undefine
Undefine
MBEDTLS_MEMORY_DEBUG
MBEDTLS_MEMORY_BACKTRACE
Define
Undefine
Undefine
MBEDTLS_MEMORY_BACKTRACE
MBEDTLS_PSA_CRYPTO_CLIENT
Define
Undefine
Undefine
MBEDTLS_PSA_CRYPTO_CLIENT
MBEDTLS_PSA_CRYPTO_SPM
Define
Undefine
Undefine
MBEDTLS_PSA_CRYPTO_SPM
MBEDTLS_PSA_KEY_STORE_DYNAMIC
Define
Undefine
Undefine
MBEDTLS_PSA_KEY_STORE_DYNAMIC
MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
Define
Undefine
Undefine
MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS
MBEDTLS_SELF_TEST
Define
Undefine
Undefine
MBEDTLS_SELF_TEST
MBEDTLS_THREADING_ALT
Define
Undefine
Define
MBEDTLS_THREADING_ALT
MBEDTLS_THREADING_PTHREAD
Define
Undefine
Undefine
MBEDTLS_THREADING_PTHREAD
MBEDTLS_USE_PSA_CRYPTO
Undefine
Undefine
MBEDTLS_USE_PSA_CRYPTO
MBEDTLS_VERSION_FEATURES
Define
Undefine
Define
MBEDTLS_VERSION_FEATURES
MBEDTLS_ERROR_C
Define
Undefine
Define
MBEDTLS_ERROR_C
MBEDTLS_MEMORY_BUFFER_ALLOC_C
Define
Undefine
Undefine
MBEDTLS_MEMORY_BUFFER_ALLOC_C
MBEDTLS_PSA_CRYPTO_C
Define
Undefine
Define
MBEDTLS_PSA_CRYPTO_C
MBEDTLS_PSA_CRYPTO_SE_C
Define
Undefine
Undefine
MBEDTLS_PSA_CRYPTO_SE_C
MBEDTLS_THREADING_C
Define
Undefine
Define
MBEDTLS_THREADING_C
MBEDTLS_TIMING_C
Define
Undefine
Undefine
MBEDTLS_TIMING_C
MBEDTLS_VERSION_C
Define
Undefine
Define
MBEDTLS_VERSION_C
MBEDTLS_MEMORY_ALIGN_MULTIPLE
Define
Undefine
Undefine
MBEDTLS_MEMORY_ALIGN_MULTIPLE
MBEDTLS_MEMORY_ALIGN_MULTIPLE value
Manual Entry
4
MBEDTLS_MEMORY_ALIGN_MULTIPLE value
MBEDTLS_CHECK_RETURN
Define
Undefine
Define
MBEDTLS_CHECK_RETURN
MBEDTLS_IGNORE_RETURN
Define
Undefine
Undefine
MBEDTLS_IGNORE_RETURN
MBEDTLS_PSA_CRYPTO_CONFIG
Define
Undefine
Undefine
MBEDTLS_PSA_CRYPTO_CONFIG
Cipher
Cipher > Alternate
MBEDTLS_ARIA_ALT
Define
Undefine
Undefine
MBEDTLS_ARIA_ALT
MBEDTLS_CAMELLIA_ALT
Define
Undefine
Undefine
MBEDTLS_CAMELLIA_ALT
MBEDTLS_CCM_ALT
MCU Specific Options
MBEDTLS_CCM_ALT
MBEDTLS_CHACHA20_ALT
MCU Specific Options
MBEDTLS_CHACHA20_ALT
MBEDTLS_CHACHAPOLY_ALT
MCU Specific Options
MBEDTLS_CHACHAPOLY_ALT
MBEDTLS_CMAC_ALT
MCU Specific Options
MBEDTLS_CMAC_ALT
MBEDTLS_DES_ALT
Define
Undefine
Undefine
MBEDTLS_DES_ALT
MBEDTLS_GCM_ALT
MCU Specific Options
MBEDTLS_GCM_ALT
MBEDTLS_NIST_KW_ALT
Define
Undefine
Undefine
MBEDTLS_NIST_KW_ALT
MBEDTLS_DES_SETKEY_ALT
Define
Undefine
Undefine
MBEDTLS_DES_SETKEY_ALT
MBEDTLS_DES_CRYPT_ECB_ALT
Define
Undefine
Undefine
MBEDTLS_DES_CRYPT_ECB_ALT
MBEDTLS_DES3_CRYPT_ECB_ALT
Define
Undefine
Undefine
MBEDTLS_DES3_CRYPT_ECB_ALT
Cipher > AES
MBEDTLS_AES_ROM_TABLES
Define
Undefine
Undefine
MBEDTLS_AES_ROM_TABLES
MBEDTLS_AES_FEWER_TABLES
Define
Undefine
Undefine
MBEDTLS_AES_FEWER_TABLES
MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
Define
Undefine
Undefine
MBEDTLS_AES_ONLY_128_BIT_KEY_LENGTH
MBEDTLS_CAMELLIA_SMALL_MEMORY
Define
Undefine
Undefine
MBEDTLS_CAMELLIA_SMALL_MEMORY
MBEDTLS_CIPHER_MODE_CBC
Define
Undefine
Define
MBEDTLS_CIPHER_MODE_CBC
MBEDTLS_CIPHER_MODE_CFB
Define
Undefine
Define
MBEDTLS_CIPHER_MODE_CFB
MBEDTLS_CIPHER_MODE_CTR
Define
Undefine
Define
MBEDTLS_CIPHER_MODE_CTR
MBEDTLS_CIPHER_MODE_OFB
Define
Undefine
Undefine
MBEDTLS_CIPHER_MODE_OFB
MBEDTLS_CIPHER_MODE_XTS
Define
Undefine
Undefine
MBEDTLS_CIPHER_MODE_XTS
MBEDTLS_CIPHER_NULL_CIPHER
Define
Undefine
Undefine
MBEDTLS_CIPHER_NULL_CIPHER
MBEDTLS_CIPHER_PADDING_PKCS7
Define
Undefine
Define
MBEDTLS_CIPHER_PADDING_PKCS7
MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
Define
Undefine
Define
MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS
MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
Define
Undefine
Define
MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN
MBEDTLS_CIPHER_PADDING_ZEROS
Define
Undefine
Define
MBEDTLS_CIPHER_PADDING_ZEROS
MBEDTLS_AES_C
Define
Define
MBEDTLS_AES_C
MBEDTLS_BLOCK_CIPHER_NO_DECRYPT
Define
Undefine
Undefine
MBEDTLS_BLOCK_CIPHER_NO_DECRYPT
MBEDTLS_CAMELLIA_C
Define
Undefine
Undefine
MBEDTLS_CAMELLIA_C
MBEDTLS_ARIA_C
Define
Undefine
Undefine
MBEDTLS_ARIA_C
MBEDTLS_CCM_C
Define
Undefine
Define
MBEDTLS_CCM_C
MBEDTLS_CHACHA20_C
Define
Undefine
Undefine
MBEDTLS_CHACHA20_C
MBEDTLS_CHACHAPOLY_C
Define
Undefine
Undefine
MBEDTLS_CHACHAPOLY_C
MBEDTLS_CIPHER_C
Define
Undefine
Define
MBEDTLS_CIPHER_C
MBEDTLS_DES_C
Define
Undefine
Undefine
MBEDTLS_DES_C
MBEDTLS_GCM_C
Define
Undefine
Define
MBEDTLS_GCM_C
MBEDTLS_GCM_LARGE_TABLE
Define
Undefine
Undefine
MBEDTLS_GCM_LARGE_TABLE
MBEDTLS_NIST_KW_C
Define
Undefine
Undefine
MBEDTLS_NIST_KW_C
Public Key Cryptography (PKC)
Public Key Cryptography (PKC) > DHM
Public Key Cryptography (PKC) > DHM > Alternate
MBEDTLS_DHM_ALT
Define
Undefine
Undefine
MBEDTLS_DHM_ALT
MBEDTLS_DHM_C
Define
Undefine
Undefine
MBEDTLS_DHM_C
Public Key Cryptography (PKC) > ECC
Public Key Cryptography (PKC) > ECC > Alternate
MBEDTLS_ECJPAKE_ALT
Define
Undefine
Undefine
MBEDTLS_ECJPAKE_ALT
MBEDTLS_ECDSA_GENKEY_ALT
Define
Undefine
Undefine
MBEDTLS_ECDSA_GENKEY_ALT
MBEDTLS_ECP_INTERNAL_ALT
Define
Undefine
Undefine
MBEDTLS_ECP_INTERNAL_ALT
MBEDTLS_ECP_RANDOMIZE_JAC_ALT
Define
Undefine
Undefine
MBEDTLS_ECP_RANDOMIZE_JAC_ALT
MBEDTLS_ECP_ADD_MIXED_ALT
Define
Undefine
Undefine
MBEDTLS_ECP_ADD_MIXED_ALT
MBEDTLS_ECP_DOUBLE_JAC_ALT
Define
Undefine
Undefine
MBEDTLS_ECP_DOUBLE_JAC_ALT
MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
Define
Undefine
Undefine
MBEDTLS_ECP_NORMALIZE_JAC_MANY_ALT
MBEDTLS_ECP_NORMALIZE_JAC_ALT
Define
Undefine
Undefine
MBEDTLS_ECP_NORMALIZE_JAC_ALT
MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT
Define
Undefine
Undefine
MBEDTLS_ECP_DOUBLE_ADD_MXZ_ALT
MBEDTLS_ECP_RANDOMIZE_MXZ_ALT
Define
Undefine
Undefine
MBEDTLS_ECP_RANDOMIZE_MXZ_ALT
MBEDTLS_ECP_NORMALIZE_MXZ_ALT
Define
Undefine
Undefine
MBEDTLS_ECP_NORMALIZE_MXZ_ALT
Public Key Cryptography (PKC) > ECC > Curves
MBEDTLS_ECP_DP_SECP192R1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_SECP192R1_ENABLED
MBEDTLS_ECP_DP_SECP224R1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_SECP224R1_ENABLED
MBEDTLS_ECP_DP_SECP256R1_ENABLED
Define
Undefine
Define
MBEDTLS_ECP_DP_SECP256R1_ENABLED
MBEDTLS_ECP_DP_SECP384R1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_SECP384R1_ENABLED
MBEDTLS_ECP_DP_SECP521R1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_SECP521R1_ENABLED
MBEDTLS_ECP_DP_SECP192K1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_SECP192K1_ENABLED
MBEDTLS_ECP_DP_SECP224K1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_SECP224K1_ENABLED
MBEDTLS_ECP_DP_SECP256K1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_SECP256K1_ENABLED
MBEDTLS_ECP_DP_BP256R1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_BP256R1_ENABLED
MBEDTLS_ECP_DP_BP384R1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_BP384R1_ENABLED
MBEDTLS_ECP_DP_BP512R1_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_BP512R1_ENABLED
MBEDTLS_ECP_DP_CURVE25519_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_CURVE25519_ENABLED
MBEDTLS_ECP_DP_CURVE448_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECP_DP_CURVE448_ENABLED
MBEDTLS_ECDH_GEN_PUBLIC_ALT
Define
Undefine
Undefine
MBEDTLS_ECDH_GEN_PUBLIC_ALT
MBEDTLS_ECDH_COMPUTE_SHARED_ALT
Define
Undefine
Undefine
MBEDTLS_ECDH_COMPUTE_SHARED_ALT
MBEDTLS_ECP_NO_FALLBACK
Define
Undefine
Undefine
MBEDTLS_ECP_NO_FALLBACK
MBEDTLS_ECP_NIST_OPTIM
Define
Undefine
Undefine
MBEDTLS_ECP_NIST_OPTIM
MBEDTLS_ECP_RESTARTABLE
Define
Undefine
Undefine
MBEDTLS_ECP_RESTARTABLE
MBEDTLS_ECDSA_DETERMINISTIC
Define
Undefine
Undefine
MBEDTLS_ECDSA_DETERMINISTIC
MBEDTLS_PK_PARSE_EC_COMPRESSED
Define
Undefine
Undefine
MBEDTLS_PK_PARSE_EC_COMPRESSED
MBEDTLS_PK_PARSE_EC_EXTENDED
Define
Undefine
Undefine
MBEDTLS_PK_PARSE_EC_EXTENDED
MBEDTLS_ECDH_C
Define
Undefine
Undefine
MBEDTLS_ECDH_C
MBEDTLS_ECDSA_C
Define
Undefine
Define
MBEDTLS_ECDSA_C
MBEDTLS_ECP_C
Define
Undefine
Define
MBEDTLS_ECP_C
MBEDTLS_ECJPAKE_C
Define
Undefine
Undefine
MBEDTLS_ECJPAKE_C
MBEDTLS_ECP_WINDOW_SIZE
Define
Undefine
Undefine
MBEDTLS_ECP_WINDOW_SIZE
MBEDTLS_ECP_WINDOW_SIZE value
Manual Entry
6
MBEDTLS_ECP_WINDOW_SIZE value
MBEDTLS_ECP_FIXED_POINT_OPTIM
Define
Undefine
Undefine
MBEDTLS_ECP_FIXED_POINT_OPTIM
MBEDTLS_ECP_FIXED_POINT_OPTIM value
Manual Entry
1
MBEDTLS_ECP_FIXED_POINT_OPTIM value
MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
Define
Undefine
Undefine
MBEDTLS_ECDH_VARIANT_EVEREST_ENABLED
Public Key Cryptography (PKC) > RSA
MBEDTLS_PK_RSA_ALT_SUPPORT
Define
Undefine
Undefine
MBEDTLS_PK_RSA_ALT_SUPPORT
MBEDTLS_RSA_NO_CRT
Define
Undefine
Define
MBEDTLS_RSA_NO_CRT
MBEDTLS_RSA_C
Define
Undefine
Define
MBEDTLS_RSA_C
MBEDTLS_RSA_GEN_KEY_MIN_BITS
Define
Undefine
Undefine
MBEDTLS_RSA_GEN_KEY_MIN_BITS
MBEDTLS_RSA_GEN_KEY_MIN_BITS value
Manual Entry
1024
MBEDTLS_RSA_GEN_KEY_MIN_BITS value
MBEDTLS_GENPRIME
Define
Undefine
Define
MBEDTLS_GENPRIME
MBEDTLS_PKCS1_V15
Define
Undefine
Define
MBEDTLS_PKCS1_V15
MBEDTLS_PKCS1_V21
Define
Undefine
Define
MBEDTLS_PKCS1_V21
MBEDTLS_ASN1_PARSE_C
Define
Undefine
Define
MBEDTLS_ASN1_PARSE_C
MBEDTLS_ASN1_WRITE_C
Define
Undefine
Define
MBEDTLS_ASN1_WRITE_C
MBEDTLS_BASE64_C
Define
Undefine
Define
MBEDTLS_BASE64_C
MBEDTLS_BIGNUM_C
Define
Undefine
Define
MBEDTLS_BIGNUM_C
MBEDTLS_LMS_C
Define
Undefine
Define
MBEDTLS_LMS_C
MBEDTLS_LMS_PRIVATE
Define
Undefine
Undefine
MBEDTLS_LMS_PRIVATE
MBEDTLS_OID_C
Define
Undefine
Define
MBEDTLS_OID_C
MBEDTLS_PEM_PARSE_C
Define
Undefine
Define
MBEDTLS_PEM_PARSE_C
MBEDTLS_PEM_WRITE_C
Define
Undefine
Define
MBEDTLS_PEM_WRITE_C
MBEDTLS_PK_C
Define
Undefine
Define
MBEDTLS_PK_C
MBEDTLS_PK_PARSE_C
Define
Undefine
Define
MBEDTLS_PK_PARSE_C
MBEDTLS_PK_WRITE_C
Define
Undefine
Define
MBEDTLS_PK_WRITE_C
MBEDTLS_PKCS5_C
Define
Undefine
Define
MBEDTLS_PKCS5_C
MBEDTLS_PKCS7_C
Define
Undefine
Undefine
MBEDTLS_PKCS7_C
MBEDTLS_PKCS12_C
Define
Undefine
Define
MBEDTLS_PKCS12_C
MBEDTLS_MPI_WINDOW_SIZE
Define
Undefine
Undefine
MBEDTLS_MPI_WINDOW_SIZE
MBEDTLS_MPI_WINDOW_SIZE value
Manual Entry
6
MBEDTLS_MPI_WINDOW_SIZE value
MBEDTLS_MPI_MAX_SIZE
Define
Undefine
Undefine
MBEDTLS_MPI_MAX_SIZE
MBEDTLS_MPI_MAX_SIZE value
Manual Entry
1024
MBEDTLS_MPI_MAX_SIZE value
Hash
Hash > Alternate
MBEDTLS_MD5_ALT
Define
Undefine
Undefine
MBEDTLS_MD5_ALT
MBEDTLS_RIPEMD160_ALT
Define
Undefine
Undefine
MBEDTLS_RIPEMD160_ALT
MBEDTLS_SHA1_ALT
Define
Undefine
Undefine
MBEDTLS_SHA1_ALT
MBEDTLS_MD5_PROCESS_ALT
Define
Undefine
Undefine
MBEDTLS_MD5_PROCESS_ALT
MBEDTLS_RIPEMD160_PROCESS_ALT
Define
Undefine
Undefine
MBEDTLS_RIPEMD160_PROCESS_ALT
MBEDTLS_SHA1_PROCESS_ALT
Define
Undefine
Undefine
MBEDTLS_SHA1_PROCESS_ALT
MBEDTLS_SHA256_SMALLER
Define
Undefine
Undefine
MBEDTLS_SHA256_SMALLER
MBEDTLS_SHA512_SMALLER
Define
Undefine
Undefine
MBEDTLS_SHA512_SMALLER
MBEDTLS_MD_C
Define
Undefine
Define
MBEDTLS_MD_C
MBEDTLS_MD5_C
Define
Undefine
Define
MBEDTLS_MD5_C
MBEDTLS_RIPEMD160_C
Define
Undefine
Undefine
MBEDTLS_RIPEMD160_C
MBEDTLS_SHA1_C
Define
Undefine
Define
MBEDTLS_SHA1_C
MBEDTLS_SHA3_C
Define
Undefine
Undefine
MBEDTLS_SHA3_C
MBEDTLS_SHA224_C
Define
Undefine
Define
MBEDTLS_SHA224_C
MBEDTLS_SHA256_C
Define
Undefine
Define
MBEDTLS_SHA256_C
MBEDTLS_SHA384_C
Define
Undefine
Undefine
MBEDTLS_SHA384_C
MBEDTLS_SHA512_C
Define
Undefine
Undefine
MBEDTLS_SHA512_C
Message Authentication Code (MAC)
Message Authentication Code (MAC) > Alternate
MBEDTLS_POLY1305_ALT
Define
Undefine
Undefine
MBEDTLS_POLY1305_ALT
MBEDTLS_CMAC_C
Define
Undefine
Undefine
MBEDTLS_CMAC_C
MBEDTLS_HKDF_C
Define
Undefine
Define
MBEDTLS_HKDF_C
MBEDTLS_HMAC_DRBG_C
Define
Undefine
Undefine
MBEDTLS_HMAC_DRBG_C
MBEDTLS_POLY1305_C
Define
Undefine
Undefine
MBEDTLS_POLY1305_C
Storage
MBEDTLS_FS_IO
Define
Undefine
Undefine
MBEDTLS_FS_IO
MBEDTLS_PSA_CRYPTO_STORAGE_C
Define
Undefine
Undefine
MBEDTLS_PSA_CRYPTO_STORAGE_C
MBEDTLS_PSA_ITS_FILE_C
Define
Undefine
Undefine
MBEDTLS_PSA_ITS_FILE_C
RNG
MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
Define
Undefine
Undefine
MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
MBEDTLS_ENTROPY_FORCE_SHA256
Define
Undefine
Undefine
MBEDTLS_ENTROPY_FORCE_SHA256
MBEDTLS_ENTROPY_NV_SEED
Define
Undefine
Undefine
MBEDTLS_ENTROPY_NV_SEED
MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
Define
Undefine
Undefine
MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
MBEDTLS_PSA_INJECT_ENTROPY
Define
Undefine
Undefine
MBEDTLS_PSA_INJECT_ENTROPY
MBEDTLS_CTR_DRBG_C
Define
Undefine
Define
MBEDTLS_CTR_DRBG_C
MBEDTLS_CTR_DRBG_C_ALT
Define
Define
MBEDTLS_CTR_DRBG_C_ALT
MBEDTLS_CTR_DRBG_ENTROPY_LEN
Define
Undefine
Undefine
RNG|MBEDTLS_CTR_DRBG_ENTROPY_LEN
MBEDTLS_CTR_DRBG_ENTROPY_LEN value
Manual Entry
48
RNG value|MBEDTLS_CTR_DRBG_ENTROPY_LEN
MBEDTLS_CTR_DRBG_RESEED_INTERVAL
Define
Undefine
Undefine
RNG|MBEDTLS_CTR_DRBG_RESEED_INTERVAL
MBEDTLS_CTR_DRBG_RESEED_INTERVAL value
Manual Entry
10000
RNG value|MBEDTLS_CTR_DRBG_RESEED_INTERVAL
MBEDTLS_CTR_DRBG_MAX_INPUT
Define
Undefine
Undefine
MBEDTLS_CTR_DRBG_MAX_INPUT
MBEDTLS_CTR_DRBG_MAX_INPUT value
Manual Entry
256
MBEDTLS_CTR_DRBG_MAX_INPUT value
MBEDTLS_CTR_DRBG_MAX_REQUEST
Define
Undefine
Undefine
MBEDTLS_CTR_DRBG_MAX_REQUEST
MBEDTLS_CTR_DRBG_MAX_REQUEST value
Manual Entry
1024
MBEDTLS_CTR_DRBG_MAX_REQUEST value
MBEDTLS_CTR_DRBG_MAX_SEED_INPUT
Define
Undefine
Undefine
MBEDTLS_CTR_DRBG_MAX_SEED_INPUT
MBEDTLS_CTR_DRBG_MAX_SEED_INPUT value
Manual Entry
384
MBEDTLS_CTR_DRBG_MAX_SEED_INPUT value
MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
Define
Undefine
Undefine
MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
MBEDTLS_HMAC_DRBG_RESEED_INTERVAL
Define
Undefine
Undefine
MBEDTLS_HMAC_DRBG_RESEED_INTERVAL
MBEDTLS_HMAC_DRBG_RESEED_INTERVAL value
Manual Entry
10000
MBEDTLS_HMAC_DRBG_RESEED_INTERVAL value
MBEDTLS_HMAC_DRBG_MAX_INPUT
Define
Undefine
Undefine
MBEDTLS_HMAC_DRBG_MAX_INPUT
MBEDTLS_HMAC_DRBG_MAX_INPUT value
Manual Entry
256
MBEDTLS_HMAC_DRBG_MAX_INPUT value
MBEDTLS_HMAC_DRBG_MAX_REQUEST
Define
Undefine
Undefine
MBEDTLS_HMAC_DRBG_MAX_REQUEST
MBEDTLS_HMAC_DRBG_MAX_REQUEST value
Manual Entry
1024
MBEDTLS_HMAC_DRBG_MAX_REQUEST value
MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT
Define
Undefine
Undefine
MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT
MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT value
Manual Entry
384
MBEDTLS_HMAC_DRBG_MAX_SEED_INPUT value
MBEDTLS_ENTROPY_MAX_SOURCES
Define
Undefine
Undefine
MBEDTLS_ENTROPY_MAX_SOURCES
MBEDTLS_ENTROPY_MAX_SOURCES value
Manual Entry
20
MBEDTLS_ENTROPY_MAX_SOURCES value
MBEDTLS_ENTROPY_MAX_GATHER
Define
Undefine
Undefine
MBEDTLS_ENTROPY_MAX_GATHER
MBEDTLS_ENTROPY_MAX_GATHER value
Manual Entry
128
MBEDTLS_ENTROPY_MAX_GATHER value
MBEDTLS_ENTROPY_MIN_HARDWARE
Define
Undefine
Undefine
MBEDTLS_ENTROPY_MIN_HARDWARE
MBEDTLS_ENTROPY_MIN_HARDWARE value
Manual Entry
32
MBEDTLS_ENTROPY_MIN_HARDWARE value
Key Configuration
MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
Define
Undefine
Undefine
MBEDTLS_PSA_CRYPTO_KEY_ID_ENCODES_OWNER
MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
Define
Undefine
Undefine
MBEDTLS_PSA_CRYPTO_BUILTIN_KEYS
PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER
Define
Undefine
Undefine
PSA_CRYPTO_DRIVER_TFM_BUILTIN_KEY_LOADER
MBEDTLS_PSA_KEY_SLOT_COUNT
Define
Undefine
Undefine
MBEDTLS_PSA_KEY_SLOT_COUNT
MBEDTLS_PSA_KEY_SLOT_COUNT value
Manual Entry
32
MBEDTLS_PSA_KEY_SLOT_COUNT value
Post Quantum Cryptography (PQC)
MBEDTLS_MLKEM_C
Define
Undefine
Undefine
MBEDTLS_MLKEM_C
MBEDTLS_ML_DSA_C
Define
Undefine
Undefine
MBEDTLS_ML_DSA_C
HMAC
MBEDTLS_PSA_HMAC_DRBG_MD_TYPE
Define
Undefine
Define
MBEDTLS_PSA_HMAC_DRBG_MD_TYPE
SHA256 Configuration
To enable hardware acceleration for the SHA256/224 calculation, the macro MBEDTLS_SHA256_ALT and MBEDTLS_SHA256_PROCESS_ALT must be defined in the configuration file. By default SHA256 is enabled. SHA256 can be disabled, but SHA512 then needs to be enabled (software version) because the PSA implementation uses it for the entropy accumulator. This can be done using the RA Configuration editor.
AES Configuration
To enable hardware acceleration for the AES128/256 operation, the macro MBEDTLS_AES_SETKEY_ENC_ALT, MBEDTLS_AES_SETKEY_DEC_ALT, MBEDTLS_AES_ENCRYPT_ALT and MBEDTLS_AES_DECRYPT_ALT must be defined in the configuration file. By default AES is enabled. AES cannot be disabled because the PSA implementation requires it for the CTR_DRBG random number generator. This can be done using the RA Configuration editor.
Note
Only AES XTS 128 is currently supported. RA2 devices support acceleration for ECB part alone, while other devices support full AES XTS hardware acceleration.
ECC Configuration
To enable hardware acceleration for the ECC Key Generation operation, the macro MBEDTLS_ECP_ALT must be defined in the configuration file. For ECDSA, the macros MBEDTLS_ECDSA_SIGN_ALT and MBEDTLS_ECDSA_VERIFY_ALT must be defined. By default ECC, ECDSA and ECDHE are enabled. To disable ECC, undefine MBEDTLS_ECP_C, MBEDTLS_ECDSA_C and MBEDTLS_ECDH_C. This can be done using the RA Configuration editor.
RSA Configuration
To enable hardware acceleration for the RSA2048 operation, the macro MBEDTLS_RSA_ALT must be defined in the configuration file. By default RSA is enabled. To disable RSA, undefine MBEDTLS_RSA_C, MBEDTLS_PK_C, MBEDTLS_PK_PARSE_C, MBEDTLS_PK_WRITE_C. This can be done using the RA Configuration editor.
Post Quantum Cryptography (PQC) Configuration
ML-KEM Configuration
To enable software only PQC ML-KEM key generation, encapsulation, and decapsulation operations, the macro MBEDTLS_MLKEM_C must be defined in the configuration file. By default, PQC ML-KEM is disabled as the PQC stack is optional. This can be done using the RA Configuration editor.
ML-DSA Configuration
To enable software only PQC ML-DSA key generation, signing, and verification operations, the macro MBEDTLS_ML_DSA_C must be defined in the configuration file. By default, PQC ML-DSA is disabled as the PQC stack is optional. This can be done using the RA Configuration editor.
Wrapped Key Usage
To use the Secure Crypto Engine to generate and use wrapped keys, use PSA_KEY_TYPE_AES_WRAPPED or PSA_KEY_TYPE_ECC_KEY_PAIR_WRAPPED(curve) or PSA_KEY_TYPE_RSA_KEY_PAIR when setting the key type attribute. Setting the key's type attribute using this value will cause the SCE to use wrapped key mode for all operations related to that key. The user can use the export functionality to save the wrapped keys to user ROM and import it later for usage. This mode requires that Wrapped Key functionality for the algorithm is enabled in the project configuration.
Note
On the SCE9 devices, only the RSA public key can be exported. A file system must be used to store the internally generated private key.
Persistent Key Storage
Persistent key storage can be enabled by defining MBEDTLS_FS_IO, MBEDTLS_PSA_CRYPTO_STORAGE_C, and MBEDTLS_PSA_ITS_FILE_C. The key lifetime must also be specified as PSA_KEY_LIFETIME_PERSISTENT. A lower level storage module must be added in the RA Configuration editor and initialized in the code before generating persistent keys. Persistent storage supports the use of plaintext and vendor keys. Refer to the lower level storage module documentation for information on how it should be initialized. To generate a persistent key the key must be assigned a unique id prior to calling generate using the psa_set_key_id api.
if (PSA_KEY_LIFETIME_IS_PERSISTENT(lifetime))
{
/* Set the id to a positive integer. */
psa_set_key_id(&attributes, (psa_key_id_t) 5);
}
Platform Configuration
To run the mbedCrypto implementation of the PSA Crypto API on the MCU, the macro MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT must be defined in the configuration file. This enables code that will initialize the SCE. Parameter checking (General|MBEDTLS_CHECK_PARAMS) is enabled by default. To reduce code size, disable parameter checking.
Random Number Configuration
To run the mbedCrypto implementation of the PSA Crypto API on the MCU, the macro MBEDTLS_ENTROPY_HARDWARE_ALT must be defined in the configuration file. This enables using the TRNG as an entropy source. None of the other cryptographic operations (even in software only mode) will work without this feature.
Usage Notes
Hardware Initialization
mbedtls_platform_setup() must be invoked before using the PSA Crypto API to ensure that the SCE peripheral is initialized.
Memory Usage
In general, depending on the mbedCrypto features being used a heap size of 0x1000 to 0x5000 bytes is required. The total allocated heap should be the sum of the heap requirements of the individual algorithms:
Algorithm
Required Heap (bytes)
SHA256/224
None
AES
0x200
Hardware ECC
0x400
Software ECC
0x1800
RSA
0x1500
A minimum stack of 0x1000 is required where the module is used. This is either the main stack in a bare metal application or the task stack of the task used for crypto operations.
Limitations
Only little endian mode is supported.
Stdio Buffering
The MBEDTLS_PLATFORM_SETBUF_MACRO was introduced in mbedTLS 3.2.1 to prevent stdio read/write functions from buffering stream data to reduce the likelihood of key leakage by setting the buffer argument in setbuf() to NULL. FSP uses a dummy_setbuf() function in rm_psa_crypto.c to prevent build errors; since FSP uses LittleFS by default (where the usage of a buffer is mandatory) this function does not perform any action. Setting the cache size in LittleFS to the minimum supported by the Data Flash (4) can minimize but not remove the likelihood of key data leakage. The dummy function can be replaced with a user-defined function by defining a different value for MBEDTLS_PLATFORM_SETBUF_MACRO_value in the FSP configurator.
Post Quantum Cryptography (PQC)
The PSA API Specificiation v1.3 supports ML-KEM and ML-DSA however MbedTLS currently does not provide an implementation. The implementation in the FSP release is thus likely to change and may cause backward compatibility issues when MbedTLS officially supports it.
ASN.1 encoding not implemented. Keys are currently implemented in raw bytes.
ML-DSA
The FIPS204 Standard allows the user to provide an optional context string for ML-DSA signature generation and verification. The current implementation does not allow the user to provide such a string. Internally this field is set to a value of 0 with a length of 0.
The data format for import and export of the key pair is a byte array of the 32 byte seed value.
Only ML-DSA-44 and ML-DSA-65 supported. ML-DSA-87 not supported.
Only PSA_ALG_HASH_ML_DSA supported. PSA_ALG_ML_DSA requires PSA to offer a SHAKE-256 implementation.
The current implementation of ML-DSA is too big for devices with less than 64KB of RAM.
There is a known runtime issue when IAR toolchain is used for ML-DSA.
ML-KEM
Only ML-KEM-512 and ML-KEM-768 supported. ML-KEM-1024 not supported.
Key derivation not supported.
The data format for import and export of the key pair is the concatenation of the two 32 byte seed values: d || z
SCE9 Usage
The SCE9 is used in Compatibility Mode for mbedCrypto acceleration. The crypto capabilities in this mode on the SCE9 are different which results in the below usage limitations with mbedCrypto:
The module includes both wrapped and plaintext keys code irrespective of whether the application requires it.
Plaintext key generation is not supported for RSA and ECC; only wrapped keys can be generated.
If ECDH is used, only wrapped key will be generated on SCE9 and will not return an error even if the user context is somehow set for plain key. This may be relevant only if the psa_key_agreement() function with plaintext key on SCE9 is attempted.
Note
For a detailed description of the different SCE9 operating modes, refer to Application Note R11AN0498.
Using PSA Crypto with TrustZone
Unlike FSP drivers, PSA Crypto cannot be configured as Non-secure callable in the RA Configurator for a secure project. The reason for this is that in order to achieve the security objective of controlling access to protected keys, both the PSA Crypto code as well as the keys must be placed in the secure region. Since the PSA Crypto API requires access to the keys directly during initialization and later via a key handle, allowing non-secure code to use the API by making it Non-secure callable will require the keys to be stored in non-secure memory.
This section will provide a short explanation of how to add PSA Crypto to a secure project and have it usable by the non-secure project without exposing the keys. In this example the secure project will contain an RSA private key and the non-secure project is expected to be able to perform sign and verify operations using that key.
PSA Crypto Non-secure callable example
Secure project
During secure project boot-up, psa_crypto_init() is called.
The RSA private key is programmed into secure flash either at the factory or by calling psa_generate_key() in persistent mode. Note that the data-flash area used by the LittleFS will have to be in the secure region if the key is generated as a persistent.
psa_import_key()/psa_open_key() are called with the resultant handle held in secure RAM.
The Non-secure callable section contains the following user-defined functions
The implementation of this function in secure region will call psa_sign_hash() and return the signature via output_signature.
Non-secure project
Calls verify_with_my_rsa_key() to verify a signature. The implementation will use the public key that is present in the secure project.
Calls sign_with_my_rsa_key() to generate a signature. The implementation will use the private key that is present on the secure project.
For more details on how to add user-code to the Non-secure callable region refer to the "Security Design with Arm TrustZone - IP Protection (R11AN0467EU0100)" Application Note.
Examples
Hash Example
This is an example on calculating the SHA256 hash using the PSA Crypto API.
This is an example on using the PSA Crypto API to generate an AES256 key, encrypting and decrypting multi-block data and using PKCS7 padding using AES-CCM.
if (PSA_SUCCESS != psa_generate_random(input, sizeof(input)))
This is an example on using the PSA Crypto API to generate an AES256 key, followed by generation and verification of MAC for random data of known length.
if (PSA_SUCCESS != psa_generate_random(input, sizeof(input)))
/* All the operations succeeded for MAC verification */
}
ECC Example
This is an example on using the PSA Crypto API to generate an ECC-P256R1 key, signing and verifying data after hashing it first using SHA256.
Note
Unlike RSA, ECDSA does not have any padding schemes. Thus the hash argument for the ECC sign operation MUST have a size larger than or equal to the curve size; i.e. for PSA_ECC_CURVE_SECP256R1 the payload size must be at least 256/8 bytes. nist.fips.186-4: " A hash function that provides a lower security strength than the security strength associated with the bit length of 'n' ordinarily should not be used, since this would reduce the security strength of the digital signature process to a level no greater than that provided by the hash function."
if (PSA_SUCCESS != psa_cipher_decrypt(key_handle, alg, encrypt, encr_len, decrypt, sizeof(decrypt), &decr_len))
{
/* Decryption failed */
debugger_break();
}
if (p_import_key_items->plaintext_size == decr_len)
{
debugger_break();
}
if (0 != memcmp(p_import_key_items->plaintext, decrypt, p_import_key_items->plaintext_size))
{
debugger_break();
}
/* Destroy the key */
if (PSA_SUCCESS != psa_destroy_key(key_handle))
{
/* Destroying the key handle failed */
debugger_break();
}
}
CHACHA20-POLY1305 Example
This is an example on using the PSA Crypto API to import an ChaCha20 key, encrypting/decrypting single block data and generates the MAC (authentication tag)
MBEDTLS_PSA_ASSUME_EXCLUSIVE_BUFFERS macro is disabled by default to handle shared memory in a secure manner. Note that this increases heap memory usage and code size. The macro can be enabled if all buffers passed to any PSA function reside in memory that is accessible only to the PSA function during its execution or if it possible otherwise for the user to conclude that the user buffers passed into PSA are secure from modification. Refer to https://github.com/Mbed-TLS/mbedtls-docs/blob/main/security-advisories/mbedtls-security-advisory-2024-03.md for more details.
psa_import_key() now only accepts RSA keys in the PSA standard formats. Applications that need other formats like: PKCS#8, SubjectPublicKey, PEM can call mbedtls_pk_parse_{public,}key() followed by mbedtls_pk_import_into_psa().
/* Generated using "openssl genrsa -out example_private_key.pem 2048" */
This function initializes the SCE and the TRNG. It must be invoked before the crypto library can be used. This implementation is used if MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT is defined.
This implementation is used if MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT is defined. It is intended to de-initialize any items that were initialized in the mbedtls_platform_setup() function, but currently is only a placeholder function.
Example:
/* De-initialize the platform. This is currently a placeholder function which does not do anything. */