This example uses the PSA Crypto API to perform unauthenticated ciphers’ operations on the supported device.
The build-in AES-128 key can be selected for AES cipher operations if this key is available on the supported device. The default AES-128 key (encrypt-unsafe-key.prv
) can be found in the Windows folder below.
C:\SiliconLabs\SimplicityStudio\v5\developer\adapter_packs\secmgr\scripts\offline
The AES-128 key (encrypt-unsafe-key.prv
) is:
81a5e21fa15286f1df445c2cc120fa3f
If the AES-128 key has not been provisioned on the device, the program will skip the cipher operation of this key.
The example redirects standard I/O to the virtual serial port (VCOM) of the kit. By default, the serial port setting is 115200 bps and 8-N-1 configuration.
Except for the Series 1 Cortex-M0+ device, the example has been instrumented with code to count the number of clock cycles spent in different operations. The results are printed on the VCOM serial port console. This feature can be disabled by defining PSA_CRYPTO_PRINT=0
(default is 1) in the IDE setting (Preprocessor->Defined symbols
).
The following key storages are supported in this example:
The following key sizes are supported in this example:
The following payload sizes are supported in this example:
PLAIN_MSG_SIZE
/16PLAIN_MSG_SIZE
/4PLAIN_MSG_SIZE
The default PLAIN_MSG_SIZE
is 4096
, it is defined in app_psa_crypto_cipher.h
.
The following unauthenticated cipher algorithms are supported in this example:
PSA_ALG_ECB_NO_PADDING
(single-part)PSA_ALG_CBC_NO_PADDING
(single-part)PSA_ALG_CFB
(single-part and multi-part)PSA_ALG_CTR
(single-part and multi-part)PSA_ALG_CHACHA20
(single-part and multi-part)The PSA_ALG_CHACHA20
can only use a 256-bit key.
The following built-in key is supported in this example:
The default cipher algorithm of the AES-128 key is PSA_ALG_CTR
, it is defined in sli_se_opaque_types.h
.
The following PSA Crypto APIs are used in this example:
psa_crypto_init
psa_key_attributes_init
psa_set_key_type
psa_set_key_bits
psa_set_key_usage_flags
psa_set_key_algorithm
psa_set_key_id
psa_set_key_lifetime
psa_generate_key
psa_import_key
psa_get_key_attributes
psa_get_key_algorithm
psa_reset_key_attributes
psa_destroy_key
psa_generate_random
psa_hash_compute
psa_hash_compare
psa_cipher_operation_init
psa_cipher_encrypt_setup
psa_cipher_decrypt_setup
psa_cipher_generate_iv
psa_cipher_set_iv
psa_cipher_update
psa_cipher_finish
mbedtls_psa_crypto_free
Adapter Firmware
under General Device Information in Simplicity Studio 5 Users Guide).Secure Firmware
under General Device Information in Simplicity Studio 5 Users Guide).Device Console
in Simplicity Studio 5, Line terminator:
must be set to None
).Platform()
checkbox to browse the platform examples).PERSISTENT_KEY_ID
value in app_process.h
if this key ID had already existed in NVM3.psa_cipher_encrypt
and psa_cipher_decrypt
) are not supported yet.PSA_ALG_CHACHA20
on the wrapped key is not supported yet.Optimize for debugging (-Og)
on Simplicity IDE and None
on IAR Embedded Workbench.