Be more consistent about blank lines

This commit is contained in:
Gilles Peskine 2018-06-18 21:49:39 +02:00 committed by itayzafrir
parent 803ce7402a
commit 7bcfc0a9ae
2 changed files with 10 additions and 33 deletions

View File

@ -305,6 +305,8 @@ static psa_status_t mbedtls_to_psa_error( int ret )
} }
} }
/****************************************************************/ /****************************************************************/
/* Key management */ /* Key management */
/****************************************************************/ /****************************************************************/
@ -556,7 +558,6 @@ psa_status_t psa_export_key( psa_key_slot_t key,
data_length, 0 ) ); data_length, 0 ) );
} }
psa_status_t psa_export_public_key( psa_key_slot_t key, psa_status_t psa_export_public_key( psa_key_slot_t key,
uint8_t *data, uint8_t *data,
size_t data_size, size_t data_size,
@ -566,6 +567,8 @@ psa_status_t psa_export_public_key( psa_key_slot_t key,
data_length, 1 ) ); data_length, 1 ) );
} }
/****************************************************************/ /****************************************************************/
/* Message digests */ /* Message digests */
/****************************************************************/ /****************************************************************/
@ -909,7 +912,6 @@ psa_status_t psa_hash_verify( psa_hash_operation_t *operation,
/****************************************************************/ /****************************************************************/
/* MAC */ /* MAC */
/****************************************************************/ /****************************************************************/
@ -1395,7 +1397,6 @@ psa_status_t psa_mac_verify( psa_mac_operation_t *operation,
/****************************************************************/ /****************************************************************/
/* Asymmetric cryptography */ /* Asymmetric cryptography */
/****************************************************************/ /****************************************************************/
@ -1679,7 +1680,6 @@ psa_status_t psa_asymmetric_encrypt( psa_key_slot_t key,
{ {
return( PSA_ERROR_NOT_SUPPORTED ); return( PSA_ERROR_NOT_SUPPORTED );
} }
} }
psa_status_t psa_asymmetric_decrypt( psa_key_slot_t key, psa_status_t psa_asymmetric_decrypt( psa_key_slot_t key,
@ -1748,9 +1748,10 @@ psa_status_t psa_asymmetric_decrypt( psa_key_slot_t key,
{ {
return( PSA_ERROR_NOT_SUPPORTED ); return( PSA_ERROR_NOT_SUPPORTED );
} }
} }
/****************************************************************/ /****************************************************************/
/* Symmetric cryptography */ /* Symmetric cryptography */
/****************************************************************/ /****************************************************************/
@ -2015,6 +2016,7 @@ psa_status_t psa_cipher_abort( psa_cipher_operation_t *operation )
} }
/****************************************************************/ /****************************************************************/
/* Key Policy */ /* Key Policy */
/****************************************************************/ /****************************************************************/
@ -2128,9 +2130,11 @@ psa_status_t psa_set_key_lifetime( psa_key_slot_t key,
} }
/****************************************************************/ /****************************************************************/
/* AEAD */ /* AEAD */
/****************************************************************/ /****************************************************************/
psa_status_t psa_aead_encrypt( psa_key_slot_t key, psa_status_t psa_aead_encrypt( psa_key_slot_t key,
psa_algorithm_t alg, psa_algorithm_t alg,
const uint8_t *nonce, const uint8_t *nonce,
@ -2223,8 +2227,6 @@ psa_status_t psa_aead_encrypt( psa_key_slot_t key,
//update the tag pointer to point to the end of the ciphertext_length //update the tag pointer to point to the end of the ciphertext_length
tag = ciphertext + plaintext_length; tag = ciphertext + plaintext_length;
mbedtls_ccm_init( &ccm ); mbedtls_ccm_init( &ccm );
ret = mbedtls_ccm_setkey( &ccm, cipher_id, ret = mbedtls_ccm_setkey( &ccm, cipher_id,
slot->data.raw.data, key_bits ); slot->data.raw.data, key_bits );
@ -2393,6 +2395,7 @@ psa_status_t psa_aead_decrypt( psa_key_slot_t key,
} }
/****************************************************************/ /****************************************************************/
/* Module setup */ /* Module setup */
/****************************************************************/ /****************************************************************/

View File

@ -145,7 +145,6 @@ exit:
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE */
void import_export_public_key( data_t *data, void import_export_public_key( data_t *data,
int type_arg, int type_arg,
@ -317,7 +316,6 @@ exit:
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE */
void cipher_encrypt( int alg_arg, int key_type_arg, void cipher_encrypt( int alg_arg, int key_type_arg,
data_t *key, data_t *key,
@ -524,7 +522,6 @@ exit:
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE */
void cipher_decrypt( int alg_arg, int key_type_arg, void cipher_decrypt( int alg_arg, int key_type_arg,
data_t *key, data_t *key,
@ -585,7 +582,6 @@ void cipher_decrypt( int alg_arg, int key_type_arg,
(size_t) expected_output->len ) == 0 ); (size_t) expected_output->len ) == 0 );
} }
exit: exit:
mbedtls_free( output ); mbedtls_free( output );
psa_destroy_key( key_slot ); psa_destroy_key( key_slot );
@ -593,7 +589,6 @@ exit:
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE */
void cipher_verify_output( int alg_arg, int key_type_arg, void cipher_verify_output( int alg_arg, int key_type_arg,
data_t *key, data_t *key,
@ -853,12 +848,10 @@ void aead_encrypt_decrypt( int key_type_arg,
&output_length2 ) == &output_length2 ) ==
expected_result ); expected_result );
TEST_ASSERT( memcmp( input_data->x, output_data2, TEST_ASSERT( memcmp( input_data->x, output_data2,
(size_t) input_data->len ) == 0 ); (size_t) input_data->len ) == 0 );
} }
exit: exit:
psa_destroy_key( slot ); psa_destroy_key( slot );
mbedtls_free( output_data ); mbedtls_free( output_data );
@ -917,11 +910,9 @@ void aead_encrypt( int key_type_arg, data_t * key_data,
output_data, output_size, output_data, output_size,
&output_length ) == PSA_SUCCESS ); &output_length ) == PSA_SUCCESS );
TEST_ASSERT( memcmp( output_data, expected_result->x, TEST_ASSERT( memcmp( output_data, expected_result->x,
output_length ) == 0 ); output_length ) == 0 );
exit: exit:
psa_destroy_key( slot ); psa_destroy_key( slot );
mbedtls_free( output_data ); mbedtls_free( output_data );
@ -945,7 +936,6 @@ void aead_decrypt( int key_type_arg, data_t * key_data,
psa_key_policy_t policy = {0}; psa_key_policy_t policy = {0};
psa_status_t expected_result = (psa_status_t) expected_result_arg; psa_status_t expected_result = (psa_status_t) expected_result_arg;
TEST_ASSERT( key_data != NULL ); TEST_ASSERT( key_data != NULL );
TEST_ASSERT( input_data != NULL ); TEST_ASSERT( input_data != NULL );
TEST_ASSERT( additional_data != NULL ); TEST_ASSERT( additional_data != NULL );
@ -982,15 +972,12 @@ void aead_decrypt( int key_type_arg, data_t * key_data,
output_size, &output_length ) == output_size, &output_length ) ==
expected_result ); expected_result );
if( expected_result == PSA_SUCCESS ) if( expected_result == PSA_SUCCESS )
{ {
TEST_ASSERT( memcmp( output_data, expected_data->x, TEST_ASSERT( memcmp( output_data, expected_data->x,
output_length ) == 0 ); output_length ) == 0 );
} }
exit: exit:
psa_destroy_key( slot ); psa_destroy_key( slot );
mbedtls_free( output_data ); mbedtls_free( output_data );
@ -1239,7 +1226,6 @@ exit:
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE */
void key_lifetime_set_fail( int key_slot_arg, void key_lifetime_set_fail( int key_slot_arg,
int lifetime_arg, int lifetime_arg,
@ -1312,7 +1298,6 @@ void asymmetric_verify_fail( int key_type_arg, data_t *key_data,
data_t *signature_data, data_t *signature_data,
int expected_status_arg ) int expected_status_arg )
{ {
int slot = 1; int slot = 1;
psa_key_type_t key_type = key_type_arg; psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg; psa_algorithm_t alg = alg_arg;
@ -1345,7 +1330,6 @@ void asymmetric_verify_fail( int key_type_arg, data_t *key_data,
signature_data->x, signature_data->x,
(size_t) signature_data->len ); (size_t) signature_data->len );
TEST_ASSERT( actual_status == expected_status ); TEST_ASSERT( actual_status == expected_status );
exit: exit:
@ -1354,7 +1338,6 @@ exit:
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE */
void asymmetric_encrypt_decrypt( int key_type_arg, data_t *key_data, void asymmetric_encrypt_decrypt( int key_type_arg, data_t *key_data,
int alg_arg, data_t *input_data ) int alg_arg, data_t *input_data )
@ -1420,18 +1403,14 @@ exit:
mbedtls_free( output ); mbedtls_free( output );
mbedtls_free( output2 ); mbedtls_free( output2 );
mbedtls_psa_crypto_free( ); mbedtls_psa_crypto_free( );
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE */
void asymmetric_encrypt_fail( int key_type_arg, data_t *key_data, void asymmetric_encrypt_fail( int key_type_arg, data_t *key_data,
int alg_arg, data_t *input_data, int alg_arg, data_t *input_data,
int expected_status_arg ) int expected_status_arg )
{ {
int slot = 1; int slot = 1;
psa_key_type_t key_type = key_type_arg; psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg; psa_algorithm_t alg = alg_arg;
@ -1474,7 +1453,6 @@ exit:
psa_destroy_key( slot ); psa_destroy_key( slot );
mbedtls_free( output ); mbedtls_free( output );
mbedtls_psa_crypto_free( ); mbedtls_psa_crypto_free( );
} }
/* END_CASE */ /* END_CASE */
@ -1526,18 +1504,14 @@ exit:
psa_destroy_key( slot ); psa_destroy_key( slot );
mbedtls_free( output ); mbedtls_free( output );
mbedtls_psa_crypto_free( ); mbedtls_psa_crypto_free( );
} }
/* END_CASE */ /* END_CASE */
/* BEGIN_CASE */ /* BEGIN_CASE */
void asymmetric_decrypt_fail( int key_type_arg, data_t *key_data, void asymmetric_decrypt_fail( int key_type_arg, data_t *key_data,
int alg_arg, data_t *input_data, int alg_arg, data_t *input_data,
int expected_status_arg ) int expected_status_arg )
{ {
int slot = 1; int slot = 1;
psa_key_type_t key_type = key_type_arg; psa_key_type_t key_type = key_type_arg;
psa_algorithm_t alg = alg_arg; psa_algorithm_t alg = alg_arg;