This example uses the PSA Crypto API to perform Message Authentication Code (MAC) operations on the supported device.
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:
MSG_SIZE
/16MSG_SIZE
/4MSG_SIZE
The default MSG_SIZE
is 4096
, it is defined in app_process.h
.
The following MAC algorithms are supported in this example:
PSA_ALG_HMAC
(single-part and multi-part)PSA_ALG_CMAC
(single-part and multi-part)The following hash algorithms are supported in this example:
PSA_ALG_SHA_1
PSA_ALG_SHA_224
PSA_ALG_SHA_256
PSA_ALG_SHA_384
PSA_ALG_SHA_512
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_mac_operation_init
psa_mac_sign_setup
psa_mac_verify_setup
psa_mac_update
psa_mac_sign_finish
psa_mac_verify_finish
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_mac_compute
and psa_mac_verify
) are not supported yet.PSA_ALG_HMAC
on the wrapped key is not supported yet.Optimize for debugging (-Og)
on Simplicity IDE and None
on IAR Embedded Workbench.