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

Commit 4a31a3bf authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Call the 'ForTest' function to pass proper IRK"

parents 710e42be bab1c813
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -58,18 +58,20 @@ class LeInitiatorAddressFacadeService : public LeInitiatorAddressFacade::Service
      ASSERT(Address::FromString(request->address_with_type().address().address(), address));
    }
    AddressWithType address_with_type(address, static_cast<AddressType>(request->address_with_type().type()));
    auto minimum_rotation_time = std::chrono::milliseconds(request->minimum_rotation_time());
    auto maximum_rotation_time = std::chrono::milliseconds(request->maximum_rotation_time());
    crypto_toolbox::Octet16 irk = {};
    auto request_irk_length = request->rotation_irk().end() - request->rotation_irk().begin();
    if (request_irk_length == crypto_toolbox::OCTET16_LEN) {
      std::vector<uint8_t> irk_data(request->rotation_irk().begin(), request->rotation_irk().end());
      std::copy_n(irk_data.begin(), crypto_toolbox::OCTET16_LEN, irk.begin());
      acl_manager_->SetPrivacyPolicyForInitiatorAddressForTest(
          address_policy, address_with_type, irk, minimum_rotation_time, maximum_rotation_time);
    } else {
      ASSERT(request_irk_length == 0);
    }
    auto minimum_rotation_time = std::chrono::milliseconds(request->minimum_rotation_time());
    auto maximum_rotation_time = std::chrono::milliseconds(request->maximum_rotation_time());
      acl_manager_->SetPrivacyPolicyForInitiatorAddress(
          address_policy, address_with_type, minimum_rotation_time, maximum_rotation_time);
      ASSERT(request_irk_length == 0);
    }
    return ::grpc::Status::OK;
  }