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

Commit 7b3dd6e5 authored by Myles Watson's avatar Myles Watson
Browse files

Allow unused address fields in PrivacyPolicy

Bug: 145832107
Tag: #gd-refactor
Test: cert/run --host
Change-Id: Id7df889ab2f2cd2877e9cc9bd1b752e6071af899
parent 45f79347
Loading
Loading
Loading
Loading
+11 −4
Original line number Diff line number Diff line
@@ -49,14 +49,21 @@ class LeInitiatorAddressFacadeService : public LeInitiatorAddressFacade::Service

  ::grpc::Status SetPrivacyPolicyForInitiatorAddress(
      ::grpc::ServerContext* context, const PrivacyPolicy* request, ::google::protobuf::Empty* writer) override {
    Address address;
    ASSERT(Address::FromString(request->address_with_type().address().address(), address));
    Address address = Address::kEmpty;
    LeAddressManager::AddressPolicy address_policy =
        static_cast<LeAddressManager::AddressPolicy>(request->address_policy());
    if (address_policy == LeAddressManager::AddressPolicy::USE_STATIC_ADDRESS) {
      ASSERT(Address::FromString(request->address_with_type().address().address(), address));
    }
    AddressWithType address_with_type(address, static_cast<AddressType>(request->address_with_type().type()));
    std::vector<uint8_t> irk_data(request->rotation_irk().begin(), request->rotation_irk().end());
    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());
    } 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(