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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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
« no previous file with comments | « remoting/protocol/session_manager.h ('k') | remoting/protocol/spake2_authenticator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef REMOTING_PROTOCOL_SPAKE2_AUTHENTICATOR_H_ 5 #ifndef REMOTING_PROTOCOL_SPAKE2_AUTHENTICATOR_H_
6 #define REMOTING_PROTOCOL_SPAKE2_AUTHENTICATOR_H_ 6 #define REMOTING_PROTOCOL_SPAKE2_AUTHENTICATOR_H_
7 7
8 #include <memory>
8 #include <queue> 9 #include <queue>
9 #include <string> 10 #include <string>
10 11
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "remoting/protocol/authenticator.h" 16 #include "remoting/protocol/authenticator.h"
17 17
18 typedef struct spake2_ctx_st SPAKE2_CTX; 18 typedef struct spake2_ctx_st SPAKE2_CTX;
19 19
20 namespace remoting { 20 namespace remoting {
21 21
22 class RsaKeyPair; 22 class RsaKeyPair;
23 23
24 namespace protocol { 24 namespace protocol {
25 25
26 // Authenticator that uses SPAKE2 implementation from BoringSSL. It 26 // Authenticator that uses SPAKE2 implementation from BoringSSL. It
27 // implements SPAKE2 over Curve25519. 27 // implements SPAKE2 over Curve25519.
28 class Spake2Authenticator : public Authenticator { 28 class Spake2Authenticator : public Authenticator {
29 public: 29 public:
30 static scoped_ptr<Authenticator> CreateForClient( 30 static std::unique_ptr<Authenticator> CreateForClient(
31 const std::string& local_id, 31 const std::string& local_id,
32 const std::string& remote_id, 32 const std::string& remote_id,
33 const std::string& shared_secret, 33 const std::string& shared_secret,
34 State initial_state); 34 State initial_state);
35 35
36 static scoped_ptr<Authenticator> CreateForHost( 36 static std::unique_ptr<Authenticator> CreateForHost(
37 const std::string& local_id, 37 const std::string& local_id,
38 const std::string& remote_id, 38 const std::string& remote_id,
39 const std::string& local_cert, 39 const std::string& local_cert,
40 scoped_refptr<RsaKeyPair> key_pair, 40 scoped_refptr<RsaKeyPair> key_pair,
41 const std::string& shared_secret, 41 const std::string& shared_secret,
42 State initial_state); 42 State initial_state);
43 43
44 ~Spake2Authenticator() override; 44 ~Spake2Authenticator() override;
45 45
46 // Authenticator interface. 46 // Authenticator interface.
47 State state() const override; 47 State state() const override;
48 bool started() const override; 48 bool started() const override;
49 RejectionReason rejection_reason() const override; 49 RejectionReason rejection_reason() const override;
50 void ProcessMessage(const buzz::XmlElement* message, 50 void ProcessMessage(const buzz::XmlElement* message,
51 const base::Closure& resume_callback) override; 51 const base::Closure& resume_callback) override;
52 scoped_ptr<buzz::XmlElement> GetNextMessage() override; 52 std::unique_ptr<buzz::XmlElement> GetNextMessage() override;
53 const std::string& GetAuthKey() const override; 53 const std::string& GetAuthKey() const override;
54 scoped_ptr<ChannelAuthenticator> CreateChannelAuthenticator() const override; 54 std::unique_ptr<ChannelAuthenticator> CreateChannelAuthenticator()
55 const override;
55 56
56 private: 57 private:
57 FRIEND_TEST_ALL_PREFIXES(Spake2AuthenticatorTest, InvalidSecret); 58 FRIEND_TEST_ALL_PREFIXES(Spake2AuthenticatorTest, InvalidSecret);
58 59
59 Spake2Authenticator(const std::string& local_id, 60 Spake2Authenticator(const std::string& local_id,
60 const std::string& remote_id, 61 const std::string& remote_id,
61 const std::string& shared_secret, 62 const std::string& shared_secret,
62 bool is_host, 63 bool is_host,
63 State initial_state); 64 State initial_state);
64 65
(...skipping 26 matching lines...) Expand all
91 std::string auth_key_; 92 std::string auth_key_;
92 std::string expected_verification_hash_; 93 std::string expected_verification_hash_;
93 94
94 DISALLOW_COPY_AND_ASSIGN(Spake2Authenticator); 95 DISALLOW_COPY_AND_ASSIGN(Spake2Authenticator);
95 }; 96 };
96 97
97 } // namespace protocol 98 } // namespace protocol
98 } // namespace remoting 99 } // namespace remoting
99 100
100 #endif // REMOTING_PROTOCOL_SPAKE2_AUTHENTICATOR_H_ 101 #endif // REMOTING_PROTOCOL_SPAKE2_AUTHENTICATOR_H_
OLDNEW
« no previous file with comments | « remoting/protocol/session_manager.h ('k') | remoting/protocol/spake2_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698