nrfx 4.5.0
Loading...
Searching...
No Matches
KMU driver

Key Management Unit (KMU) peripheral driver. More...

Topics

 KMU peripheral driver configuration
 

Data Structures

struct  nrfx_kmu_key_slot_metadata_t
 KMU metadata struct type. More...
 
struct  nrfx_kmu_key_slot_data_t
 Key slot data structure. More...
 

Macros

#define KEY_SLOT_WORDS_COUNT   ((KMU_KEYSLOTBITS) / 32)
 Macro for calculating how many 32-bit words can be placed in one key slot.
 

Typedefs

typedef void(* nrfx_kmu_event_handler_t) (nrf_kmu_event_t event_type)
 KMU driver event handler type.
 

Enumerations

enum  nrfx_kmu_rpolicy_t {
  NRFX_KMU_RPOLICY_LOCKED = KMU_TASKS_REVOKE_POLICY_Locked ,
  NRFX_KMU_RPOLICY_ROTATING = KMU_TASKS_REVOKE_POLICY_Rotating ,
  NRFX_KMU_RPOLICY_REVOKED = KMU_TASKS_REVOKE_POLICY_Revoked
}
 KMU revoke policy type. More...
 

Functions

int nrfx_kmu_init (nrfx_kmu_event_handler_t *handler)
 Function for initializing KMU driver.
 
void nrfx_kmu_uninit (void)
 Function for uninitializing KMU driver.
 
int nrfx_kmu_key_slot_provision (nrfx_kmu_key_slot_data_t const *p_key_slot_data, uint32_t slot_id)
 Function for provisioning data to given key slot in KMU.
 
int nrfx_kmu_key_slots_push (uint32_t slot_id, uint32_t num_slots)
 Function for pushing num_slots consecutive key slots from KMU to address specified in keyslot_dest field in nrfx_kmu_key_slot_data_t at provisioning.
 
int nrfx_kmu_key_slots_push_block (uint32_t slot_id, uint32_t num_slots)
 Function for blocking num_slots consecutive key slots from being pushed.
 
int nrfx_kmu_key_slots_block (uint32_t slot_id, uint32_t num_slots)
 Function for blocking num_slots consecutive key slots from being pushed or revoked.
 
int nrfx_kmu_key_slots_revoke (uint32_t slot_id, uint32_t num_slots)
 Function for revoking num_slots consecutive key slots.
 
int nrfx_kmu_key_slot_metadata_read (uint32_t slot_id, nrfx_kmu_key_slot_metadata_t *p_metadata)
 Function for reading metadata from a key slot.
 
int nrfx_kmu_key_slots_empty_check (uint32_t slot_id, uint32_t num_slots, bool *p_is_empty)
 Function for checking if given num_slots consecutive key slots can be written to.
 
int nrfx_kmu_key_slots_revoked_check (uint32_t slot_id, uint32_t num_slots, bool *p_is_revoked)
 Function for checking if given num_slots consecutive key slots are revoked.
 
int nrfx_kmu_next_available_key_slots_find (uint32_t num_slots)
 Function for finding first num_slots consecutive available key slots.
 

Detailed Description

Key Management Unit (KMU) peripheral driver.

Typedef Documentation

◆ nrfx_kmu_event_handler_t

typedef void(* nrfx_kmu_event_handler_t) (nrf_kmu_event_t event_type)

KMU driver event handler type.

Parameters
[in]event_typeKMU event.

Enumeration Type Documentation

◆ nrfx_kmu_rpolicy_t

KMU revoke policy type.

Enumerator
NRFX_KMU_RPOLICY_LOCKED 

Locked revoke policy.

NRFX_KMU_RPOLICY_ROTATING 

Rotating revoke policy.

NRFX_KMU_RPOLICY_REVOKED 

Revoked revoke policy.

Function Documentation

◆ nrfx_kmu_init()

int nrfx_kmu_init ( nrfx_kmu_event_handler_t * handler)

Function for initializing KMU driver.

Parameters
[in]handlerEvent handler. Used only if KMU interrupts are present on a device (can be checked with NRF_KMU_HAS_INTEN)
Return values
0Initialization successful.
-EALREADYThe driver is already initialized.

◆ nrfx_kmu_key_slot_metadata_read()

int nrfx_kmu_key_slot_metadata_read ( uint32_t slot_id,
nrfx_kmu_key_slot_metadata_t * p_metadata )

Function for reading metadata from a key slot.

Parameters
[in]slot_idID of a slot to use.
[out]p_metadataPointer to a metadata structure to be filled.
Return values
0Metadata was read.
-EACCESThe key slot is revoked.
-EFAULTThe key slot is empty.
-EAGAINKMU is currently busy with the previous operation.
-ETIMEDOUTTimeout occured when waiting for result event.

◆ nrfx_kmu_key_slot_provision()

int nrfx_kmu_key_slot_provision ( nrfx_kmu_key_slot_data_t const * p_key_slot_data,
uint32_t slot_id )

Function for provisioning data to given key slot in KMU.

Note
Requires enabled writing to non-volatile memory.
Parameters
[in]p_key_slot_dataPointer to the key slot data structure.
[in]slot_idID of a slot to use.
Return values
0Provisioning was successful.
-EAGAINKMU is currently busy with the previous operation.
-EFAULTAn error occured when provisioning the key.
-ETIMEDOUTTimeout occured when waiting for result event.

◆ nrfx_kmu_key_slots_block()

int nrfx_kmu_key_slots_block ( uint32_t slot_id,
uint32_t num_slots )

Function for blocking num_slots consecutive key slots from being pushed or revoked.

Parameters
[in]slot_idID of a slot to use.
[in]num_slotsNumber of consecutive keys slots to block.
Return values
0Blocking was successful.
-EAGAINKMU is currently busy with the previous operation. Can also happen after blocking only a part of the given keys.
-EFAULTAn error occured when blocking the key slot.
-ETIMEDOUTTimeout occured when waiting for result event.

◆ nrfx_kmu_key_slots_empty_check()

int nrfx_kmu_key_slots_empty_check ( uint32_t slot_id,
uint32_t num_slots,
bool * p_is_empty )

Function for checking if given num_slots consecutive key slots can be written to.

Parameters
[in]slot_idID of a slot to check.
[in]num_slotsNumber of consecutive keys slots to check.
[out]p_is_emptyPointer to a variable determining if num_slots consecutive key slots are empty. If at least one of the num_slots key slots is occupied or revoked (non-rotating policy), p_is_empty is equal to false.
Return values
0Metadata was read.
-EAGAINKMU is currently busy with the previous operation.
-ETIMEDOUTTimeout occured when waiting for result event.

◆ nrfx_kmu_key_slots_push()

int nrfx_kmu_key_slots_push ( uint32_t slot_id,
uint32_t num_slots )

Function for pushing num_slots consecutive key slots from KMU to address specified in keyslot_dest field in nrfx_kmu_key_slot_data_t at provisioning.

Parameters
[in]slot_idID of a slot to use.
[in]num_slotsNumber of consecutive keys slots to push.
Return values
0Pushing was successful.
-EACCESThe key slot is revoked.
-EAGAINKMU is currently busy with the previous operation. Can also happen after pushing only a part of the given keys.
-EFAULTAn error occured when pushing the key slot (slot is bloked or empty).
-ETIMEDOUTTimeout occured when waiting for result event.

◆ nrfx_kmu_key_slots_push_block()

int nrfx_kmu_key_slots_push_block ( uint32_t slot_id,
uint32_t num_slots )

Function for blocking num_slots consecutive key slots from being pushed.

Parameters
[in]slot_idID of a slot to use.
[in]num_slotsNumber of consecutive keys slots to block from being pushed.
Return values
0Blocking was successful.
-EAGAINKMU is currently busy with the previous operation. Can also happen after blocking only a part of the given keys.
-EFAULTAn error occured when push blocking the key slot.
-ETIMEDOUTTimeout occured when waiting for result event.

◆ nrfx_kmu_key_slots_revoke()

int nrfx_kmu_key_slots_revoke ( uint32_t slot_id,
uint32_t num_slots )

Function for revoking num_slots consecutive key slots.

Parameters
[in]slot_idID of a slot to use.
[in]num_slotsNumber of consecutive keys slots to revoke.
Return values
0Revoking was successful.
-EAGAINKMU is currently busy with the previous operation. Can also happen after revoking only a part of the given keys.
-EFAULTAn error occured when revoking the key slot.
-ETIMEDOUTTimeout occured when waiting for result event.

◆ nrfx_kmu_key_slots_revoked_check()

int nrfx_kmu_key_slots_revoked_check ( uint32_t slot_id,
uint32_t num_slots,
bool * p_is_revoked )

Function for checking if given num_slots consecutive key slots are revoked.

Parameters
[in]slot_idID of a slot to check.
[in]num_slotsNumber of consecutive keys slots to check.
[out]p_is_revokedPointer to a variable determining if num_slots consecutive key slots are revoked. If at least one of the num_slots key slots is empty or occupied, p_is_empty is equal to false.
Return values
0Metadata was read.
-EAGAINKMU is currently busy with the previous operation.
-ETIMEDOUTTimeout occured when waiting for result event.

◆ nrfx_kmu_next_available_key_slots_find()

int nrfx_kmu_next_available_key_slots_find ( uint32_t num_slots)

Function for finding first num_slots consecutive available key slots.

Parameters
[in]num_slotsNumber of consecutive key slots to find.
Return values
non-negativeSlot ID of the first available key slot.
-ENOMEMnum_slots consecutive empty key slots were not found, too many occupied and/or revoked key slots.