Remove trailing whitespace
Only horizontal whitespace changes in this commit.
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index c9562d3..69854c7 100755
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1442,15 +1442,15 @@
}
}
-
-psa_status_t psa_asymmetric_encrypt(psa_key_slot_t key,
- psa_algorithm_t alg,
- const uint8_t *input,
- size_t input_length,
- const uint8_t *salt,
- size_t salt_length,
- uint8_t *output,
- size_t output_size,
+
+psa_status_t psa_asymmetric_encrypt(psa_key_slot_t key,
+ psa_algorithm_t alg,
+ const uint8_t *input,
+ size_t input_length,
+ const uint8_t *salt,
+ size_t salt_length,
+ uint8_t *output,
+ size_t output_size,
size_t *output_length)
{
key_slot_t *slot;
@@ -1471,7 +1471,7 @@
{
mbedtls_rsa_context *rsa = slot->data.rsa;
int ret;
- if( output_size < rsa->len )
+ if( output_size < rsa->len )
return( PSA_ERROR_INVALID_ARGUMENT );
#if defined(MBEDTLS_PKCS1_V15)
if( alg == PSA_ALG_RSA_PKCS1V15_CRYPT )
@@ -1480,7 +1480,7 @@
mbedtls_ctr_drbg_random,
&global_data.ctr_drbg,
MBEDTLS_RSA_PUBLIC,
- input_length,
+ input_length,
input,
output );
}
@@ -1513,17 +1513,17 @@
return( PSA_ERROR_NOT_SUPPORTED );
}
-}
+}
-
-psa_status_t psa_asymmetric_decrypt(psa_key_slot_t key,
- psa_algorithm_t alg,
- const uint8_t *input,
- size_t input_length,
- const uint8_t *salt,
- size_t salt_length,
- uint8_t *output,
- size_t output_size,
+
+psa_status_t psa_asymmetric_decrypt(psa_key_slot_t key,
+ psa_algorithm_t alg,
+ const uint8_t *input,
+ size_t input_length,
+ const uint8_t *salt,
+ size_t salt_length,
+ uint8_t *output,
+ size_t output_size,
size_t *output_length)
{
key_slot_t *slot;
@@ -1544,7 +1544,7 @@
mbedtls_rsa_context *rsa = slot->data.rsa;
int ret;
- if( output_size < rsa->len )
+ if( output_size < rsa->len )
return( PSA_ERROR_INVALID_ARGUMENT );
#if defined(MBEDTLS_PKCS1_V15)
@@ -1555,9 +1555,9 @@
mbedtls_ctr_drbg_random,
&global_data.ctr_drbg,
MBEDTLS_RSA_PRIVATE,
- output_length,
+ output_length,
input,
- output,
+ output,
output_size );
}
else
@@ -1589,8 +1589,8 @@
return( PSA_ERROR_NOT_SUPPORTED );
}
-}
-
+}
+
/****************************************************************/
/* Key Policy */
@@ -1626,13 +1626,13 @@
if( key == 0 || key > MBEDTLS_PSA_KEY_SLOT_COUNT || policy == NULL )
return( PSA_ERROR_INVALID_ARGUMENT );
-
+
slot = &global_data.key_slots[key];
if( slot->type != PSA_KEY_TYPE_NONE )
return( PSA_ERROR_OCCUPIED_SLOT );
- if( ( policy->usage & ~( PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_ENCRYPT
- | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_SIGN
+ if( ( policy->usage & ~( PSA_KEY_USAGE_EXPORT | PSA_KEY_USAGE_ENCRYPT
+ | PSA_KEY_USAGE_DECRYPT | PSA_KEY_USAGE_SIGN
| PSA_KEY_USAGE_VERIFY ) ) != 0 )
return( PSA_ERROR_INVALID_ARGUMENT );
@@ -1650,7 +1650,7 @@
return( PSA_ERROR_INVALID_ARGUMENT );
slot = &global_data.key_slots[key];
-
+
*policy = slot->policy;
return( PSA_SUCCESS );
@@ -1671,7 +1671,7 @@
return( PSA_ERROR_INVALID_ARGUMENT );
slot = &global_data.key_slots[key];
-
+
*lifetime = slot->lifetime;
return( PSA_SUCCESS );
@@ -1685,8 +1685,8 @@
if( key == 0 || key > MBEDTLS_PSA_KEY_SLOT_COUNT )
return( PSA_ERROR_INVALID_ARGUMENT );
- if( lifetime != PSA_KEY_LIFETIME_VOLATILE &&
- lifetime != PSA_KEY_LIFETIME_PERSISTENT &&
+ if( lifetime != PSA_KEY_LIFETIME_VOLATILE &&
+ lifetime != PSA_KEY_LIFETIME_PERSISTENT &&
lifetime != PSA_KEY_LIFETIME_WRITE_ONCE)
return( PSA_ERROR_INVALID_ARGUMENT );
@@ -1696,7 +1696,7 @@
if ( lifetime != PSA_KEY_LIFETIME_VOLATILE )
return( PSA_ERROR_NOT_SUPPORTED );
-
+
slot->lifetime = lifetime;
return( PSA_SUCCESS );
diff --git a/tests/suites/test_suite_psa_crypto.function b/tests/suites/test_suite_psa_crypto.function
old mode 100755
new mode 100644
index 70e7574..b6ba9b4
--- a/tests/suites/test_suite_psa_crypto.function
+++ b/tests/suites/test_suite_psa_crypto.function
@@ -84,7 +84,7 @@
psa_key_policy_init( &policy );
- psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_EXPORT,
+ psa_key_policy_set_usage( &policy, PSA_KEY_USAGE_EXPORT,
PSA_ALG_VENDOR_FLAG );
TEST_ASSERT( psa_set_key_policy( slot, &policy ) == PSA_SUCCESS );
@@ -400,10 +400,9 @@
unsigned char key[32] = {0};
psa_key_policy_t policy_set = {0};
psa_key_policy_t policy_get = {0};
-
memset( key, 0x2a, sizeof( key ) );
-
+
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
psa_key_policy_init(& policy_set );
@@ -425,9 +424,6 @@
TEST_ASSERT( policy_get.usage == policy_set.usage );
TEST_ASSERT( policy_get.alg == policy_set.alg );
-
-
-
exit:
psa_destroy_key( key_slot );
mbedtls_psa_crypto_free( );
@@ -443,7 +439,7 @@
size_t signature_length = 0;
psa_key_policy_t policy = {0};
int actual_status = PSA_SUCCESS;
-
+
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
psa_key_policy_init( &policy );
@@ -458,11 +454,11 @@
TEST_ASSERT( keypair != NULL );
TEST_ASSERT( psa_import_key( key_slot, PSA_KEY_TYPE_RSA_KEYPAIR,
keypair, key_size ) == PSA_SUCCESS );
- actual_status = psa_asymmetric_sign( key_slot,
- ( psa_algorithm_t )alg_arg, NULL, 0, NULL, 0,
+ actual_status = psa_asymmetric_sign( key_slot,
+ ( psa_algorithm_t )alg_arg, NULL, 0, NULL, 0,
NULL, 0, &signature_length );
}
-
+
if( usage_arg & PSA_KEY_USAGE_SIGN )
{
keypair = unhexify_alloc( key_hex, &key_size );
@@ -489,21 +485,29 @@
unsigned char key[32] = {0};
psa_key_lifetime_t lifetime_set = (psa_key_lifetime_t) lifetime_arg;
psa_key_lifetime_t lifetime_get;
+
memset( key, 0x2a, sizeof( key ) );
+
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
- TEST_ASSERT( psa_set_key_lifetime( key_slot,
+
+ TEST_ASSERT( psa_set_key_lifetime( key_slot,
lifetime_set ) == PSA_SUCCESS );
+
TEST_ASSERT( psa_import_key( key_slot, key_type,
key, sizeof( key ) ) == PSA_SUCCESS );
- TEST_ASSERT( psa_get_key_lifetime( key_slot,
+
+ TEST_ASSERT( psa_get_key_lifetime( key_slot,
&lifetime_get ) == PSA_SUCCESS );
- TEST_ASSERT( lifetime_get == lifetime_set );
+
+ TEST_ASSERT( lifetime_get == lifetime_set );
+
exit:
psa_destroy_key( key_slot );
mbedtls_psa_crypto_free( );
}
/* END_CASE */
+
/* BEGIN_CASE */
void key_lifetime_set_fail( int key_slot_arg, int lifetime_arg, int expected_status_arg )
{
@@ -518,7 +522,7 @@
if( actual_status == PSA_SUCCESS )
actual_status = psa_set_key_lifetime( key_slot_arg, lifetime_set );
-
+
TEST_ASSERT( expected_status == actual_status );
exit:
@@ -654,7 +658,7 @@
TEST_ASSERT( psa_import_key( slot, key_type,
key_data, key_size ) == PSA_SUCCESS );
- //checked using encrypt/decrpyt because of non-optional random
+ //checked using encrypt/decrpyt because of non-optional random
// part of encryption process preventing using fixed vectors
TEST_ASSERT( psa_asymmetric_encrypt(slot, alg,
input_data,
@@ -670,7 +674,7 @@
NULL, 0,
output2,
output2_size,
- &output2_length) == PSA_SUCCESS );
+ &output2_length) == PSA_SUCCESS );
TEST_ASSERT( memcmp( input_data, output2, input_size ) == 0 );
exit:
@@ -711,7 +715,7 @@
TEST_ASSERT( input_data != NULL );
output = mbedtls_calloc( 1, output_size );
TEST_ASSERT( output != NULL );
-
+
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
@@ -763,7 +767,7 @@
TEST_ASSERT( expected_data != NULL );
output = mbedtls_calloc( 1, output_size );
TEST_ASSERT( output != NULL );
-
+
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
@@ -818,7 +822,7 @@
TEST_ASSERT( input_data != NULL );
output = mbedtls_calloc( 1, output_size );
TEST_ASSERT( output != NULL );
-
+
TEST_ASSERT( psa_crypto_init( ) == PSA_SUCCESS );
@@ -841,4 +845,4 @@
mbedtls_free( output);
mbedtls_psa_crypto_free( );
}
-/* END_CASE */
\ No newline at end of file
+/* END_CASE */