Skip to content

Commit 7674a4b

Browse files
pirunnordicjm
authored andcommitted
gazell: Clear host id and sys addr when erase pairing
The host id and system address should not be used after gzp_erase_pairing_data called. Set them to 0xff to make gzp device requesting host id and sys address. Signed-off-by: Bernard Lee <[email protected]> Signed-off-by: Pirun Lee <[email protected]>
1 parent adc00ee commit 7674a4b

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ Gazell
179179
* :kconfig:option:`CONFIG_GAZELL_PAIRING_USER_CONFIG_ENABLE` and :kconfig:option:`CONFIG_GAZELL_PAIRING_USER_CONFIG_FILE`.
180180
The options allow to use user-specific file as Gazell pairing configuration header to override the pairing configuration.
181181

182+
* Fixed:
183+
184+
* Clear system address and host id in RAM when :c:func:`gzp_erase_pairing_data` is called.
185+
182186
Enhanced ShockBurst (ESB)
183187
-------------------------
184188

subsys/gazell/gzp_device.c

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,25 @@ SETTINGS_STATIC_HANDLER_DEFINE(nrf_gzp_device, GZP_DEVICE_DB_NAME, NULL, setting
513513

514514
#endif
515515

516+
#ifdef CONFIG_GAZELL_PAIRING_CRYPT
517+
518+
static void gzp_clear_host_id(void)
519+
{
520+
memset(gzp_host_id, 0xff, GZP_HOST_ID_LENGTH);
521+
}
522+
523+
#endif
524+
525+
static void gzp_clear_sys_addr(void)
526+
{
527+
memset(gzp_system_address, 0xff, GZP_SYSTEM_ADDRESS_WIDTH);
528+
}
529+
516530
void gzp_init(void)
517531
{
518-
memset(gzp_system_address, 0xFF, sizeof(gzp_system_address));
532+
gzp_clear_sys_addr();
519533
#ifdef CONFIG_GAZELL_PAIRING_CRYPT
520-
memset(gzp_host_id, 0xFF, sizeof(gzp_host_id));
534+
gzp_clear_host_id();
521535
#endif
522536

523537
gzp_init_internal();
@@ -530,15 +544,18 @@ void gzp_init(void)
530544
(void)gzp_update_radio_params(gzp_system_address);
531545
}
532546

533-
534547
void gzp_erase_pairing_data(void)
535548
{
536549
#ifdef CONFIG_GAZELL_PAIRING_SETTINGS
537550
settings_delete(db_key_sys_addr);
538551
#ifdef CONFIG_GAZELL_PAIRING_CRYPT
539552
settings_delete(db_key_host_id);
540-
#endif
541-
#endif
553+
#endif /* CONFIG_GAZELL_PAIRING_CRYPT */
554+
#endif /* CONFIG_GAZELL_PAIRING_SETTINGS */
555+
gzp_clear_sys_addr();
556+
#ifdef CONFIG_GAZELL_PAIRING_CRYPT
557+
gzp_clear_host_id();
558+
#endif /* CONFIG_GAZELL_PAIRING_CRYPT */
542559
}
543560

544561
/* Set user callback context.

0 commit comments

Comments
 (0)