mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 11:55:41 +01:00
Initialize key bits to max size + 1 in psa_import_key
In psa_import_key, the key bits value was uninitialized before calling the secure element driver import function. There is a potential issue if the driver returns PSA_SUCCESS without setting the key bits. This shouldn't happen, but shouldn't be discounted either, so we initialize the key bits to an invalid issue.
This commit is contained in:
parent
74c932e596
commit
0892d0fbbf
@ -1835,7 +1835,9 @@ psa_status_t psa_import_key( const psa_key_attributes_t *attributes,
|
||||
if( driver != NULL )
|
||||
{
|
||||
const psa_drv_se_t *drv = psa_get_se_driver_methods( driver );
|
||||
size_t bits;
|
||||
/* The driver should set the number of key bits, however in
|
||||
* case it doesn't, we initialize bits to an invalid value. */
|
||||
size_t bits = PSA_MAX_KEY_BITS + 1;
|
||||
if( drv->key_management == NULL ||
|
||||
drv->key_management->p_import == NULL )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user