Bluetooth: SMP: Add option to treat debug keys normally during debugging
Allow SMP debug keys to behave in the same way as normal keys, in order to debug with encryption and Bluetooth sniffer the exact way it behaves when not using debug keys. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
fdf0af3b5a
commit
a378498fdc
2 changed files with 11 additions and 2 deletions
|
@ -305,6 +305,13 @@ config BT_BONDABLE
|
|||
Bonding flag in AuthReq of SMP Pairing Request/Response will be set
|
||||
indicating the support for this mode.
|
||||
|
||||
config BT_STORE_DEBUG_KEYS
|
||||
bool "Store Debug Mode bonds"
|
||||
help
|
||||
This option enables support for storing bonds where either of devices
|
||||
has the Security Manager in Debug mode. This option should
|
||||
only be enabled for debugging and should never be used in production.
|
||||
|
||||
config BT_SMP_ENFORCE_MITM
|
||||
bool "Enforce MITM protection"
|
||||
default y
|
||||
|
|
|
@ -1540,7 +1540,8 @@ static void smp_pairing_complete(struct bt_smp *smp, u8_t status)
|
|||
* TODO should we allow this if BR/EDR is already connected?
|
||||
*/
|
||||
if (atomic_test_bit(smp->flags, SMP_FLAG_DERIVE_LK) &&
|
||||
!atomic_test_bit(smp->flags, SMP_FLAG_SC_DEBUG_KEY)) {
|
||||
(!atomic_test_bit(smp->flags, SMP_FLAG_SC_DEBUG_KEY) ||
|
||||
IS_ENABLED(CONFIG_BT_STORE_DEBUG_KEYS))) {
|
||||
sc_derive_link_key(smp);
|
||||
}
|
||||
#endif /* CONFIG_BT_BREDR */
|
||||
|
@ -3795,7 +3796,8 @@ static void bt_smp_disconnected(struct bt_l2cap_chan *chan)
|
|||
* If debug keys were used for pairing remove them.
|
||||
* No keys indicate no bonding so free keys storage.
|
||||
*/
|
||||
if (!keys->keys || (keys->flags & BT_KEYS_DEBUG)) {
|
||||
if (!keys->keys || (!IS_ENABLED(CONFIG_BT_STORE_DEBUG_KEYS) &&
|
||||
(keys->flags & BT_KEYS_DEBUG))) {
|
||||
bt_keys_clear(keys);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue