mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Merge pull request #108 from gilles-peskine-arm/psa-copy_key-policy
Add policy usage flag to copy a key
This commit is contained in:
@ -1347,6 +1347,7 @@ static psa_status_t psa_set_key_policy_internal(
|
||||
const psa_key_policy_t *policy )
|
||||
{
|
||||
if( ( policy->usage & ~( PSA_KEY_USAGE_EXPORT |
|
||||
PSA_KEY_USAGE_COPY |
|
||||
PSA_KEY_USAGE_ENCRYPT |
|
||||
PSA_KEY_USAGE_DECRYPT |
|
||||
PSA_KEY_USAGE_SIGN |
|
||||
@ -1598,7 +1599,8 @@ psa_status_t psa_copy_key_to_handle(psa_key_handle_t source_handle,
|
||||
psa_key_slot_t *target_slot = NULL;
|
||||
psa_key_policy_t new_policy;
|
||||
psa_status_t status;
|
||||
status = psa_get_key_from_slot( source_handle, &source_slot, 0, 0 );
|
||||
status = psa_get_key_from_slot( source_handle, &source_slot,
|
||||
PSA_KEY_USAGE_COPY, 0 );
|
||||
if( status != PSA_SUCCESS )
|
||||
return( status );
|
||||
status = psa_get_empty_key_slot( target_handle, &target_slot );
|
||||
@ -1633,7 +1635,8 @@ psa_status_t psa_copy_key( psa_key_handle_t source_handle,
|
||||
psa_key_slot_t *target_slot = NULL;
|
||||
psa_key_attributes_t actual_attributes = *specified_attributes;
|
||||
|
||||
status = psa_get_key_from_slot( source_handle, &source_slot, 0, 0 );
|
||||
status = psa_get_key_from_slot( source_handle, &source_slot,
|
||||
PSA_KEY_USAGE_COPY, 0 );
|
||||
if( status != PSA_SUCCESS )
|
||||
goto exit;
|
||||
|
||||
|
Reference in New Issue
Block a user