Loading system/gd/security/pairing/classic_pairing_handler.cc +47 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,37 @@ void ClassicPairingHandler::OnReceive(hci::IoCapabilityResponseView packet) { // Using local variable until device database pointer is ready remote_io_capability_ = packet.GetIoCapability(); remote_authentication_requirements_ = packet.GetAuthenticationRequirements(); remote_oob_present_ = packet.GetOobDataPresent(); switch (remote_authentication_requirements_) { case hci::AuthenticationRequirements::NO_BONDING: GetRecord()->SetIsEncryptionRequired(false); GetRecord()->SetRequiresMitmProtection(false); break; case hci::AuthenticationRequirements::NO_BONDING_MITM_PROTECTION: GetRecord()->SetIsEncryptionRequired(false); GetRecord()->SetRequiresMitmProtection(true); break; case hci::AuthenticationRequirements::DEDICATED_BONDING: GetRecord()->SetIsEncryptionRequired(true); GetRecord()->SetRequiresMitmProtection(false); break; case hci::AuthenticationRequirements::DEDICATED_BONDING_MITM_PROTECTION: GetRecord()->SetIsEncryptionRequired(true); GetRecord()->SetRequiresMitmProtection(true); break; case hci::AuthenticationRequirements::GENERAL_BONDING: GetRecord()->SetIsEncryptionRequired(true); GetRecord()->SetRequiresMitmProtection(false); break; case hci::AuthenticationRequirements::GENERAL_BONDING_MITM_PROTECTION: GetRecord()->SetIsEncryptionRequired(true); GetRecord()->SetRequiresMitmProtection(true); break; default: GetRecord()->SetRequiresMitmProtection(false); break; } } void ClassicPairingHandler::OnReceive(hci::SimplePairingCompleteView packet) { Loading Loading @@ -238,6 +269,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::DISPLAY_YES_NO: // NumericComparison, Initiator auto confirm, Responder display Loading @@ -245,12 +277,14 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); LOG_INFO("Numeric Comparison: A auto confirm"); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::KEYBOARD_ONLY: // PassKey Entry, Initiator display, Responder input NotifyUiDisplayPasskey(packet.GetNumericValue()); LOG_INFO("Passkey Entry: A display, B input"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::NO_INPUT_NO_OUTPUT: // NumericComparison, Both auto confirm Loading @@ -258,6 +292,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; } break; Loading @@ -268,24 +303,28 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { LOG_INFO("Numeric Comparison: A DisplayYesNo, B auto confirm"); NotifyUiDisplayYesNo(packet.GetNumericValue()); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::DISPLAY_YES_NO: // NumericComparison Both Display, Both confirm LOG_INFO("Numeric Comparison: A and B DisplayYesNo"); NotifyUiDisplayYesNo(packet.GetNumericValue()); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::KEYBOARD_ONLY: // PassKey Entry, Initiator display, Responder input NotifyUiDisplayPasskey(packet.GetNumericValue()); LOG_INFO("Passkey Entry: A display, B input"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::NO_INPUT_NO_OUTPUT: // NumericComparison, auto confirm Responder, Yes/No confirm Initiator. Don't show confirmation value NotifyUiDisplayYesNo(); LOG_INFO("Numeric Comparison: A DisplayYesNo, B auto confirm, no show value"); // Unauthenticated GetRecord()->SetAuthenticated(false); break; } break; Loading @@ -296,18 +335,21 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { NotifyUiDisplayPasskeyInput(); LOG_INFO("Passkey Entry: A input, B display"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::DISPLAY_YES_NO: // PassKey Entry, Responder display, Initiator input NotifyUiDisplayPasskeyInput(); LOG_INFO("Passkey Entry: A input, B display"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::KEYBOARD_ONLY: // PassKey Entry, both input NotifyUiDisplayPasskeyInput(); LOG_INFO("Passkey Entry: A input, B input"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::NO_INPUT_NO_OUTPUT: // NumericComparison, both auto confirm Loading @@ -315,6 +357,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; } break; Loading @@ -326,6 +369,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::DISPLAY_YES_NO: // NumericComparison, Initiator auto confirm, Responder Yes/No confirm, no show conf val Loading @@ -333,6 +377,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::KEYBOARD_ONLY: // NumericComparison, both auto confirm Loading @@ -340,6 +385,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::NO_INPUT_NO_OUTPUT: // NumericComparison, both auto confirm Loading @@ -347,6 +393,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; } break; Loading system/gd/security/pairing/classic_pairing_handler_unittest.cc +16 −0 Original line number Diff line number Diff line Loading @@ -270,6 +270,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_display_only_display_only_t ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // display_only + display_yes_no is JustWorks no confirmation Loading Loading @@ -306,6 +308,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_display_only_display_yes_no ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // display_only + no_input_no_output is JustWorks no confirmation Loading Loading @@ -342,6 +346,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_display_only_no_input_no_ou ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // keyboard_only + no_input_no_output is JustWorks no confirmation Loading Loading @@ -378,6 +384,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_keyboard_only_no_input_no_o ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // no_input_no_output + display_only is JustWorks no confirmation Loading Loading @@ -414,6 +422,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_no_input_no_output_display_ ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // no_input_no_output + display_yes_no is JustWorks no confirmation Loading Loading @@ -450,6 +460,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_no_input_no_output_display_ ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // no_input_no_output + keyboard_only is JustWorks no confirmation Loading Loading @@ -486,6 +498,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_no_input_no_output_keyboard ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // no_input_no_output + no_input_no_output is JustWorks no confirmation Loading Loading @@ -522,6 +536,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_no_input_no_output_no_input ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } /*** Numeric Comparison ***/ Loading system/gd/security/record/security_record.h +27 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,30 @@ class SecurityRecord { return pseudo_address_; } void SetAuthenticated(bool is_authenticated) { this->is_authenticated_ = is_authenticated; } bool IsAuthenticated() { return this->is_authenticated_; } void SetRequiresMitmProtection(bool requires_mitm_protection) { this->requires_mitm_protection_ = requires_mitm_protection; } bool RequiresMitmProtection() { return this->requires_mitm_protection_; } void SetIsEncryptionRequired(bool is_encryption_required) { this->is_encryption_required_ = is_encryption_required; } bool IsEncryptionRequired() { return this->is_encryption_required_; } private: /* First address we have ever seen this device with, that we used to create bond */ hci::AddressWithType pseudo_address_; Loading @@ -96,6 +120,9 @@ class SecurityRecord { } bool persisted_ = false; bool pairing_ = false; bool is_authenticated_ = false; bool requires_mitm_protection_ = false; bool is_encryption_required_ = false; public: /* Identity Address */ Loading Loading
system/gd/security/pairing/classic_pairing_handler.cc +47 −0 Original line number Diff line number Diff line Loading @@ -152,6 +152,37 @@ void ClassicPairingHandler::OnReceive(hci::IoCapabilityResponseView packet) { // Using local variable until device database pointer is ready remote_io_capability_ = packet.GetIoCapability(); remote_authentication_requirements_ = packet.GetAuthenticationRequirements(); remote_oob_present_ = packet.GetOobDataPresent(); switch (remote_authentication_requirements_) { case hci::AuthenticationRequirements::NO_BONDING: GetRecord()->SetIsEncryptionRequired(false); GetRecord()->SetRequiresMitmProtection(false); break; case hci::AuthenticationRequirements::NO_BONDING_MITM_PROTECTION: GetRecord()->SetIsEncryptionRequired(false); GetRecord()->SetRequiresMitmProtection(true); break; case hci::AuthenticationRequirements::DEDICATED_BONDING: GetRecord()->SetIsEncryptionRequired(true); GetRecord()->SetRequiresMitmProtection(false); break; case hci::AuthenticationRequirements::DEDICATED_BONDING_MITM_PROTECTION: GetRecord()->SetIsEncryptionRequired(true); GetRecord()->SetRequiresMitmProtection(true); break; case hci::AuthenticationRequirements::GENERAL_BONDING: GetRecord()->SetIsEncryptionRequired(true); GetRecord()->SetRequiresMitmProtection(false); break; case hci::AuthenticationRequirements::GENERAL_BONDING_MITM_PROTECTION: GetRecord()->SetIsEncryptionRequired(true); GetRecord()->SetRequiresMitmProtection(true); break; default: GetRecord()->SetRequiresMitmProtection(false); break; } } void ClassicPairingHandler::OnReceive(hci::SimplePairingCompleteView packet) { Loading Loading @@ -238,6 +269,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::DISPLAY_YES_NO: // NumericComparison, Initiator auto confirm, Responder display Loading @@ -245,12 +277,14 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); LOG_INFO("Numeric Comparison: A auto confirm"); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::KEYBOARD_ONLY: // PassKey Entry, Initiator display, Responder input NotifyUiDisplayPasskey(packet.GetNumericValue()); LOG_INFO("Passkey Entry: A display, B input"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::NO_INPUT_NO_OUTPUT: // NumericComparison, Both auto confirm Loading @@ -258,6 +292,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; } break; Loading @@ -268,24 +303,28 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { LOG_INFO("Numeric Comparison: A DisplayYesNo, B auto confirm"); NotifyUiDisplayYesNo(packet.GetNumericValue()); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::DISPLAY_YES_NO: // NumericComparison Both Display, Both confirm LOG_INFO("Numeric Comparison: A and B DisplayYesNo"); NotifyUiDisplayYesNo(packet.GetNumericValue()); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::KEYBOARD_ONLY: // PassKey Entry, Initiator display, Responder input NotifyUiDisplayPasskey(packet.GetNumericValue()); LOG_INFO("Passkey Entry: A display, B input"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::NO_INPUT_NO_OUTPUT: // NumericComparison, auto confirm Responder, Yes/No confirm Initiator. Don't show confirmation value NotifyUiDisplayYesNo(); LOG_INFO("Numeric Comparison: A DisplayYesNo, B auto confirm, no show value"); // Unauthenticated GetRecord()->SetAuthenticated(false); break; } break; Loading @@ -296,18 +335,21 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { NotifyUiDisplayPasskeyInput(); LOG_INFO("Passkey Entry: A input, B display"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::DISPLAY_YES_NO: // PassKey Entry, Responder display, Initiator input NotifyUiDisplayPasskeyInput(); LOG_INFO("Passkey Entry: A input, B display"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::KEYBOARD_ONLY: // PassKey Entry, both input NotifyUiDisplayPasskeyInput(); LOG_INFO("Passkey Entry: A input, B input"); // Authenticated GetRecord()->SetAuthenticated(true); break; case hci::IoCapability::NO_INPUT_NO_OUTPUT: // NumericComparison, both auto confirm Loading @@ -315,6 +357,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; } break; Loading @@ -326,6 +369,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::DISPLAY_YES_NO: // NumericComparison, Initiator auto confirm, Responder Yes/No confirm, no show conf val Loading @@ -333,6 +377,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::KEYBOARD_ONLY: // NumericComparison, both auto confirm Loading @@ -340,6 +385,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; case hci::IoCapability::NO_INPUT_NO_OUTPUT: // NumericComparison, both auto confirm Loading @@ -347,6 +393,7 @@ void ClassicPairingHandler::OnReceive(hci::UserConfirmationRequestView packet) { GetChannel()->SendCommand( hci::UserConfirmationRequestReplyBuilder::Create(GetRecord()->GetPseudoAddress().GetAddress())); // Unauthenticated GetRecord()->SetAuthenticated(false); break; } break; Loading
system/gd/security/pairing/classic_pairing_handler_unittest.cc +16 −0 Original line number Diff line number Diff line Loading @@ -270,6 +270,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_display_only_display_only_t ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // display_only + display_yes_no is JustWorks no confirmation Loading Loading @@ -306,6 +308,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_display_only_display_yes_no ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // display_only + no_input_no_output is JustWorks no confirmation Loading Loading @@ -342,6 +346,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_display_only_no_input_no_ou ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // keyboard_only + no_input_no_output is JustWorks no confirmation Loading Loading @@ -378,6 +384,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_keyboard_only_no_input_no_o ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // no_input_no_output + display_only is JustWorks no confirmation Loading Loading @@ -414,6 +422,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_no_input_no_output_display_ ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // no_input_no_output + display_yes_no is JustWorks no confirmation Loading Loading @@ -450,6 +460,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_no_input_no_output_display_ ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // no_input_no_output + keyboard_only is JustWorks no confirmation Loading Loading @@ -486,6 +498,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_no_input_no_output_keyboard ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } // no_input_no_output + no_input_no_output is JustWorks no confirmation Loading Loading @@ -522,6 +536,8 @@ TEST_F(ClassicPairingHandlerTest, locally_initiatied_no_input_no_output_no_input ReceiveLinkKeyNotification(device_, link_key, key_type); ASSERT_EQ(link_key, security_record_->GetLinkKey()); ASSERT_EQ(key_type, security_record_->GetKeyType()); ASSERT_FALSE(security_record_->IsAuthenticated()); ASSERT_FALSE(security_record_->RequiresMitmProtection()); } /*** Numeric Comparison ***/ Loading
system/gd/security/record/security_record.h +27 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,30 @@ class SecurityRecord { return pseudo_address_; } void SetAuthenticated(bool is_authenticated) { this->is_authenticated_ = is_authenticated; } bool IsAuthenticated() { return this->is_authenticated_; } void SetRequiresMitmProtection(bool requires_mitm_protection) { this->requires_mitm_protection_ = requires_mitm_protection; } bool RequiresMitmProtection() { return this->requires_mitm_protection_; } void SetIsEncryptionRequired(bool is_encryption_required) { this->is_encryption_required_ = is_encryption_required; } bool IsEncryptionRequired() { return this->is_encryption_required_; } private: /* First address we have ever seen this device with, that we used to create bond */ hci::AddressWithType pseudo_address_; Loading @@ -96,6 +120,9 @@ class SecurityRecord { } bool persisted_ = false; bool pairing_ = false; bool is_authenticated_ = false; bool requires_mitm_protection_ = false; bool is_encryption_required_ = false; public: /* Identity Address */ Loading