|
PebbleOS v4.47.0-372-gac5760587
|
The bonding and root keys the recovery firmware (PRF) and the normal firmware share. More...
Modules | |
| PRF store layout | |
| On-flash layout of the PRF store entries. | |
Functions | |
| bool | pbl_bt_prf_store_get_root_key (enum pbl_bt_sm_root_key_type key_type, struct pbl_bt_sm_key *key_out) |
| Get a BLE root key. | |
| void | pbl_bt_prf_store_set_root_keys (struct pbl_bt_sm_key *keys_in) |
| Store the BLE root keys. | |
| bool | pbl_bt_prf_store_get_pairing (struct pbl_bt_sm_pairing_info *pairing_info_out, char *name_out, uint8_t *flags) |
| Get the BLE pairing. | |
| void | pbl_bt_prf_store_set_pairing (const struct pbl_bt_sm_pairing_info *pairing_info, const char *name, uint8_t flags) |
| Store the BLE pairing, replacing the previous one. | |
| void | pbl_bt_prf_store_set_pairing_name (const char *name) |
| Store the device name of the BLE pairing. | |
| void | pbl_bt_prf_store_erase_pairing (void) |
| Erase the BLE pairing and its device name. | |
| void | pbl_bt_prf_store_wipe (void) |
| Erase everything, for a factory reset. | |
| void | pbl_bt_prf_store_init (void) |
| Initialize the PRF store. | |
The bonding and root keys the recovery firmware (PRF) and the normal firmware share.
Kept in a flash partition of its own, as a rolling list of 256-byte entries (see PRF store layout) that recovery firmware already in the field reads: the layout cannot change. Each field carries its own CRC; changing a field invalidates the current entry and rewrites the data into the next one, and the partition is erased once it fills up. All functions are serialized by a mutex.
Implemented by the NimBLE store (NIMBLE_STORE_PRF), which can also persist in it (NIMBLE_STORE_BACKEND_PRF).
| void pbl_bt_prf_store_erase_pairing | ( | void | ) |
Erase the BLE pairing and its device name.
| bool pbl_bt_prf_store_get_pairing | ( | struct pbl_bt_sm_pairing_info * | pairing_info_out, |
| char * | name_out, | ||
| uint8_t * | flags | ||
| ) |
Get the BLE pairing.
Output parameters may be NULL and are only valid when true is returned.
| [out] | pairing_info_out | Pairing keys. |
| [out] | name_out | Buffer of PBL_BT_DEVICE_NAME_BUFFER_SIZE bytes for the remote device name, empty if none is stored. |
| [out] | flags | Pairing flags. |
| bool pbl_bt_prf_store_get_root_key | ( | enum pbl_bt_sm_root_key_type | key_type, |
| struct pbl_bt_sm_key * | key_out | ||
| ) |
Get a BLE root key.
| key_type | Encryption Root (ER) or Identity Root (IR) key. | |
| [out] | key_out | Key, may be NULL. |
| void pbl_bt_prf_store_init | ( | void | ) |
Initialize the PRF store.
Finds the valid entry, and erases the region, keeping that entry, when more than 75% of the region is used so that later writes are unlikely to block on an erase.
| void pbl_bt_prf_store_set_pairing | ( | const struct pbl_bt_sm_pairing_info * | pairing_info, |
| const char * | name, | ||
| uint8_t | flags | ||
| ) |
Store the BLE pairing, replacing the previous one.
Empty pairing info is ignored.
| pairing_info | Pairing keys. |
| name | Remote device name, or NULL to keep the stored name. |
| flags | Pairing flags. |
| void pbl_bt_prf_store_set_pairing_name | ( | const char * | name | ) |
Store the device name of the BLE pairing.
Does nothing without a pairing.
| name | Device name. |
| void pbl_bt_prf_store_set_root_keys | ( | struct pbl_bt_sm_key * | keys_in | ) |
Store the BLE root keys.
| keys_in | Array of PBL_BT_SM_ROOT_KEY_TYPE_NUM keys indexed by pbl_bt_sm_root_key_type, or NULL to store zeroed keys. |
| void pbl_bt_prf_store_wipe | ( | void | ) |
Erase everything, for a factory reset.