Switch to the new code style
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/library/psa_crypto_storage.h b/library/psa_crypto_storage.h
index 970e108..8e108c5 100644
--- a/library/psa_crypto_storage.h
+++ b/library/psa_crypto_storage.h
@@ -35,7 +35,7 @@
/* Limit the maximum key size in storage. This should have no effect
* since the key size is limited in memory. */
-#define PSA_CRYPTO_MAX_STORAGE_SIZE ( PSA_BITS_TO_BYTES( PSA_MAX_KEY_BITS ) )
+#define PSA_CRYPTO_MAX_STORAGE_SIZE (PSA_BITS_TO_BYTES(PSA_MAX_KEY_BITS))
/* Sanity check: a file size must fit in 32 bits. Allow a generous
* 64kB of metadata. */
#if PSA_CRYPTO_MAX_STORAGE_SIZE > 0xffff0000
@@ -72,7 +72,7 @@
* \retval 1
* Persistent data present for slot number
*/
-int psa_is_key_present_in_storage( const mbedtls_svc_key_id_t key );
+int psa_is_key_present_in_storage(const mbedtls_svc_key_id_t key);
/**
* \brief Format key data and metadata and save to a location for given key
@@ -105,9 +105,9 @@
* \retval #PSA_ERROR_DATA_INVALID
* \retval #PSA_ERROR_DATA_CORRUPT
*/
-psa_status_t psa_save_persistent_key( const psa_core_key_attributes_t *attr,
- const uint8_t *data,
- const size_t data_length );
+psa_status_t psa_save_persistent_key(const psa_core_key_attributes_t *attr,
+ const uint8_t *data,
+ const size_t data_length);
/**
* \brief Parses key data and metadata and load persistent key for given
@@ -135,9 +135,9 @@
* \retval #PSA_ERROR_DATA_CORRUPT
* \retval #PSA_ERROR_DOES_NOT_EXIST
*/
-psa_status_t psa_load_persistent_key( psa_core_key_attributes_t *attr,
- uint8_t **data,
- size_t *data_length );
+psa_status_t psa_load_persistent_key(psa_core_key_attributes_t *attr,
+ uint8_t **data,
+ size_t *data_length);
/**
* \brief Remove persistent data for the given key slot number.
@@ -150,7 +150,7 @@
* or the key did not exist.
* \retval #PSA_ERROR_DATA_INVALID
*/
-psa_status_t psa_destroy_persistent_key( const mbedtls_svc_key_id_t key );
+psa_status_t psa_destroy_persistent_key(const mbedtls_svc_key_id_t key);
/**
* \brief Free the temporary buffer allocated by psa_load_persistent_key().
@@ -162,7 +162,7 @@
* \param key_data_length Size of the key data buffer.
*
*/
-void psa_free_persistent_key_data( uint8_t *key_data, size_t key_data_length );
+void psa_free_persistent_key_data(uint8_t *key_data, size_t key_data_length);
/**
* \brief Formats key data and metadata for persistent storage
@@ -173,10 +173,10 @@
* \param[out] storage_data Output buffer for the formatted data.
*
*/
-void psa_format_key_data_for_storage( const uint8_t *data,
- const size_t data_length,
- const psa_core_key_attributes_t *attr,
- uint8_t *storage_data );
+void psa_format_key_data_for_storage(const uint8_t *data,
+ const size_t data_length,
+ const psa_core_key_attributes_t *attr,
+ uint8_t *storage_data);
/**
* \brief Parses persistent storage data into key data and metadata
@@ -194,11 +194,11 @@
* \retval #PSA_ERROR_INSUFFICIENT_MEMORY
* \retval #PSA_ERROR_DATA_INVALID
*/
-psa_status_t psa_parse_key_data_from_storage( const uint8_t *storage_data,
- size_t storage_data_length,
- uint8_t **key_data,
- size_t *key_data_length,
- psa_core_key_attributes_t *attr );
+psa_status_t psa_parse_key_data_from_storage(const uint8_t *storage_data,
+ size_t storage_data_length,
+ uint8_t **key_data,
+ size_t *key_data_length,
+ psa_core_key_attributes_t *attr);
#if defined(MBEDTLS_PSA_CRYPTO_SE_C)
/** This symbol is defined if transaction support is required. */
@@ -220,7 +220,7 @@
* This has the value 0, so zero-initialization sets a transaction's type to
* this value.
*/
-#define PSA_CRYPTO_TRANSACTION_NONE ( (psa_crypto_transaction_type_t) 0x0000 )
+#define PSA_CRYPTO_TRANSACTION_NONE ((psa_crypto_transaction_type_t) 0x0000)
/** A key creation transaction.
*
@@ -228,7 +228,7 @@
* Keys in RAM or in internal storage are created atomically in storage
* (simple file creation), so they do not need a transaction mechanism.
*/
-#define PSA_CRYPTO_TRANSACTION_CREATE_KEY ( (psa_crypto_transaction_type_t) 0x0001 )
+#define PSA_CRYPTO_TRANSACTION_CREATE_KEY ((psa_crypto_transaction_type_t) 0x0001)
/** A key destruction transaction.
*
@@ -236,7 +236,7 @@
* Keys in RAM or in internal storage are destroyed atomically in storage
* (simple file deletion), so they do not need a transaction mechanism.
*/
-#define PSA_CRYPTO_TRANSACTION_DESTROY_KEY ( (psa_crypto_transaction_type_t) 0x0002 )
+#define PSA_CRYPTO_TRANSACTION_DESTROY_KEY ((psa_crypto_transaction_type_t) 0x0002)
/** Transaction data.
*
@@ -274,8 +274,7 @@
* in psa_crypto.c. If you add a new type of transaction, be
* sure to add code for it in psa_crypto_recover_transaction().
*/
-typedef union
-{
+typedef union {
/* Each element of this union must have the following properties
* to facilitate serialization and deserialization:
*
@@ -284,8 +283,7 @@
* - Elements of the struct are arranged such a way that there is
* no padding.
*/
- struct psa_crypto_transaction_unknown_s
- {
+ struct psa_crypto_transaction_unknown_s {
psa_crypto_transaction_type_t type;
uint16_t unused1;
uint32_t unused2;
@@ -294,8 +292,7 @@
} unknown;
/* ::type is #PSA_CRYPTO_TRANSACTION_CREATE_KEY or
* #PSA_CRYPTO_TRANSACTION_DESTROY_KEY. */
- struct psa_crypto_transaction_key_s
- {
+ struct psa_crypto_transaction_key_s {
psa_crypto_transaction_type_t type;
uint16_t unused1;
psa_key_lifetime_t lifetime;
@@ -315,7 +312,7 @@
* \param type The type of transaction to start.
*/
static inline void psa_crypto_prepare_transaction(
- psa_crypto_transaction_type_t type )
+ psa_crypto_transaction_type_t type)
{
psa_crypto_transaction.unknown.type = type;
}
@@ -330,7 +327,7 @@
* \retval #PSA_ERROR_INSUFFICIENT_STORAGE
* \retval #PSA_ERROR_STORAGE_FAILURE
*/
-psa_status_t psa_crypto_save_transaction( void );
+psa_status_t psa_crypto_save_transaction(void);
/** Load the transaction data from storage, if any.
*
@@ -346,7 +343,7 @@
* \retval #PSA_ERROR_DATA_INVALID
* \retval #PSA_ERROR_DATA_CORRUPT
*/
-psa_status_t psa_crypto_load_transaction( void );
+psa_status_t psa_crypto_load_transaction(void);
/** Indicate that the current transaction is finished.
*
@@ -366,13 +363,13 @@
* It was impossible to determine whether there was transaction data
* in storage, or the transaction data could not be erased.
*/
-psa_status_t psa_crypto_stop_transaction( void );
+psa_status_t psa_crypto_stop_transaction(void);
/** The ITS file identifier for the transaction data.
*
* 0xffffffNN = special file; 0x74 = 't' for transaction.
*/
-#define PSA_CRYPTO_ITS_TRANSACTION_UID ( (psa_key_id_t) 0xffffff74 )
+#define PSA_CRYPTO_ITS_TRANSACTION_UID ((psa_key_id_t) 0xffffff74)
#endif /* PSA_CRYPTO_STORAGE_HAS_TRANSACTIONS */
@@ -388,8 +385,8 @@
* \retval #PSA_ERROR_NOT_PERMITTED
* The entropy seed file already exists.
*/
-psa_status_t mbedtls_psa_storage_inject_entropy( const unsigned char *seed,
- size_t seed_size );
+psa_status_t mbedtls_psa_storage_inject_entropy(const unsigned char *seed,
+ size_t seed_size);
#endif /* MBEDTLS_PSA_INJECT_ENTROPY */
#ifdef __cplusplus