Skip to content

Commit af793a8

Browse files
committed
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.
1 parent df250ac commit af793a8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/psa_crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1835,7 +1835,7 @@ psa_status_t psa_import_key( const psa_key_attributes_t *attributes,
18351835
if( driver != NULL )
18361836
{
18371837
const psa_drv_se_t *drv = psa_get_se_driver_methods( driver );
1838-
size_t bits;
1838+
size_t bits = PSA_MAX_KEY_BITS + 1;
18391839
if( drv->key_management == NULL ||
18401840
drv->key_management->p_import == NULL )
18411841
{

0 commit comments

Comments
 (0)