mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-06-20 20:38:02 +00:00
Cosmetic improvements in SE driver tests
This commit is contained in:
parent
28f8f3068f
commit
89870eb123
|
@ -27,14 +27,14 @@ register_twice:3
|
||||||
Register SE driver: maximum number of drivers
|
Register SE driver: maximum number of drivers
|
||||||
register_max:
|
register_max:
|
||||||
|
|
||||||
Key creation smoke test (p_allocate allows all slots)
|
SE key import-export (p_allocate allows all slots)
|
||||||
key_creation_import_export:0:0
|
key_creation_import_export:0:0
|
||||||
|
|
||||||
Key creation smoke test (p_allocate allows 1 slot)
|
SE key import-export (p_allocate allows 1 slot)
|
||||||
key_creation_import_export:ARRAY_LENGTH( ram_slots ) - 1:0
|
key_creation_import_export:ARRAY_LENGTH( ram_slots ) - 1:0
|
||||||
|
|
||||||
Key creation smoke test, check after restart (slot 0)
|
SE key import-export, check after restart (slot 0)
|
||||||
key_creation_import_export:0:1
|
key_creation_import_export:0:1
|
||||||
|
|
||||||
Key creation smoke test, check after restart (slot 3)
|
SE key import-export, check after restart (slot 3)
|
||||||
key_creation_import_export:3:1
|
key_creation_import_export:3:1
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
#include "psa_crypto_se.h"
|
#include "psa_crypto_se.h"
|
||||||
#include "psa_crypto_storage.h"
|
#include "psa_crypto_storage.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
/* Test driver helpers */
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
/** The minimum valid lifetime value for a secure element driver. */
|
/** The minimum valid lifetime value for a secure element driver. */
|
||||||
#define MIN_DRIVER_LIFETIME 2
|
#define MIN_DRIVER_LIFETIME 2
|
||||||
|
|
||||||
|
@ -25,6 +31,12 @@
|
||||||
} \
|
} \
|
||||||
} while( 0 )
|
} while( 0 )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
/* RAM-based test driver */
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
#define RAM_MAX_KEY_SIZE 64
|
#define RAM_MAX_KEY_SIZE 64
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -69,11 +81,11 @@ static psa_status_t ram_import( psa_drv_se_context_t *context,
|
||||||
return( PSA_SUCCESS );
|
return( PSA_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t ram_export( psa_drv_se_context_t *context,
|
static psa_status_t ram_export( psa_drv_se_context_t *context,
|
||||||
psa_key_slot_number_t slot_number,
|
psa_key_slot_number_t slot_number,
|
||||||
uint8_t *p_data,
|
uint8_t *p_data,
|
||||||
size_t data_size,
|
size_t data_size,
|
||||||
size_t *p_data_length )
|
size_t *p_data_length )
|
||||||
{
|
{
|
||||||
size_t actual_size;
|
size_t actual_size;
|
||||||
(void) context;
|
(void) context;
|
||||||
|
@ -86,9 +98,9 @@ psa_status_t ram_export( psa_drv_se_context_t *context,
|
||||||
return( PSA_SUCCESS );
|
return( PSA_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t ram_destroy( psa_drv_se_context_t *context,
|
static psa_status_t ram_destroy( psa_drv_se_context_t *context,
|
||||||
void *persistent_data,
|
void *persistent_data,
|
||||||
psa_key_slot_number_t slot_number )
|
psa_key_slot_number_t slot_number )
|
||||||
{
|
{
|
||||||
ram_slot_usage_t *slot_usage = persistent_data;
|
ram_slot_usage_t *slot_usage = persistent_data;
|
||||||
DRIVER_ASSERT( context->persistent_data_size == sizeof( ram_slot_usage_t ) );
|
DRIVER_ASSERT( context->persistent_data_size == sizeof( ram_slot_usage_t ) );
|
||||||
|
@ -98,10 +110,10 @@ psa_status_t ram_destroy( psa_drv_se_context_t *context,
|
||||||
return( PSA_SUCCESS );
|
return( PSA_SUCCESS );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_status_t ram_allocate( psa_drv_se_context_t *context,
|
static psa_status_t ram_allocate( psa_drv_se_context_t *context,
|
||||||
void *persistent_data,
|
void *persistent_data,
|
||||||
const psa_key_attributes_t *attributes,
|
const psa_key_attributes_t *attributes,
|
||||||
psa_key_slot_number_t *slot_number )
|
psa_key_slot_number_t *slot_number )
|
||||||
{
|
{
|
||||||
ram_slot_usage_t *slot_usage = persistent_data;
|
ram_slot_usage_t *slot_usage = persistent_data;
|
||||||
(void) attributes;
|
(void) attributes;
|
||||||
|
@ -116,8 +128,14 @@ psa_status_t ram_allocate( psa_drv_se_context_t *context,
|
||||||
return( PSA_ERROR_INSUFFICIENT_STORAGE );
|
return( PSA_ERROR_INSUFFICIENT_STORAGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/****************************************************************/
|
||||||
|
/* Other test helper functions */
|
||||||
|
/****************************************************************/
|
||||||
|
|
||||||
#define MAX_KEY_ID_FOR_TEST 10
|
#define MAX_KEY_ID_FOR_TEST 10
|
||||||
void psa_purge_storage( void )
|
static void psa_purge_storage( void )
|
||||||
{
|
{
|
||||||
psa_key_id_t id;
|
psa_key_id_t id;
|
||||||
psa_key_lifetime_t lifetime;
|
psa_key_lifetime_t lifetime;
|
||||||
|
|
Loading…
Reference in a new issue