Commit 756572bf authored by Naomi Musgrave's avatar Naomi Musgrave Committed by Commit Bot

[Nearby] Rename advertisement field.

chrome/services/sharing/nearby/decoder/nearby_decoder_unittest.cc
chrome/browser/nearby_sharing/nearby_sharing_service_impl.cc
- Update usage of advertisement field to new name

chrome/services/sharing/public/*
- Rename advertisement field to be more accurate
- Update comments to be more detailed

This is a follow-on to feedback raised on
Ia384e12083a590f52beb1f98d50b192ab20f31cd

Bug: 1084582

Change-Id: If5a3c40ee0ad33de01bd5c4322078c4fa9b206c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352893Reviewed-by: default avatarAlex Chau <alexchau@chromium.org>
Reviewed-by: default avatarRichard Knoll <knollr@chromium.org>
Reviewed-by: default avatarAlex Gough <ajgo@chromium.org>
Reviewed-by: default avatarJosh Nohle <nohle@chromium.org>
Commit-Queue: Naomi Musgrave <nmusgrave@chromium.org>
Cr-Commit-Position: refs/heads/master@{#797687}
parent 5762d4e7
...@@ -567,11 +567,12 @@ void NearbySharingServiceImpl::OnOutgoingAdvertisementDecoded( ...@@ -567,11 +567,12 @@ void NearbySharingServiceImpl::OnOutgoingAdvertisementDecoded(
// Once get the advertisement, the first thing to do is decrypt the // Once get the advertisement, the first thing to do is decrypt the
// certificate. // certificate.
std::vector<uint8_t> encrypted_metadata = advertisement->encrypted_metadata; std::vector<uint8_t> encrypted_metadata_key =
advertisement->encrypted_metadata_key;
std::vector<uint8_t> salt = advertisement->salt; std::vector<uint8_t> salt = advertisement->salt;
GetCertificateManager()->GetDecryptedPublicCertificate( GetCertificateManager()->GetDecryptedPublicCertificate(
std::move(encrypted_metadata), std::move(salt), std::move(encrypted_metadata_key), std::move(salt),
base::BindOnce(&NearbySharingServiceImpl::OnOutgoingDecryptedCertificate, base::BindOnce(&NearbySharingServiceImpl::OnOutgoingDecryptedCertificate,
weak_ptr_factory_.GetWeakPtr(), endpoint_id, weak_ptr_factory_.GetWeakPtr(), endpoint_id,
std::move(advertisement))); std::move(advertisement)));
...@@ -1334,11 +1335,12 @@ void NearbySharingServiceImpl::OnIncomingAdvertisementDecoded( ...@@ -1334,11 +1335,12 @@ void NearbySharingServiceImpl::OnIncomingAdvertisementDecoded(
return; return;
} }
std::vector<uint8_t> encrypted_metadata = advertisement->encrypted_metadata; std::vector<uint8_t> encrypted_metadata_key =
advertisement->encrypted_metadata_key;
std::vector<uint8_t> salt = advertisement->salt; std::vector<uint8_t> salt = advertisement->salt;
GetCertificateManager()->GetDecryptedPublicCertificate( GetCertificateManager()->GetDecryptedPublicCertificate(
std::move(encrypted_metadata), std::move(salt), std::move(encrypted_metadata_key), std::move(salt),
base::BindOnce(&NearbySharingServiceImpl::OnIncomingDecryptedCertificate, base::BindOnce(&NearbySharingServiceImpl::OnIncomingDecryptedCertificate,
weak_ptr_factory_.GetWeakPtr(), endpoint_id, connection, weak_ptr_factory_.GetWeakPtr(), endpoint_id, connection,
std::move(advertisement))); std::move(advertisement)));
......
...@@ -36,7 +36,7 @@ void ExpectEquals(const Advertisement& self, ...@@ -36,7 +36,7 @@ void ExpectEquals(const Advertisement& self,
const mojom::AdvertisementPtr& other) { const mojom::AdvertisementPtr& other) {
EXPECT_EQ(self.device_name(), other->device_name); EXPECT_EQ(self.device_name(), other->device_name);
EXPECT_EQ(self.salt(), other->salt); EXPECT_EQ(self.salt(), other->salt);
EXPECT_EQ(self.encrypted_metadata_key(), other->encrypted_metadata); EXPECT_EQ(self.encrypted_metadata_key(), other->encrypted_metadata_key);
} }
void ExpectFrameContainsIntroduction( void ExpectFrameContainsIntroduction(
......
...@@ -56,11 +56,14 @@ class Advertisement { ...@@ -56,11 +56,14 @@ class Advertisement {
// ways of parsing the endpoint id. // ways of parsing the endpoint id.
int version_; int version_;
// A randomized salt used in the hash of the account identifier. // Random bytes that were used as salt during encryption of public certificate
// metadata.
std::vector<uint8_t> salt_; std::vector<uint8_t> salt_;
// A salted hash of an account identifier that signifies who the remote device // An encrypted symmetric key that was used to encrypt public certificate
// is. // metadata, including an account identifier signifying the remote device.
// The key can be decrypted using |salt| and the corresponding public
// certificate's secret/authenticity key.
std::vector<uint8_t> encrypted_metadata_key_; std::vector<uint8_t> encrypted_metadata_key_;
// The human readable name of the remote device. // The human readable name of the remote device.
......
...@@ -8,11 +8,14 @@ import "mojo/public/mojom/base/time.mojom"; ...@@ -8,11 +8,14 @@ import "mojo/public/mojom/base/time.mojom";
// An advertisement send by a device in receiving mode. // An advertisement send by a device in receiving mode.
struct Advertisement { struct Advertisement {
// Random data erived from a device's private key. // Random bytes that were used as salt during encryption of public
// certificate metadata.
array<uint8, 2> salt; array<uint8, 2> salt;
// Derived from a device's private key. Identifying data for the device. // An encrypted symmetric key that was used to encrypt public certificate
array<uint8, 14> encrypted_metadata; // metadata. The key can be decrypted using |salt| and the corresponding
// public certificate's secret/authenticity key.
array<uint8, 14> encrypted_metadata_key;
// If present, the device is visible to everyone rather than contacts only. // If present, the device is visible to everyone rather than contacts only.
string? device_name; string? device_name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment