SE driver: report the bit size on key import
Add a parameter to the key import method of a secure element driver to
make it report the key size in bits. This is necessary (otherwise the
core has no idea what the bit-size is), and making import report it is
easier than adding a separate method (for other key creation methods,
this information is an input, not an output).
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index b3a6f8a..b2e863e 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -1711,8 +1711,8 @@
psa_get_se_driver_context( driver ),
slot->data.se.slot_number,
slot->lifetime, slot->type, slot->policy.alg, slot->policy.usage,
- data, data_length );
- /* TOnogrepDO: psa_check_key_slot_attributes? */
+ data, data_length,
+ &slot->data.se.bits );
}
else
#endif /* MBEDTLS_PSA_CRYPTO_SE_C */
@@ -1720,10 +1720,10 @@
status = psa_import_key_into_slot( slot, data, data_length );
if( status != PSA_SUCCESS )
goto exit;
- status = psa_check_key_slot_attributes( slot, attributes );
- if( status != PSA_SUCCESS )
- goto exit;
}
+ status = psa_check_key_slot_attributes( slot, attributes );
+ if( status != PSA_SUCCESS )
+ goto exit;
status = psa_finish_key_creation( slot, driver );
exit: