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

Side by Side Diff: remoting/protocol/spake2_authenticator.cc

Issue 1780403002: Enable Curve25519 in host and client for PIN-based and third-party auth. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/spake2_authenticator.h" 5 #include "remoting/protocol/spake2_authenticator.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 const std::string& shared_secret, 86 const std::string& shared_secret,
87 Authenticator::State initial_state) { 87 Authenticator::State initial_state) {
88 return make_scoped_ptr(new Spake2Authenticator( 88 return make_scoped_ptr(new Spake2Authenticator(
89 local_id, remote_id, shared_secret, false, initial_state)); 89 local_id, remote_id, shared_secret, false, initial_state));
90 } 90 }
91 91
92 // static 92 // static
93 scoped_ptr<Authenticator> Spake2Authenticator::CreateForHost( 93 scoped_ptr<Authenticator> Spake2Authenticator::CreateForHost(
94 const std::string& local_id, 94 const std::string& local_id,
95 const std::string& remote_id, 95 const std::string& remote_id,
96 const std::string& shared_secret,
97 const std::string& local_cert, 96 const std::string& local_cert,
98 scoped_refptr<RsaKeyPair> key_pair, 97 scoped_refptr<RsaKeyPair> key_pair,
98 const std::string& shared_secret,
99 Authenticator::State initial_state) { 99 Authenticator::State initial_state) {
100 scoped_ptr<Spake2Authenticator> result(new Spake2Authenticator( 100 scoped_ptr<Spake2Authenticator> result(new Spake2Authenticator(
101 local_id, remote_id, shared_secret, true, initial_state)); 101 local_id, remote_id, shared_secret, true, initial_state));
102 result->local_cert_ = local_cert; 102 result->local_cert_ = local_cert;
103 result->local_key_pair_ = key_pair; 103 result->local_key_pair_ = key_pair;
104 return std::move(result); 104 return std::move(result);
105 } 105 }
106 106
107 Spake2Authenticator::Spake2Authenticator(const std::string& local_id, 107 Spake2Authenticator::Spake2Authenticator(const std::string& local_id,
108 const std::string& remote_id, 108 const std::string& remote_id,
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 if (!hmac.Init(auth_key_) || 308 if (!hmac.Init(auth_key_) ||
309 !hmac.Sign(message, reinterpret_cast<uint8_t*>(&result[0]), 309 !hmac.Sign(message, reinterpret_cast<uint8_t*>(&result[0]),
310 result.length())) { 310 result.length())) {
311 LOG(FATAL) << "Failed to calculate HMAC."; 311 LOG(FATAL) << "Failed to calculate HMAC.";
312 } 312 }
313 return result; 313 return result;
314 } 314 }
315 315
316 } // namespace protocol 316 } // namespace protocol
317 } // namespace remoting 317 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/spake2_authenticator.h ('k') | remoting/protocol/spake2_authenticator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698