nRF Connect SDK API 0.1.0
Loading...
Searching...
No Matches
bl_storage.h File Reference
#include <string.h>
#include <zephyr/types.h>
#include <drivers/nrfx_common.h>
#include <nrfx_nvmc.h>
#include <errno.h>
#include <pm_config.h>

Go to the source code of this file.

Data Structures

struct  life_cycle_state_data
 
struct  bl_storage_data
 

Macros

#define EHASHFF   113 /* A hash contains too many 0xFs. */
 
#define EREADLCS   114 /* LCS field of OTP is in an invalid state */
 
#define EINVALIDLCS   115 /* Invalid LCS*/
 
#define SB_PUBLIC_KEY_HASH_LEN   16
 
#define BL_MONOTONIC_COUNTERS_DESC_NSIB   0x1
 
#define BL_MONOTONIC_COUNTERS_DESC_MCUBOOT_ID0   0x2
 
#define BL_STORAGE   ((const volatile struct bl_storage_data *)(PM_PROVISION_ADDRESS))
 
#define BL_STORAGE_IMPLEMENTATION_ID_SIZE   32
 
#define STATE_ENTERED   0x0000
 
#define STATE_NOT_ENTERED   0xFFFF
 

Enumerations

enum  lcs {
  BL_STORAGE_LCS_UNKNOWN = 0 , BL_STORAGE_LCS_ASSEMBLY = 1 , BL_STORAGE_LCS_PROVISIONING = 2 , BL_STORAGE_LCS_SECURED = 3 ,
  BL_STORAGE_LCS_DECOMMISSIONED = 4
}
 The PSA life cycle states a device can be in. More...
 

Functions

uint32_t s0_address_read (void)
 Function for reading address of slot 0.
 
uint32_t s1_address_read (void)
 Function for reading address of slot 1.
 
uint32_t num_public_keys_read (void)
 Function for reading number of public key data slots.
 
int verify_public_keys (void)
 Function for reading number of public key data slots.
 
int public_key_data_read (uint32_t key_idx, uint8_t *p_buf)
 Function for reading public key hashes.
 
void invalidate_public_key (uint32_t key_idx)
 Function for invalidating a public key.
 
int num_monotonic_counter_slots (uint16_t counter_desc, uint16_t *counter_slots)
 Get the number of monotonic counter slots.
 
int get_monotonic_counter (uint16_t counter_desc, uint16_t *counter_value)
 Get the current HW monotonic counter.
 
int set_monotonic_counter (uint16_t counter_desc, uint16_t new_counter)
 Set the current HW monotonic counter.
 
void otp_copy32 (uint8_t *restrict dst, uint32_t volatile *restrict src, size_t size)
 
void read_implementation_id_from_otp (uint8_t *buf)
 
int read_life_cycle_state (enum lcs *lcs)
 Read the current life cycle state the device is in from OTP,.
 
int update_life_cycle_state (enum lcs next_lcs)
 Update the life cycle state in OTP.