Fix indentation and horizontal whitespace

Only whitespace changes in this commit.
This commit is contained in:
Gilles Peskine 2018-06-04 16:22:46 +02:00 committed by itayzafrir
parent d8100245d8
commit e553c65cc3

View file

@ -1295,7 +1295,7 @@ psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
/* Symmetric cryptography */ /* Symmetric cryptography */
/****************************************************************/ /****************************************************************/
static psa_status_t psa_cipher_setup(psa_cipher_operation_t *operation, static psa_status_t psa_cipher_setup( psa_cipher_operation_t *operation,
psa_key_slot_t key, psa_key_slot_t key,
psa_algorithm_t alg, mbedtls_operation_t cipher_operation) psa_algorithm_t alg, mbedtls_operation_t cipher_operation)
{ {
@ -1377,24 +1377,24 @@ static psa_status_t psa_cipher_setup(psa_cipher_operation_t *operation,
return( PSA_SUCCESS ); return( PSA_SUCCESS );
} }
psa_status_t psa_encrypt_setup(psa_cipher_operation_t *operation, psa_status_t psa_encrypt_setup( psa_cipher_operation_t *operation,
psa_key_slot_t key, psa_key_slot_t key,
psa_algorithm_t alg) psa_algorithm_t alg )
{ {
return psa_cipher_setup( operation, key, alg, MBEDTLS_ENCRYPT ); return psa_cipher_setup( operation, key, alg, MBEDTLS_ENCRYPT );
} }
psa_status_t psa_decrypt_setup(psa_cipher_operation_t *operation, psa_status_t psa_decrypt_setup( psa_cipher_operation_t *operation,
psa_key_slot_t key, psa_key_slot_t key,
psa_algorithm_t alg) psa_algorithm_t alg )
{ {
return psa_cipher_setup( operation, key, alg, MBEDTLS_DECRYPT ); return psa_cipher_setup( operation, key, alg, MBEDTLS_DECRYPT );
} }
psa_status_t psa_encrypt_generate_iv(psa_cipher_operation_t *operation, psa_status_t psa_encrypt_generate_iv( psa_cipher_operation_t *operation,
unsigned char *iv, unsigned char *iv,
size_t iv_size, size_t iv_size,
size_t *iv_length) size_t *iv_length )
{ {
int ret = PSA_SUCCESS; int ret = PSA_SUCCESS;
if( operation->iv_set || !( operation->iv_required ) ) if( operation->iv_set || !( operation->iv_required ) )
@ -1420,9 +1420,9 @@ exit:
return( ret ); return( ret );
} }
psa_status_t psa_encrypt_set_iv(psa_cipher_operation_t *operation, psa_status_t psa_encrypt_set_iv( psa_cipher_operation_t *operation,
const unsigned char *iv, const unsigned char *iv,
size_t iv_length) size_t iv_length )
{ {
int ret = PSA_SUCCESS; int ret = PSA_SUCCESS;
if( operation->iv_set || !( operation->iv_required ) ) if( operation->iv_set || !( operation->iv_required ) )
@ -1444,12 +1444,12 @@ psa_status_t psa_encrypt_set_iv(psa_cipher_operation_t *operation,
return( PSA_SUCCESS ); return( PSA_SUCCESS );
} }
psa_status_t psa_cipher_update(psa_cipher_operation_t *operation, psa_status_t psa_cipher_update( psa_cipher_operation_t *operation,
const uint8_t *input, const uint8_t *input,
size_t input_length, size_t input_length,
unsigned char *output, unsigned char *output,
size_t output_size, size_t output_size,
size_t *output_length) size_t *output_length )
{ {
int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
size_t expected_output_size = ( ( operation->ctx.cipher.unprocessed_len + input_length )/operation->block_size )*operation->block_size; size_t expected_output_size = ( ( operation->ctx.cipher.unprocessed_len + input_length )/operation->block_size )*operation->block_size;
@ -1470,13 +1470,13 @@ psa_status_t psa_cipher_update(psa_cipher_operation_t *operation,
return( PSA_SUCCESS ); return( PSA_SUCCESS );
} }
psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation, psa_status_t psa_cipher_finish( psa_cipher_operation_t *operation,
uint8_t *output, uint8_t *output,
size_t output_size, size_t output_size,
size_t *output_length) size_t *output_length )
{ {
int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE; int ret = MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE;
uint8_t temp_output_buffer[ MBEDTLS_MAX_BLOCK_LENGTH ]; uint8_t temp_output_buffer[MBEDTLS_MAX_BLOCK_LENGTH];
if( ! operation->key_set ) if( ! operation->key_set )
return( PSA_ERROR_BAD_STATE ); return( PSA_ERROR_BAD_STATE );
@ -1502,7 +1502,7 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation,
psa_cipher_abort( operation ); psa_cipher_abort( operation );
return( mbedtls_to_psa_error( ret ) ); return( mbedtls_to_psa_error( ret ) );
} }
if(output_size >= *output_length) if( output_size >= *output_length )
memcpy( output, temp_output_buffer, *output_length ); memcpy( output, temp_output_buffer, *output_length );
else else
{ {
@ -1513,7 +1513,7 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation,
return( PSA_SUCCESS ); return( PSA_SUCCESS );
} }
psa_status_t psa_cipher_abort(psa_cipher_operation_t *operation) psa_status_t psa_cipher_abort( psa_cipher_operation_t *operation )
{ {
mbedtls_cipher_free( &operation->ctx.cipher ); mbedtls_cipher_free( &operation->ctx.cipher );