Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

psa_crypto_transaction_t Union Reference

psa_crypto_transaction_t Union Reference

Transaction data. More...

#include <psa_crypto_storage.h>


Detailed Description

Transaction data.

This type is designed to be serialized by writing the memory representation and reading it back on the same device.

Note:
The transaction mechanism is designed for a single active transaction at a time. The transaction object is psa_crypto_transaction.
If an API call starts a transaction, it must complete this transaction before returning to the application.

The lifetime of a transaction is the following (note that only one transaction may be active at a time):

  1. Call psa_crypto_prepare_transaction() to initialize the transaction object in memory and declare the type of transaction that is starting.
  2. Fill in the type-specific fields of psa_crypto_transaction.
  3. Call psa_crypto_save_transaction() to start the transaction. This saves the transaction data to internal storage.
  4. Perform the work of the transaction by modifying files, contacting external entities, or whatever needs doing. Note that the transaction may be interrupted by a power failure, so you need to have a way recover from interruptions either by undoing what has been done so far or by resuming where you left off.
  5. If there are intermediate stages in the transaction, update the fields of psa_crypto_transaction and call psa_crypto_save_transaction() again when each stage is reached.
  6. When the transaction is over, call psa_crypto_stop_transaction() to remove the transaction data in storage and in memory.

If the system crashes while a transaction is in progress, psa_crypto_init() calls psa_crypto_load_transaction() and takes care of completing or rewinding the transaction. This is done in psa_crypto_recover_transaction() in psa_crypto.c. If you add a new type of transaction, be sure to add code for it in psa_crypto_recover_transaction().

Definition at line 271 of file psa_crypto_storage.h.