@@ -206,6 +206,9 @@ psa_status_t psa_parse_key_data_from_storage( const uint8_t *storage_data,
206
206
typedef uint16_t psa_crypto_transaction_type_t ;
207
207
208
208
/** No transaction is in progress.
209
+ *
210
+ * This has the value 0, so zero-initialization sets a transaction's type to
211
+ * this value.
209
212
*/
210
213
#define PSA_CRYPTO_TRANSACTION_NONE ( (psa_crypto_transaction_type_t) 0x0000 )
211
214
@@ -244,16 +247,22 @@ typedef uint16_t psa_crypto_transaction_type_t;
244
247
* -# Fill in the type-specific fields of #psa_crypto_transaction.
245
248
* -# Call psa_crypto_save_transaction() to start the transaction. This
246
249
* saves the transaction data to internal storage.
250
+ * -# Perform the work of the transaction by modifying files, contacting
251
+ * external entities, or whatever needs doing. Note that the transaction
252
+ * may be interrupted by a power failure, so you need to have a way
253
+ * recover from interruptions either by undoing what has been done
254
+ * so far or by resuming where you left off.
247
255
* -# If there are intermediate stages in the transaction, update
248
256
* the fields of #psa_crypto_transaction and call
249
257
* psa_crypto_save_transaction() again when each stage is reached.
250
- * -# When the transaction is over, whether it has been committed or aborted,
251
- * call psa_crypto_stop_transaction() to remove the transaction data in
252
- * storage and in memory.
258
+ * -# When the transaction is over, call psa_crypto_stop_transaction() to
259
+ * remove the transaction data in storage and in memory.
253
260
*
254
261
* If the system crashes while a transaction is in progress, psa_crypto_init()
255
262
* calls psa_crypto_load_transaction() and takes care of completing or
256
- * rewinding the transaction.
263
+ * rewinding the transaction. This is done in psa_crypto_recover_transaction()
264
+ * in psa_crypto.c. If you add a new type of transactions, be
265
+ * sure to add code for it in psa_crypto_recover_transaction().
257
266
*/
258
267
typedef union
259
268
{
@@ -328,8 +337,10 @@ psa_status_t psa_crypto_load_transaction( void );
328
337
329
338
/** Indicate that the current transaction is finished.
330
339
*
331
- * Call this function at the very end of transaction processing, whether
332
- * the transaction has been committed or aborted.
340
+ * Call this function at the very end of transaction processing.
341
+ * This function does not "commit" or "abort" the transaction: the storage
342
+ * subsystem has no concept of "commit" and "abort", just saving and
343
+ * removing the transaction information in storage.
333
344
*
334
345
* This function erases the transaction data in storage (if any) and
335
346
* resets the transaction data in memory.
0 commit comments