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_SIZEThe 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_1PSA_ALG_SHA_224PSA_ALG_SHA_256PSA_ALG_SHA_384PSA_ALG_SHA_512The following PSA Crypto APIs are used in this example:
psa_crypto_initpsa_key_attributes_initpsa_set_key_typepsa_set_key_bitspsa_set_key_usage_flagspsa_set_key_algorithmpsa_set_key_idpsa_set_key_lifetimepsa_generate_keypsa_import_keypsa_get_key_attributespsa_get_key_algorithmpsa_reset_key_attributespsa_destroy_keypsa_generate_randompsa_mac_operation_initpsa_mac_sign_setuppsa_mac_verify_setuppsa_mac_updatepsa_mac_sign_finishpsa_mac_verify_finishAdapter 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.