mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Turn off encryption over AWDL for upgrade transmissions
PiperOrigin-RevId: 766826551
This commit is contained in:
committed by
Copybara-Service
parent
e96ebef1d3
commit
a45c18eb14
@@ -233,7 +233,11 @@ ByteArray AwdlBwuHandler::HandleInitializeUpgradedMediumForEndpoint(
|
||||
<< " and service_type: " << service_type
|
||||
<< " and has password: " << (password.empty() ? "false" : "true");
|
||||
|
||||
return parser::ForBwuAwdlPathAvailable(service_name, service_type, password);
|
||||
// The AWDL upgraded medium is running under TLS, so we don't need to
|
||||
// encryption for it again.
|
||||
return parser::ForBwuAwdlPathAvailable(
|
||||
service_name, service_type, password,
|
||||
/*supports_disabling_encryption=*/true);
|
||||
}
|
||||
|
||||
void AwdlBwuHandler::HandleRevertInitiatorStateForService(
|
||||
|
||||
@@ -307,7 +307,8 @@ ByteArray ForBwuWifiLanPathAvailable(const std::string& ip_address,
|
||||
|
||||
ByteArray ForBwuAwdlPathAvailable(const std::string& service_name,
|
||||
const std::string& service_type,
|
||||
const std::string& password) {
|
||||
const std::string& password,
|
||||
bool supports_disabling_encryption) {
|
||||
OfflineFrame frame;
|
||||
|
||||
frame.set_version(OfflineFrame::V1);
|
||||
@@ -319,6 +320,8 @@ ByteArray ForBwuAwdlPathAvailable(const std::string& service_name,
|
||||
auto* upgrade_path_info = sub_frame->mutable_upgrade_path_info();
|
||||
upgrade_path_info->set_medium(UpgradePathInfo::AWDL);
|
||||
upgrade_path_info->set_supports_client_introduction_ack(true);
|
||||
upgrade_path_info->set_supports_disabling_encryption(
|
||||
supports_disabling_encryption);
|
||||
auto* awdl_socket = upgrade_path_info->mutable_awdl_credentials();
|
||||
awdl_socket->set_service_name(service_name);
|
||||
awdl_socket->set_service_type(service_type);
|
||||
|
||||
@@ -84,7 +84,8 @@ ByteArray ForBwuWifiLanPathAvailable(const std::string& ip_address,
|
||||
std::int32_t port);
|
||||
ByteArray ForBwuAwdlPathAvailable(const std::string& service_name,
|
||||
const std::string& service_type,
|
||||
const std::string& password);
|
||||
const std::string& password,
|
||||
bool supports_disabling_encryption);
|
||||
ByteArray ForBwuWifiAwarePathAvailable(const std::string& service_id,
|
||||
const std::string& service_info,
|
||||
const std::string& password,
|
||||
|
||||
@@ -447,11 +447,12 @@ TEST(OfflineFramesTest, CanGenerateBwuAwdlPathAvailable) {
|
||||
service_type: "nearby_upgrade"
|
||||
password: "password"
|
||||
>
|
||||
supports_disabling_encryption: true
|
||||
>
|
||||
>
|
||||
>)pb";
|
||||
ByteArray bytes =
|
||||
ForBwuAwdlPathAvailable("service_name", "nearby_upgrade", "password");
|
||||
ByteArray bytes = ForBwuAwdlPathAvailable("service_name", "nearby_upgrade",
|
||||
"password", true);
|
||||
auto response = FromBytes(bytes);
|
||||
ASSERT_TRUE(response.ok());
|
||||
OfflineFrame message = response.result();
|
||||
|
||||
Reference in New Issue
Block a user