From 79b2612de500afb68b070e57dfe0eb6e105c5f39 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Thu, 6 May 2021 14:40:57 +0200 Subject: [PATCH] sm: derive BR/EDR key using peer address if address type is public in initiator role --- src/ble/sm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ble/sm.c b/src/ble/sm.c index 546e04c69..ff053d4bd 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -3136,8 +3136,8 @@ static bool sm_ctkd_from_le(sm_connection_t *sm_connection) { // - bonding needs to be enabled: bool bonding_enabled = (sm_pairing_packet_get_auth_req(setup->sm_m_preq) & sm_pairing_packet_get_auth_req(setup->sm_s_pres) & SM_AUTHREQ_BONDING ) != 0u; if (!bonding_enabled) return false; - // - need identity address - bool have_identity_address_info = ((setup->sm_key_distribution_received_set & SM_KEYDIST_FLAG_IDENTITY_ADDRESS_INFORMATION) != 0); + // - need identity address / public addr + bool have_identity_address_info = ((setup->sm_key_distribution_received_set & SM_KEYDIST_FLAG_IDENTITY_ADDRESS_INFORMATION) != 0) || (setup->sm_peer_addr_type == 0); if (!have_identity_address_info) return false; // - there is no stored BR/EDR link key or the derived key has at least the same level of authentication (bail if stored key has higher authentication) // this requirement is motivated by BLURtooth paper. The paper recommends to not overwrite keys at all.