Correct coding style issues
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
54648243cd
commit
b5dd7c794d
1 changed files with 31 additions and 16 deletions
|
@ -2083,12 +2083,14 @@ psa_status_t psa_hash_setup( psa_hash_operation_t *operation,
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
|
|
||||||
/* A context must be freshly initialized before it can be set up. */
|
/* 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;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !PSA_ALG_IS_HASH( alg ) ) {
|
if( !PSA_ALG_IS_HASH( alg ) )
|
||||||
|
{
|
||||||
status = PSA_ERROR_INVALID_ARGUMENT;
|
status = PSA_ERROR_INVALID_ARGUMENT;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -2101,7 +2103,7 @@ psa_status_t psa_hash_setup( psa_hash_operation_t *operation,
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if( status != PSA_SUCCESS )
|
if( status != PSA_SUCCESS )
|
||||||
psa_hash_abort(operation);
|
psa_hash_abort( operation );
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -2112,7 +2114,8 @@ psa_status_t psa_hash_update( psa_hash_operation_t *operation,
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
|
|
||||||
if( operation->id == 0 ) {
|
if( operation->id == 0 )
|
||||||
|
{
|
||||||
status = PSA_ERROR_BAD_STATE;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -2160,7 +2163,8 @@ psa_status_t psa_hash_verify( psa_hash_operation_t *operation,
|
||||||
if( status != PSA_SUCCESS )
|
if( status != PSA_SUCCESS )
|
||||||
goto exit;
|
goto exit;
|
||||||
|
|
||||||
if( actual_hash_length != hash_length ) {
|
if( actual_hash_length != hash_length )
|
||||||
|
{
|
||||||
status = PSA_ERROR_INVALID_SIGNATURE;
|
status = PSA_ERROR_INVALID_SIGNATURE;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -2297,7 +2301,8 @@ static psa_status_t psa_mac_setup( psa_mac_operation_t *operation,
|
||||||
psa_key_slot_t *slot = NULL;
|
psa_key_slot_t *slot = NULL;
|
||||||
|
|
||||||
/* A context must be freshly initialized before it can be set up. */
|
/* 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;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -2399,19 +2404,22 @@ psa_status_t psa_mac_sign_finish( psa_mac_operation_t *operation,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ! operation->is_sign ) {
|
if( ! operation->is_sign )
|
||||||
|
{
|
||||||
status = PSA_ERROR_BAD_STATE;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sanity check. This will guarantee that mac_size != 0 (and so mac != NULL)
|
/* Sanity check. This will guarantee that mac_size != 0 (and so mac != NULL)
|
||||||
* once all the error checks are done. */
|
* once all the error checks are done. */
|
||||||
if( operation->mac_size == 0 ) {
|
if( operation->mac_size == 0 )
|
||||||
|
{
|
||||||
status = PSA_ERROR_BAD_STATE;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( mac_size < operation->mac_size ) {
|
if( mac_size < operation->mac_size )
|
||||||
|
{
|
||||||
status = PSA_ERROR_BUFFER_TOO_SMALL;
|
status = PSA_ERROR_BUFFER_TOO_SMALL;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -2449,12 +2457,14 @@ psa_status_t psa_mac_verify_finish( psa_mac_operation_t *operation,
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
psa_status_t abort_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;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( operation->is_sign ) {
|
if( operation->is_sign )
|
||||||
|
{
|
||||||
status = PSA_ERROR_BAD_STATE;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -3224,13 +3234,15 @@ static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
|
||||||
PSA_KEY_USAGE_DECRYPT );
|
PSA_KEY_USAGE_DECRYPT );
|
||||||
|
|
||||||
/* A context must be freshly initialized before it can be set up. */
|
/* 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;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The requested algorithm must be one that can be processed by cipher. */
|
/* 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;
|
status = PSA_ERROR_INVALID_ARGUMENT;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
@ -3345,17 +3357,20 @@ psa_status_t psa_cipher_set_iv( psa_cipher_operation_t *operation,
|
||||||
{
|
{
|
||||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
|
|
||||||
if( operation->id == 0 ) {
|
if( operation->id == 0 )
|
||||||
|
{
|
||||||
status = PSA_ERROR_BAD_STATE;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( operation->iv_set || ! operation->iv_required ) {
|
if( operation->iv_set || ! operation->iv_required )
|
||||||
|
{
|
||||||
status = PSA_ERROR_BAD_STATE;
|
status = PSA_ERROR_BAD_STATE;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( iv_length > PSA_CIPHER_IV_MAX_SIZE ) {
|
if( iv_length > PSA_CIPHER_IV_MAX_SIZE )
|
||||||
|
{
|
||||||
status = PSA_ERROR_INVALID_ARGUMENT;
|
status = PSA_ERROR_INVALID_ARGUMENT;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue