Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Unified Diff: components/cryptauth/device_to_device_authenticator.cc

Issue 2899863002: Updating D2D protocol to v1 to support separate sequence numbers. (Closed)
Patch Set: Fixing tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/cryptauth/device_to_device_authenticator.cc
diff --git a/components/cryptauth/device_to_device_authenticator.cc b/components/cryptauth/device_to_device_authenticator.cc
index d80449ffaa05d80d216e5663cea571e3bde28616..caf601cc12034050f782beb91248378553a879e8 100644
--- a/components/cryptauth/device_to_device_authenticator.cc
+++ b/components/cryptauth/device_to_device_authenticator.cc
@@ -15,6 +15,7 @@
#include "components/cryptauth/device_to_device_secure_context.h"
#include "components/cryptauth/secure_context.h"
#include "components/cryptauth/secure_message_delegate.h"
+#include "components/cryptauth/session_keys.h"
#include "components/cryptauth/wire_message.h"
#include "components/proximity_auth/logging/logging.h"
@@ -154,7 +155,7 @@ void DeviceToDeviceAuthenticator::OnResponderAuthTimedOut() {
void DeviceToDeviceAuthenticator::OnResponderAuthValidated(
bool validated,
- const std::string& session_symmetric_key) {
+ std::unique_ptr<SessionKeys> session_keys) {
if (!validated) {
Fail("Unable to validated [Responder Auth]");
return;
@@ -163,11 +164,11 @@ void DeviceToDeviceAuthenticator::OnResponderAuthValidated(
PA_LOG(INFO) << "Successfully validated [Responder Auth]! "
<< "Sending [Initiator Auth]...";
state_ = State::VALIDATED_RESPONDER_AUTH;
- session_symmetric_key_ = session_symmetric_key;
+ session_keys_ = std::move(session_keys);
// Create the [Initiator Auth] message to send to the remote device.
DeviceToDeviceInitiatorOperations::CreateInitiatorAuthMessage(
- session_symmetric_key,
+ session_keys_.get(),
connection_->remote_device().persistent_symmetric_key,
responder_auth_message_, secure_message_delegate_.get(),
base::Bind(&DeviceToDeviceAuthenticator::OnInitiatorAuthCreated,
@@ -204,7 +205,7 @@ void DeviceToDeviceAuthenticator::Fail(const std::string& error_message,
void DeviceToDeviceAuthenticator::Succeed() {
DCHECK(state_ == State::SENT_INITIATOR_AUTH);
- DCHECK(!session_symmetric_key_.empty());
+ DCHECK(session_keys_);
PA_LOG(INFO) << "Authentication succeeded!";
state_ = State::AUTHENTICATION_SUCCESS;
@@ -212,7 +213,7 @@ void DeviceToDeviceAuthenticator::Succeed() {
callback_.Run(
Result::SUCCESS,
base::MakeUnique<DeviceToDeviceSecureContext>(
- std::move(secure_message_delegate_), session_symmetric_key_,
+ std::move(secure_message_delegate_), std::move(session_keys_),
responder_auth_message_, SecureContext::PROTOCOL_VERSION_THREE_ONE));
}

Powered by Google App Engine
This is Rietveld 408576698