GET macros use a target variable
The GET macros used to write to a macro parameter, but now
they can be used to assign a value to the desired variable
rather than pass it in as an argument and have it modified
in the macro function.
Due to this MBEDTLS_BYTES_TO_U32_LE is the same as
MBEDTLS_GET_UINT32_LE and was there for replaced in the
appropriate files and removed from common.h
Signed-off-by: Joe Subbiani <joe.subbiani@arm.com>
diff --git a/library/psa_crypto_storage.c b/library/psa_crypto_storage.c
index 07c2cdf..c6660b9 100644
--- a/library/psa_crypto_storage.c
+++ b/library/psa_crypto_storage.c
@@ -293,11 +293,11 @@
if( status != PSA_SUCCESS )
return( status );
- MBEDTLS_GET_UINT32_LE( version, storage_format->version, 0 );
+ version = MBEDTLS_GET_UINT32_LE( storage_format->version, 0 );
if( version != 0 )
return( PSA_ERROR_DATA_INVALID );
- MBEDTLS_GET_UINT32_LE( *key_data_length, storage_format->data_len, 0 );
+ *key_data_length = MBEDTLS_GET_UINT32_LE( storage_format->data_len, 0 );
if( *key_data_length > ( storage_data_length - sizeof(*storage_format) ) ||
*key_data_length > PSA_CRYPTO_MAX_STORAGE_SIZE )
return( PSA_ERROR_DATA_INVALID );
@@ -314,12 +314,12 @@
memcpy( *key_data, storage_format->key_data, *key_data_length );
}
- MBEDTLS_GET_UINT32_LE( attr->lifetime, storage_format->lifetime, 0 );
- MBEDTLS_GET_UINT16_LE( attr->type, storage_format->type, 0 );
- MBEDTLS_GET_UINT16_LE( attr->bits, storage_format->bits, 0 );
- MBEDTLS_GET_UINT32_LE( attr->policy.usage, storage_format->policy, 0 );
- MBEDTLS_GET_UINT32_LE( attr->policy.alg, storage_format->policy, sizeof( uint32_t ) );
- MBEDTLS_GET_UINT32_LE( attr->policy.alg2, storage_format->policy, 2 * sizeof( uint32_t ) );
+ attr->lifetime = MBEDTLS_GET_UINT32_LE( storage_format->lifetime, 0 );
+ attr->type = MBEDTLS_GET_UINT16_LE( storage_format->type, 0 );
+ attr->bits = MBEDTLS_GET_UINT16_LE( storage_format->bits, 0 );
+ attr->policy.usage = MBEDTLS_GET_UINT32_LE( storage_format->policy, 0 );
+ attr->policy.alg = MBEDTLS_GET_UINT32_LE( storage_format->policy, sizeof( uint32_t ) );
+ attr->policy.alg2 = MBEDTLS_GET_UINT32_LE( storage_format->policy, 2 * sizeof( uint32_t ) );
return( PSA_SUCCESS );
}