FreeRTOS / iot-reference-stm32u5

MIT License
43 stars 29 forks source link

PSA public key update #86

Closed grdSTM closed 12 months ago

grdSTM commented 1 year ago

Allow to update the code signing public key through the PSA PKI object implementation.

Description

In PSA/TrustZone configuration, once the code signing public key has been set by the user through the CLI, it cannot be overwitten.

The current method in the FreeRTOS reference integration for STM32u5 is to perform a regression of the trusted storage used by the PSA crypto implementation, and do the device provisioning from scratch again.

This pull request provides an alternative: Delete the key first, then write new contents. It follows the same pattern as the CLI keypair generation, in lGenerateKeyPairECPsaCrypto().

Test Steps

Run "> pki import key ota_signer_pub" from the CLI a couple of times, and ensure the latter is successful.