Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09322e4f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "[NRPA] Do not establish encryption when using NRPA"

parents a00065ba 0544c980
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@
#include "osi/include/allocator.h"
#include "osi/include/osi.h"
#include "stack/btm/btm_sec.h"
#include "stack/include/acl_api.h"
#include "types/bluetooth/uuid.h"
#include "types/bt_transport.h"
#include "types/raw_address.h"
@@ -76,6 +77,15 @@ static void btif_gatt_set_encryption_cb(UNUSED_ATTR const RawAddress& bd_addr,

void btif_gatt_check_encrypted_link(RawAddress bd_addr,
                                    tBT_TRANSPORT transport_link) {
  RawAddress raw_local_addr;
  tBLE_ADDR_TYPE local_addr_type;
  BTM_ReadConnectionAddr(bd_addr, raw_local_addr, &local_addr_type);
  tBLE_BD_ADDR local_addr{local_addr_type, raw_local_addr};
  if (!local_addr.IsPublic() && !local_addr.IsAddressResolvable()) {
    LOG_DEBUG("Not establishing encryption since address type is NRPA");
    return;
  }

  static const bool check_encrypted = bluetooth::os::GetSystemPropertyBool(
      "bluetooth.gatt.check_encrypted_link.enabled", true);
  if (!check_encrypted) {