Skip to content

Commit 8c256f4

Browse files
degjorvaendre-nordic
authored andcommitted
nrf_security: cracen: Fix psa_export_key when exporting from kmu
psa_export_key would fail due to key not being populated. Add functions to populate key with attributes Remove special case for ecc which is not needed and did not work psa_export_key should now function for all supported key types Signed-off-by: Dag Erik Gjørvad <[email protected]>
1 parent f495e97 commit 8c256f4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

subsys/nrf_security/src/drivers/cracen/cracenpsa/src/key_management.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,10 +1348,11 @@ psa_status_t cracen_export_key(const psa_key_attributes_t *attributes, const uin
13481348
/* The keys will already be in the key buffer as they got loaded their by a previous
13491349
* call to cracen_get_builtin_key or cached in the memory.
13501350
*/
1351-
psa_ecc_family_t ecc_fam =
1352-
PSA_KEY_TYPE_ECC_GET_FAMILY(psa_get_key_type(attributes));
1351+
psa_key_type_t key_type = psa_get_key_type(attributes);
1352+
1353+
psa_ecc_family_t ecc_fam = PSA_KEY_TYPE_ECC_GET_FAMILY(key_type);
13531354
if (ecc_fam == PSA_ECC_FAMILY_TWISTED_EDWARDS ||
1354-
ecc_fam == PSA_ECC_FAMILY_SECP_R1) {
1355+
ecc_fam == PSA_ECC_FAMILY_SECP_R1 || key_type == PSA_KEY_TYPE_HMAC) {
13551356
memcpy(data, key_buffer, key_buffer_size);
13561357
*data_length = key_buffer_size;
13571358
return PSA_SUCCESS;

0 commit comments

Comments
 (0)