psa: Use application key ID where necessary
Avoid compiler errors when MBEDTLS_PSA_CRYPTO_KEY_FILE_ID_ENCODES_OWNER is set by using the application ID type. [Error] psa_crypto_slot_management.c@175,9: used type 'psa_key_id_t' (aka 'psa_key_file_id_t') where arithmetic or pointer type is required
This commit is contained in:
parent
e3cdf284b2
commit
6fa62a5b8f
@ -251,9 +251,9 @@ typedef struct mbedtls_psa_stats_s
|
||||
/** Number of slots that are not used for anything. */
|
||||
size_t empty_slots;
|
||||
/** Largest key id value among open keys in internal persistent storage. */
|
||||
psa_key_id_t max_open_internal_key_id;
|
||||
psa_app_key_id_t max_open_internal_key_id;
|
||||
/** Largest key id value among open keys in secure elements. */
|
||||
psa_key_id_t max_open_external_key_id;
|
||||
psa_app_key_id_t max_open_external_key_id;
|
||||
} mbedtls_psa_stats_t;
|
||||
|
||||
/** \brief Get statistics about
|
||||
|
@ -1503,16 +1503,16 @@
|
||||
|
||||
/** The minimum value for a key identifier chosen by the application.
|
||||
*/
|
||||
#define PSA_KEY_ID_USER_MIN ((psa_key_id_t)0x00000001)
|
||||
#define PSA_KEY_ID_USER_MIN ((psa_app_key_id_t)0x00000001)
|
||||
/** The maximum value for a key identifier chosen by the application.
|
||||
*/
|
||||
#define PSA_KEY_ID_USER_MAX ((psa_key_id_t)0x3fffffff)
|
||||
#define PSA_KEY_ID_USER_MAX ((psa_app_key_id_t)0x3fffffff)
|
||||
/** The minimum value for a key identifier chosen by the implementation.
|
||||
*/
|
||||
#define PSA_KEY_ID_VENDOR_MIN ((psa_key_id_t)0x40000000)
|
||||
#define PSA_KEY_ID_VENDOR_MIN ((psa_app_key_id_t)0x40000000)
|
||||
/** The maximum value for a key identifier chosen by the implementation.
|
||||
*/
|
||||
#define PSA_KEY_ID_VENDOR_MAX ((psa_key_id_t)0x7fffffff)
|
||||
#define PSA_KEY_ID_VENDOR_MAX ((psa_app_key_id_t)0x7fffffff)
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
@ -278,15 +278,17 @@ void mbedtls_psa_get_stats( mbedtls_psa_stats_t *stats )
|
||||
++stats->volatile_slots;
|
||||
else if( slot->attr.lifetime == PSA_KEY_LIFETIME_PERSISTENT )
|
||||
{
|
||||
psa_app_key_id_t id = PSA_KEY_FILE_GET_KEY_ID(slot->attr.id);
|
||||
++stats->persistent_slots;
|
||||
if( slot->attr.id > stats->max_open_internal_key_id )
|
||||
stats->max_open_internal_key_id = slot->attr.id;
|
||||
if( id > stats->max_open_internal_key_id )
|
||||
stats->max_open_internal_key_id = id;
|
||||
}
|
||||
else
|
||||
{
|
||||
psa_app_key_id_t id = PSA_KEY_FILE_GET_KEY_ID(slot->attr.id);
|
||||
++stats->external_slots;
|
||||
if( slot->attr.id > stats->max_open_external_key_id )
|
||||
stats->max_open_external_key_id = slot->attr.id;
|
||||
if( id > stats->max_open_external_key_id )
|
||||
stats->max_open_external_key_id = id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user