src/connectivity/bluetooth/core/bt-host/sm/bearer_unittest.cc
// Tests that we (as the responder) do not request to distribute identity
// information if the data is available but the initiator did not request it.
Tests that we (as the responder) do not request to distribute identity
information if the data is available but the initiator did not request it.
Tests that we ( as the responder ) do not request to distribute identity information if the data is available but the initiator did not request it .
TEST_F(SMP_BearerTest, FeatureExchangeResponderRespectsInitiatorForIdKey) {
  const auto kRequest = CreateStaticByteBuffer(
      0x01,  
      0x03,  
      0x00,  
      0x01,  
      0x10,  
      0x00,  
      0x00   
  );
  const auto kResponse = CreateStaticByteBuffer(
      0x02,  
      0x03,  
      0x00,  
      0x01,  
      0x10,  
      0x00,  
      0x00     // we shouldn't distribute the IdKey
  );
  NewBearer(hci::Connection::Role::kSlave);
  set_has_identity_info(true);
  EXPECT_TRUE(ReceiveAndExpect(kRequest, kResponse));
  EXPECT_TRUE(bearer()->pairing_started());
  EXPECT_EQ(1, feature_exchange_count());
  EXPECT_FALSE(features().initiator);
  EXPECT_FALSE(features().local_key_distribution);
  EXPECT_FALSE(features().remote_key_distribution);
}
TEST_F ( SMP_BearerTest , FeatureExchangeResponderRespectsInitiatorForIdKey ) { const auto kRequest = CreateStaticByteBuffer ( 0x01 , 0x03 , 0x00 , 0x01 , 0x10 , 0x00 , 0x00 ) ; const auto kResponse = CreateStaticByteBuffer ( 0x02 , 0x03 , 0x00 , 0x01 , 0x10 , 0x00 , 0x00 ) ; NewBearer ( hci :: Connection :: Role :: kSlave ) ; set_has_identity_info ( true ) ; EXPECT_TRUE ( ReceiveAndExpect ( kRequest , kResponse ) ) ; EXPECT_TRUE ( bearer ( ) -> pairing_started ( ) ) ; EXPECT_EQ ( 1 , feature_exchange_count ( ) ) ; EXPECT_FALSE ( features ( ) . initiator ) ; EXPECT_FALSE ( features ( ) . local_key_distribution ) ; EXPECT_FALSE ( features ( ) . remote_key_distribution ) ; }
Tests that we (as the responder) do not request to distribute identity
information if the data is available but the initiator did not request it.
Tests that we ( as the responder ) do not request to distribute identity information if the data is available but the initiator did not request it .
// clang-format off // code: Pairing Request // IO cap.: NoInputNoOutput // OOB: not present // AuthReq: no auth. request by default // encr. key size: 16 (default max) // initiator keys: none // responder keys: none // code: Pairing Response // IO cap.: NoInputNoOutput // OOB: not present // AuthReq: bonding, no MITM // encr. key size: 16 (default max) // initiator keys: none // responder keys: none  // we shouldn't distribute the IdKey // clang-format on