Correct coding style issues
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 9ab7561..43787cf 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -2083,12 +2083,14 @@
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
/* A context must be freshly initialized before it can be set up. */
- if( operation->id != 0 ) {
+ if( operation->id != 0 )
+ {
status = PSA_ERROR_BAD_STATE;
goto exit;
}
- if( !PSA_ALG_IS_HASH( alg ) ) {
+ if( !PSA_ALG_IS_HASH( alg ) )
+ {
status = PSA_ERROR_INVALID_ARGUMENT;
goto exit;
}
@@ -2101,7 +2103,7 @@
exit:
if( status != PSA_SUCCESS )
- psa_hash_abort(operation);
+ psa_hash_abort( operation );
return status;
}
@@ -2112,7 +2114,8 @@
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
- if( operation->id == 0 ) {
+ if( operation->id == 0 )
+ {
status = PSA_ERROR_BAD_STATE;
goto exit;
}
@@ -2160,7 +2163,8 @@
if( status != PSA_SUCCESS )
goto exit;
- if( actual_hash_length != hash_length ) {
+ if( actual_hash_length != hash_length )
+ {
status = PSA_ERROR_INVALID_SIGNATURE;
goto exit;
}
@@ -2297,7 +2301,8 @@
psa_key_slot_t *slot = NULL;
/* A context must be freshly initialized before it can be set up. */
- if( operation->id != 0 ) {
+ if( operation->id != 0 )
+ {
status = PSA_ERROR_BAD_STATE;
goto exit;
}
@@ -2399,19 +2404,22 @@
goto cleanup;
}
- if( ! operation->is_sign ) {
+ if( ! operation->is_sign )
+ {
status = PSA_ERROR_BAD_STATE;
goto cleanup;
}
/* Sanity check. This will guarantee that mac_size != 0 (and so mac != NULL)
* once all the error checks are done. */
- if( operation->mac_size == 0 ) {
+ if( operation->mac_size == 0 )
+ {
status = PSA_ERROR_BAD_STATE;
goto cleanup;
}
- if( mac_size < operation->mac_size ) {
+ if( mac_size < operation->mac_size )
+ {
status = PSA_ERROR_BUFFER_TOO_SMALL;
goto cleanup;
}
@@ -2449,12 +2457,14 @@
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
psa_status_t abort_status = PSA_ERROR_CORRUPTION_DETECTED;
- if( operation->id == 0 ) {
+ if( operation->id == 0 )
+ {
status = PSA_ERROR_BAD_STATE;
goto cleanup;
}
- if( operation->is_sign ) {
+ if( operation->is_sign )
+ {
status = PSA_ERROR_BAD_STATE;
goto cleanup;
}
@@ -3224,13 +3234,15 @@
PSA_KEY_USAGE_DECRYPT );
/* A context must be freshly initialized before it can be set up. */
- if( operation->id != 0 ) {
+ if( operation->id != 0 )
+ {
status = PSA_ERROR_BAD_STATE;
goto exit;
}
/* The requested algorithm must be one that can be processed by cipher. */
- if( ! PSA_ALG_IS_CIPHER( alg ) ) {
+ if( ! PSA_ALG_IS_CIPHER( alg ) )
+ {
status = PSA_ERROR_INVALID_ARGUMENT;
goto exit;
}
@@ -3345,17 +3357,20 @@
{
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
- if( operation->id == 0 ) {
+ if( operation->id == 0 )
+ {
status = PSA_ERROR_BAD_STATE;
goto exit;
}
- if( operation->iv_set || ! operation->iv_required ) {
+ if( operation->iv_set || ! operation->iv_required )
+ {
status = PSA_ERROR_BAD_STATE;
goto exit;
}
- if( iv_length > PSA_CIPHER_IV_MAX_SIZE ) {
+ if( iv_length > PSA_CIPHER_IV_MAX_SIZE )
+ {
status = PSA_ERROR_INVALID_ARGUMENT;
goto exit;
}