OLD | NEW |
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" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/sys_byteorder.h" | 12 #include "base/sys_byteorder.h" |
13 #include "crypto/hmac.h" | 13 #include "crypto/hmac.h" |
14 #include "crypto/secure_util.h" | 14 #include "crypto/secure_util.h" |
15 #include "remoting/base/constants.h" | 15 #include "remoting/base/constants.h" |
16 #include "remoting/base/rsa_key_pair.h" | 16 #include "remoting/base/rsa_key_pair.h" |
17 #include "remoting/protocol/ssl_hmac_channel_authenticator.h" | 17 #include "remoting/protocol/ssl_hmac_channel_authenticator.h" |
18 #include "third_party/boringssl/src/include/openssl/curve25519.h" | 18 #include "third_party/boringssl/src/include/openssl/curve25519.h" |
19 #include "third_party/webrtc/libjingle/xmllite/xmlelement.h" | 19 #include "third_party/libjingle_xmpp/xmllite/xmlelement.h" |
20 | 20 |
21 namespace remoting { | 21 namespace remoting { |
22 namespace protocol { | 22 namespace protocol { |
23 | 23 |
24 namespace { | 24 namespace { |
25 | 25 |
26 // Each peer sends 2 messages: <spake-message> and <verification-hash>. The | 26 // Each peer sends 2 messages: <spake-message> and <verification-hash>. The |
27 // content of <spake-message> is the output of SPAKE2_generate_msg() and must | 27 // content of <spake-message> is the output of SPAKE2_generate_msg() and must |
28 // be passed to SPAKE2_process_msg() on the other end. This is enough to | 28 // be passed to SPAKE2_process_msg() on the other end. This is enough to |
29 // generate authentication key. <verification-hash> is sent to confirm that both | 29 // generate authentication key. <verification-hash> is sent to confirm that both |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 if (!hmac.Init(auth_key_) || | 309 if (!hmac.Init(auth_key_) || |
310 !hmac.Sign(message, reinterpret_cast<uint8_t*>(&result[0]), | 310 !hmac.Sign(message, reinterpret_cast<uint8_t*>(&result[0]), |
311 result.length())) { | 311 result.length())) { |
312 LOG(FATAL) << "Failed to calculate HMAC."; | 312 LOG(FATAL) << "Failed to calculate HMAC."; |
313 } | 313 } |
314 return result; | 314 return result; |
315 } | 315 } |
316 | 316 |
317 } // namespace protocol | 317 } // namespace protocol |
318 } // namespace remoting | 318 } // namespace remoting |
OLD | NEW |