Change code style
Signed-off-by: Xiaokang Qian <xiaokang.qian@arm.com>
This commit is contained in:
parent
b7cc2e2d3b
commit
cad99fa998
1 changed files with 37 additions and 42 deletions
|
@ -91,72 +91,67 @@ psa_status_t psa_driver_wrapper_export_public_key(
|
||||||
const psa_drv_se_t *drv;
|
const psa_drv_se_t *drv;
|
||||||
psa_drv_se_context_t *drv_context;
|
psa_drv_se_context_t *drv_context;
|
||||||
|
|
||||||
if( psa_get_se_driver( attributes->core.lifetime, &drv, &drv_context ) )
|
if (psa_get_se_driver(attributes->core.lifetime, &drv, &drv_context)) {
|
||||||
{
|
|
||||||
if ((drv->key_management == NULL) ||
|
if ((drv->key_management == NULL) ||
|
||||||
( drv->key_management->p_export_public == NULL ) )
|
(drv->key_management->p_export_public == NULL)) {
|
||||||
{
|
return PSA_ERROR_NOT_SUPPORTED;
|
||||||
return( PSA_ERROR_NOT_SUPPORTED );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return( drv->key_management->p_export_public(
|
return drv->key_management->p_export_public(
|
||||||
drv_context,
|
drv_context,
|
||||||
*((psa_key_slot_number_t *) key_buffer),
|
*((psa_key_slot_number_t *) key_buffer),
|
||||||
data, data_size, data_length ) );
|
data, data_size, data_length);
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
|
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
|
||||||
|
|
||||||
switch( location )
|
switch (location) {
|
||||||
{
|
|
||||||
case PSA_KEY_LOCATION_LOCAL_STORAGE:
|
case PSA_KEY_LOCATION_LOCAL_STORAGE:
|
||||||
/* Key is stored in the slot in export representation, so
|
/* Key is stored in the slot in export representation, so
|
||||||
* cycle through all known transparent accelerators */
|
* cycle through all known transparent accelerators */
|
||||||
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
||||||
|
|
||||||
#if (defined(PSA_CRYPTO_DRIVER_TEST))
|
#if (defined(PSA_CRYPTO_DRIVER_TEST))
|
||||||
status = mbedtls_test_transparent_export_public_key
|
status = mbedtls_test_transparent_export_public_key(
|
||||||
(attributes,
|
attributes,
|
||||||
key_buffer,
|
key_buffer,
|
||||||
key_buffer_size,
|
key_buffer_size,
|
||||||
data,
|
data,
|
||||||
data_size,
|
data_size,
|
||||||
data_length
|
data_length);
|
||||||
);
|
|
||||||
|
|
||||||
if( status != PSA_ERROR_NOT_SUPPORTED )
|
if (status != PSA_ERROR_NOT_SUPPORTED) {
|
||||||
return( status );
|
return status;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
|
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
|
||||||
/* Fell through, meaning no accelerator supports this operation */
|
/* Fell through, meaning no accelerator supports this operation */
|
||||||
return( psa_export_public_key_internal( attributes,
|
return psa_export_public_key_internal(attributes,
|
||||||
key_buffer,
|
key_buffer,
|
||||||
key_buffer_size,
|
key_buffer_size,
|
||||||
data,
|
data,
|
||||||
data_size,
|
data_size,
|
||||||
data_length ) );
|
data_length);
|
||||||
|
|
||||||
/* Add cases for opaque driver here */
|
/* Add cases for opaque driver here */
|
||||||
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
|
||||||
|
|
||||||
#if (defined(PSA_CRYPTO_DRIVER_TEST))
|
#if (defined(PSA_CRYPTO_DRIVER_TEST))
|
||||||
case 0x7fffff:
|
case 0x7fffff:
|
||||||
return( mbedtls_test_opaque_export_public_key
|
return mbedtls_test_opaque_export_public_key(attributes,
|
||||||
(attributes,
|
|
||||||
key_buffer,
|
key_buffer,
|
||||||
key_buffer_size,
|
key_buffer_size,
|
||||||
data,
|
data,
|
||||||
data_size,
|
data_size,
|
||||||
data_length
|
data_length);
|
||||||
));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
|
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
|
||||||
default:
|
default:
|
||||||
/* Key is declared with a lifetime not known to us */
|
/* Key is declared with a lifetime not known to us */
|
||||||
return( status );
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue