psa: driver wrapper: Rename and export get_key_buffer_size

Rename and export get_key_buffer_size to be able to call
it from psa_crypto.c to compute the size of buffers to
contain keys generated by an opaque driver without
storage.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2020-12-05 19:15:23 +01:00
parent 31216284e1
commit 9df74beea7
2 changed files with 9 additions and 4 deletions

View File

@ -238,7 +238,6 @@ psa_status_t psa_driver_wrapper_verify_hash( psa_key_slot_t *slot,
#endif /* PSA_CRYPTO_DRIVER_PRESENT */ #endif /* PSA_CRYPTO_DRIVER_PRESENT */
} }
#if defined(PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT)
/** Get the key buffer size for the key material of a generated key in the /** Get the key buffer size for the key material of a generated key in the
* case of an opaque driver without storage. * case of an opaque driver without storage.
* *
@ -254,7 +253,7 @@ psa_status_t psa_driver_wrapper_verify_hash( psa_key_slot_t *slot,
* The type and/or the size in bits of the key or the combination of * The type and/or the size in bits of the key or the combination of
* the two is not supported. * the two is not supported.
*/ */
static psa_status_t get_key_buffer_size( psa_status_t psa_driver_wrapper_get_key_buffer_size(
const psa_key_attributes_t *attributes, const psa_key_attributes_t *attributes,
size_t *key_buffer_size ) size_t *key_buffer_size )
{ {
@ -301,10 +300,11 @@ static psa_status_t get_key_buffer_size(
#endif /* PSA_CRYPTO_DRIVER_TEST */ #endif /* PSA_CRYPTO_DRIVER_TEST */
default: default:
(void)key_type;
(void)key_bits;
return( PSA_ERROR_NOT_SUPPORTED ); return( PSA_ERROR_NOT_SUPPORTED );
} }
} }
#endif /* PSA_CRYPTO_ACCELERATOR_DRIVER_PRESENT */
psa_status_t psa_driver_wrapper_generate_key( const psa_key_attributes_t *attributes, psa_status_t psa_driver_wrapper_generate_key( const psa_key_attributes_t *attributes,
psa_key_slot_t *slot ) psa_key_slot_t *slot )
@ -350,7 +350,8 @@ psa_status_t psa_driver_wrapper_generate_key( const psa_key_attributes_t *attrib
} }
else else
{ {
status = get_key_buffer_size( attributes, &export_size ); status = psa_driver_wrapper_get_key_buffer_size( attributes,
&export_size );
if( status != PSA_SUCCESS ) if( status != PSA_SUCCESS )
return( status ); return( status );
} }

View File

@ -63,6 +63,10 @@ psa_status_t psa_driver_wrapper_export_public_key(
const uint8_t *key_buffer, size_t key_buffer_size, const uint8_t *key_buffer, size_t key_buffer_size,
uint8_t *data, size_t data_size, size_t *data_length ); uint8_t *data, size_t data_size, size_t *data_length );
psa_status_t psa_driver_wrapper_get_key_buffer_size(
const psa_key_attributes_t *attributes,
size_t *key_buffer_size );
psa_status_t psa_driver_wrapper_generate_key( psa_status_t psa_driver_wrapper_generate_key(
const psa_key_attributes_t *attributes, const psa_key_attributes_t *attributes,
psa_key_slot_t *slot ); psa_key_slot_t *slot );