Fix whitespace issues

Only whitespace changes.

* Remove tabs.
* Remove trailing whitespace.
* Correct some misindented lines.
* Normalize whitespace around some punctuation.
* Split some lines to avoid going over 80 columns.
This commit is contained in:
Gilles Peskine 2018-06-06 18:44:09 +02:00 committed by itayzafrir
parent 7f87850fc4
commit 4ca9c3f9a1
2 changed files with 117 additions and 103 deletions

View file

@ -172,4 +172,3 @@ key_lifetime_set_fail:1:PSA_KEY_LIFETIME_WRITE_ONCE:PSA_ERROR_NOT_SUPPORTED
PSA Key Lifetime set fail, invalid key lifetime value
key_lifetime_set_fail:1:PSA_KEY_LIFETIME_PERSISTENT+1:PSA_ERROR_INVALID_ARGUMENT

View file

@ -305,16 +305,16 @@ void cipher_test_encrypt( int alg_arg, int key_type_arg,
TEST_ASSERT( psa_encrypt_setup( &operation, key_slot, alg ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation, iv,
sizeof( iv ) ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation,
iv, sizeof( iv ) ) == PSA_SUCCESS );
output_size_1 = input_size + operation.block_size;
output = mbedtls_calloc(1, output_size_1);
output = mbedtls_calloc( 1, output_size_1 );
TEST_ASSERT( psa_cipher_update( &operation, input, input_size,
output, output_size_1,
&output_length) == PSA_SUCCESS );
&output_length ) == PSA_SUCCESS );
status = psa_cipher_finish( &operation, output + output_length,
output_size_1, &output_length);
output_size_1, &output_length );
TEST_ASSERT( status == (psa_status_t) expected_status );
if( expected_status == PSA_SUCCESS )
{
@ -333,9 +333,9 @@ exit:
/* BEGIN_CASE */
void cipher_test_encrypt_multipart( int alg_arg, int key_type_arg,
char *key_hex,
char *input_hex,
int first_part_size, char *output_hex )
char *key_hex,
char *input_hex,
int first_part_size, char *output_hex )
{
int key_slot = 1;
psa_key_type_t key_type = key_type_arg;
@ -370,20 +370,22 @@ void cipher_test_encrypt_multipart( int alg_arg, int key_type_arg,
TEST_ASSERT( psa_encrypt_setup( &operation, key_slot, alg ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation, iv,
sizeof( iv ) ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation,
iv, sizeof( iv ) ) == PSA_SUCCESS );
output_size_1 = input_size + operation.block_size;
output = mbedtls_calloc(1, output_size_1);
output = mbedtls_calloc( 1, output_size_1 );
TEST_ASSERT( (unsigned int)first_part_size < input_size );
TEST_ASSERT( (unsigned int) first_part_size < input_size );
TEST_ASSERT( psa_cipher_update( &operation, input, first_part_size,
output, output_size_1,
&output_length) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_update( &operation, input + first_part_size, input_size - first_part_size,
&output_length ) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_update( &operation,
input + first_part_size,
input_size - first_part_size,
output, output_size_1,
&output_length) == PSA_SUCCESS );
&output_length ) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_finish( &operation, output + output_length,
output_size_1, &output_length) == PSA_SUCCESS );
output_size_1, &output_length ) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_abort( &operation ) == PSA_SUCCESS );
@ -400,9 +402,9 @@ exit:
/* BEGIN_CASE */
void cipher_test_decrypt_multipart( int alg_arg, int key_type_arg,
char *key_hex,
char *input_hex,
int first_part_size, char *output_hex)
char *key_hex,
char *input_hex,
int first_part_size, char *output_hex )
{
int key_slot = 1;
@ -438,21 +440,23 @@ void cipher_test_decrypt_multipart( int alg_arg, int key_type_arg,
TEST_ASSERT( psa_decrypt_setup( &operation, key_slot, alg ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation, iv,
sizeof( iv ) ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation,
iv, sizeof( iv ) ) == PSA_SUCCESS );
output_size_1 = input_size + operation.block_size;
output = mbedtls_calloc(1, output_size_1);
output = mbedtls_calloc( 1, output_size_1 );
TEST_ASSERT( (unsigned int)first_part_size < input_size );
TEST_ASSERT( (unsigned int) first_part_size < input_size );
TEST_ASSERT( psa_cipher_update( &operation, input, first_part_size,
output, output_size_1,
&output_length) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_update( &operation, input + first_part_size, input_size - first_part_size,
&output_length ) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_update( &operation,
input + first_part_size,
input_size - first_part_size,
output, output_size_1,
&output_length) == PSA_SUCCESS );
&output_length ) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_finish( &operation, output + output_length,
output_size_1, &output_length) == PSA_SUCCESS );
output_size_1, &output_length ) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_abort( &operation ) == PSA_SUCCESS );
TEST_ASSERT( input_size == output_size );
@ -469,9 +473,9 @@ exit:
/* BEGIN_CASE */
void cipher_test_decrypt( int alg_arg, int key_type_arg,
char *key_hex,
char *input_hex, char *output_hex,
int expected_status )
char *key_hex,
char *input_hex, char *output_hex,
int expected_status )
{
int key_slot = 1;
psa_status_t status;
@ -507,17 +511,17 @@ void cipher_test_decrypt( int alg_arg, int key_type_arg,
TEST_ASSERT( psa_decrypt_setup( &operation, key_slot, alg ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation, iv,
sizeof( iv ) ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation,
iv, sizeof( iv ) ) == PSA_SUCCESS );
output_size_1 = input_size + operation.block_size;
output = mbedtls_calloc(1, output_size);
output = mbedtls_calloc( 1, output_size );
TEST_ASSERT( psa_cipher_update( &operation, input, input_size,
output, output_size_1,
&output_length) == PSA_SUCCESS );
&output_length ) == PSA_SUCCESS );
status = psa_cipher_finish( &operation, output + output_length,
output_size_1, &output_length);
output_size_1, &output_length );
TEST_ASSERT( status == (psa_status_t) expected_status );
if( expected_status == PSA_SUCCESS )
@ -540,8 +544,8 @@ exit:
/* BEGIN_CASE */
void cipher_test_verify_output( int alg_arg, int key_type_arg,
char *key_hex,
char *input_hex )
char *key_hex,
char *input_hex )
{
int key_slot = 1;
psa_key_type_t key_type = key_type_arg;
@ -577,32 +581,37 @@ void cipher_test_verify_output( int alg_arg, int key_type_arg,
TEST_ASSERT( psa_encrypt_setup( &operation1, key_slot, alg ) == PSA_SUCCESS );
TEST_ASSERT( psa_decrypt_setup( &operation2, key_slot, alg ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_generate_iv( &operation1, iv,
iv_size, &iv_length) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_generate_iv( &operation1,
iv, iv_size,
&iv_length ) == PSA_SUCCESS );
output1_size = input_size + operation1.block_size;
output1 = mbedtls_calloc(1, output1_size);
TEST_ASSERT( output1 != NULL);
output1 = mbedtls_calloc( 1, output1_size );
TEST_ASSERT( output1 != NULL );
TEST_ASSERT( psa_cipher_update( &operation1, input, input_size,
output1, output1_size,
&output1_length) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_finish( &operation1, output1 + output1_length,
output1_size, &tmp_output_length) == PSA_SUCCESS );
&output1_length ) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_finish( &operation1,
output1 + output1_length, output1_size,
&tmp_output_length ) == PSA_SUCCESS );
output1_length += tmp_output_length;
TEST_ASSERT( psa_cipher_abort( &operation1 ) == PSA_SUCCESS );
output2_size = output1_length;
output2 = mbedtls_calloc(1, output2_size);
output2 = mbedtls_calloc( 1, output2_size );
TEST_ASSERT( psa_encrypt_set_iv( &operation2, iv,
iv_length) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation2,
iv, iv_length ) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_update( &operation2, output1, output1_length,
output2, output2_size, &output2_length) == PSA_SUCCESS );
output2, output2_size,
&output2_length ) == PSA_SUCCESS );
tmp_output_length = 0;
TEST_ASSERT( psa_cipher_finish( &operation2, output2 + output2_length,
output2_size, &tmp_output_length) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_finish( &operation2,
output2 + output2_length,
output2_size,
&tmp_output_length ) == PSA_SUCCESS );
output2_length += tmp_output_length;
@ -621,10 +630,10 @@ exit:
/* BEGIN_CASE */
void cipher_test_verify_output_multpart( int alg_arg,
int key_type_arg,
char *key_hex,
char *input_hex,
int first_part_size )
int key_type_arg,
char *key_hex,
char *input_hex,
int first_part_size )
{
int key_slot = 1;
psa_key_type_t key_type = key_type_arg;
@ -642,7 +651,7 @@ void cipher_test_verify_output_multpart( int alg_arg,
unsigned char *output2;
size_t output2_size = 0;
size_t output2_length = 0;
size_t tmp_output_length , temp = 0;
size_t tmp_output_length, temp = 0;
psa_cipher_operation_t operation1;
psa_cipher_operation_t operation2;
@ -660,51 +669,57 @@ void cipher_test_verify_output_multpart( int alg_arg,
TEST_ASSERT( psa_encrypt_setup( &operation1, key_slot, alg ) == PSA_SUCCESS );
TEST_ASSERT( psa_decrypt_setup( &operation2, key_slot, alg ) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_generate_iv( &operation1, iv,
iv_size, &iv_length) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_generate_iv( &operation1,
iv, iv_size,
&iv_length ) == PSA_SUCCESS );
output1_size = input_size + operation1.block_size;
output1 = mbedtls_calloc(1, output1_size);
output1 = mbedtls_calloc( 1, output1_size );
TEST_ASSERT( (unsigned int)first_part_size < input_size );
TEST_ASSERT( (unsigned int) first_part_size < input_size );
TEST_ASSERT( psa_cipher_update( &operation1, input, first_part_size,
output1, output1_size,
&output1_length) == PSA_SUCCESS );
temp = output1_length ;
&output1_length ) == PSA_SUCCESS );
temp = output1_length;
TEST_ASSERT( psa_cipher_update( &operation1, input + first_part_size, input_size - first_part_size,
TEST_ASSERT( psa_cipher_update( &operation1,
input + first_part_size,
input_size - first_part_size,
output1, output1_size,
&output1_length) == PSA_SUCCESS );
&output1_length ) == PSA_SUCCESS );
output1_length += temp;
TEST_ASSERT( psa_cipher_finish( &operation1, output1 + output1_length,
output1_size - output1_length, &tmp_output_length) == PSA_SUCCESS );
output1_size - output1_length,
&tmp_output_length ) == PSA_SUCCESS );
output1_length += tmp_output_length;
TEST_ASSERT( psa_cipher_abort( &operation1 ) == PSA_SUCCESS );
output2_size = output1_length;
output2 = mbedtls_calloc(1, output2_size);
output2 = mbedtls_calloc( 1, output2_size );
TEST_ASSERT( psa_encrypt_set_iv( &operation2, iv,
iv_length) == PSA_SUCCESS );
TEST_ASSERT( psa_encrypt_set_iv( &operation2,
iv, iv_length ) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_update( &operation2, output1, first_part_size,
output2, output2_size,
&output2_length) == PSA_SUCCESS );
&output2_length ) == PSA_SUCCESS );
temp = output2_length ;
temp = output2_length;
TEST_ASSERT( psa_cipher_update( &operation2, output1 + first_part_size,
output1_length - first_part_size,
output2, output2_size,
&output2_length) == PSA_SUCCESS );
output1_length - first_part_size,
output2, output2_size,
&output2_length ) == PSA_SUCCESS );
output2_length += temp;
tmp_output_length = 0;
TEST_ASSERT( psa_cipher_finish( &operation2, output2 + output2_length,
output2_size - output2_length, &tmp_output_length) == PSA_SUCCESS );
TEST_ASSERT( psa_cipher_finish( &operation2,
output2 + output2_length,
output2_size - output2_length,
&tmp_output_length ) == PSA_SUCCESS );
output2_length += tmp_output_length;