psa: Rename psa_load_rsa/ecp_representation

Rename psa_load_rsa/ecp_representation to
mbedtls_psa_rsa/ecp_load_representation
before to move them in their RSA/ECP
specific PSA crypto C modules.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron 2020-11-25 14:58:33 +01:00
parent 84cc99420c
commit 9085708371

View file

@ -570,10 +570,9 @@ static psa_status_t psa_check_rsa_key_byte_aligned(
* contents of the context and the context itself
* when done.
*/
static psa_status_t psa_load_rsa_representation( psa_key_type_t type,
const uint8_t *data,
size_t data_length,
mbedtls_rsa_context **p_rsa )
static psa_status_t mbedtls_psa_rsa_load_representation(
psa_key_type_t type, const uint8_t *data, size_t data_length,
mbedtls_rsa_context **p_rsa )
{
psa_status_t status;
mbedtls_pk_context ctx;
@ -710,10 +709,10 @@ static psa_status_t psa_import_rsa_key( psa_key_slot_t *slot,
mbedtls_rsa_context *rsa = NULL;
/* Parse input */
status = psa_load_rsa_representation( slot->attr.type,
data,
data_length,
&rsa );
status = mbedtls_psa_rsa_load_representation( slot->attr.type,
data,
data_length,
&rsa );
if( status != PSA_SUCCESS )
goto exit;
@ -773,10 +772,9 @@ exit:
* contents of the context and the context itself
* when done.
*/
static psa_status_t psa_load_ecp_representation( psa_key_type_t type,
const uint8_t *data,
size_t data_length,
mbedtls_ecp_keypair **p_ecp )
static psa_status_t mbedtls_psa_ecp_load_representation(
psa_key_type_t type, const uint8_t *data, size_t data_length,
mbedtls_ecp_keypair **p_ecp )
{
mbedtls_ecp_group_id grp_id = MBEDTLS_ECP_DP_NONE;
psa_status_t status;
@ -943,10 +941,10 @@ static psa_status_t psa_import_ecp_key( psa_key_slot_t *slot,
mbedtls_ecp_keypair *ecp = NULL;
/* Parse input */
status = psa_load_ecp_representation( slot->attr.type,
data,
data_length,
&ecp );
status = mbedtls_psa_ecp_load_representation( slot->attr.type,
data,
data_length,
&ecp );
if( status != PSA_SUCCESS )
goto exit;
@ -1642,10 +1640,11 @@ psa_status_t psa_get_key_attributes( mbedtls_svc_key_id_t key,
{
mbedtls_rsa_context *rsa = NULL;
status = psa_load_rsa_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
status = mbedtls_psa_rsa_load_representation(
slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
if( status != PSA_SUCCESS )
break;
@ -1774,11 +1773,10 @@ static psa_status_t psa_internal_export_key( const psa_key_slot_t *slot,
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_KEY_PAIR) || \
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_RSA_PUBLIC_KEY)
mbedtls_rsa_context *rsa = NULL;
status = psa_load_rsa_representation(
slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
status = mbedtls_psa_rsa_load_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
if( status != PSA_SUCCESS )
return( status );
@ -1803,11 +1801,10 @@ static psa_status_t psa_internal_export_key( const psa_key_slot_t *slot,
#if defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_KEY_PAIR) || \
defined(MBEDTLS_PSA_BUILTIN_KEY_TYPE_ECC_PUBLIC_KEY)
mbedtls_ecp_keypair *ecp = NULL;
status = psa_load_ecp_representation(
slot->attr.type,
slot->key.data,
slot->key.bytes,
&ecp );
status = mbedtls_psa_ecp_load_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&ecp );
if( status != PSA_SUCCESS )
return( status );
@ -2276,11 +2273,11 @@ static psa_status_t psa_validate_optional_attributes(
mbedtls_mpi actual, required;
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
psa_status_t status = psa_load_rsa_representation(
slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
psa_status_t status = mbedtls_psa_rsa_load_representation(
slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
if( status != PSA_SUCCESS )
return( status );
@ -3982,10 +3979,10 @@ psa_status_t psa_sign_hash( mbedtls_svc_key_id_t key,
{
mbedtls_rsa_context *rsa = NULL;
status = psa_load_rsa_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
status = mbedtls_psa_rsa_load_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
if( status != PSA_SUCCESS )
goto exit;
@ -4014,10 +4011,10 @@ psa_status_t psa_sign_hash( mbedtls_svc_key_id_t key,
)
{
mbedtls_ecp_keypair *ecp = NULL;
status = psa_load_ecp_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&ecp );
status = mbedtls_psa_ecp_load_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&ecp );
if( status != PSA_SUCCESS )
goto exit;
status = psa_ecdsa_sign( ecp,
@ -4092,10 +4089,10 @@ psa_status_t psa_verify_hash( mbedtls_svc_key_id_t key,
{
mbedtls_rsa_context *rsa = NULL;
status = psa_load_rsa_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
status = mbedtls_psa_rsa_load_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
if( status != PSA_SUCCESS )
goto exit;
@ -4117,10 +4114,10 @@ psa_status_t psa_verify_hash( mbedtls_svc_key_id_t key,
if( PSA_ALG_IS_ECDSA( alg ) )
{
mbedtls_ecp_keypair *ecp = NULL;
status = psa_load_ecp_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&ecp );
status = mbedtls_psa_ecp_load_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&ecp );
if( status != PSA_SUCCESS )
goto exit;
status = psa_ecdsa_verify( ecp,
@ -4201,10 +4198,10 @@ psa_status_t psa_asymmetric_encrypt( mbedtls_svc_key_id_t key,
if( PSA_KEY_TYPE_IS_RSA( slot->attr.type ) )
{
mbedtls_rsa_context *rsa = NULL;
status = psa_load_rsa_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
status = mbedtls_psa_rsa_load_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
if( status != PSA_SUCCESS )
goto rsa_exit;
@ -4307,10 +4304,10 @@ psa_status_t psa_asymmetric_decrypt( mbedtls_svc_key_id_t key,
if( slot->attr.type == PSA_KEY_TYPE_RSA_KEY_PAIR )
{
mbedtls_rsa_context *rsa = NULL;
status = psa_load_rsa_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
status = mbedtls_psa_rsa_load_representation( slot->attr.type,
slot->key.data,
slot->key.bytes,
&rsa );
if( status != PSA_SUCCESS )
goto exit;
@ -6172,10 +6169,11 @@ static psa_status_t psa_key_agreement_ecdh( const uint8_t *peer_key,
psa_ecc_family_t curve = mbedtls_ecc_group_to_psa( our_key->grp.id, &bits );
mbedtls_ecdh_init( &ecdh );
status = psa_load_ecp_representation( PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve),
peer_key,
peer_key_length,
&their_key );
status = mbedtls_psa_ecp_load_representation(
PSA_KEY_TYPE_ECC_PUBLIC_KEY(curve),
peer_key,
peer_key_length,
&their_key );
if( status != PSA_SUCCESS )
goto exit;
@ -6227,11 +6225,11 @@ static psa_status_t psa_key_agreement_raw_internal( psa_algorithm_t alg,
if( ! PSA_KEY_TYPE_IS_ECC_KEY_PAIR( private_key->attr.type ) )
return( PSA_ERROR_INVALID_ARGUMENT );
mbedtls_ecp_keypair *ecp = NULL;
psa_status_t status = psa_load_ecp_representation(
private_key->attr.type,
private_key->key.data,
private_key->key.bytes,
&ecp );
psa_status_t status = mbedtls_psa_ecp_load_representation(
private_key->attr.type,
private_key->key.data,
private_key->key.bytes,
&ecp );
if( status != PSA_SUCCESS )
return( status );
status = psa_key_agreement_ecdh( peer_key, peer_key_length,