| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/sync/util/nigori.h" | 5 #include "chrome/browser/sync/util/nigori.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <winsock2.h> // for htonl | 8 #include <winsock2.h> // for htonl |
| 9 #else | 9 #else |
| 10 #include <arpa/inet.h> | 10 #include <arpa/inet.h> |
| 11 #endif | 11 #endif |
| 12 | 12 |
| 13 #include <sstream> | 13 #include <sstream> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/base64.h" | 16 #include "base/base64.h" |
| 17 #include "base/crypto/encryptor.h" | |
| 18 #include "base/hmac.h" | |
| 19 #include "base/logging.h" | 17 #include "base/logging.h" |
| 20 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
| 21 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "crypto/encryptor.h" |
| 21 #include "crypto/hmac.h" |
| 22 | 22 |
| 23 using base::Base64Encode; | 23 using base::Base64Encode; |
| 24 using base::Base64Decode; | 24 using base::Base64Decode; |
| 25 using base::Encryptor; | |
| 26 using base::HMAC; | |
| 27 using base::RandInt; | 25 using base::RandInt; |
| 28 using base::SymmetricKey; | 26 using crypto::Encryptor; |
| 27 using crypto::HMAC; |
| 28 using crypto::SymmetricKey; |
| 29 | 29 |
| 30 namespace browser_sync { | 30 namespace browser_sync { |
| 31 | 31 |
| 32 // NigoriStream simplifies the concatenation operation of the Nigori protocol. | 32 // NigoriStream simplifies the concatenation operation of the Nigori protocol. |
| 33 class NigoriStream { | 33 class NigoriStream { |
| 34 public: | 34 public: |
| 35 // Append the big-endian representation of the length of |value| with 32 bits, | 35 // Append the big-endian representation of the length of |value| with 32 bits, |
| 36 // followed by |value| itself to the stream. | 36 // followed by |value| itself to the stream. |
| 37 NigoriStream& operator<<(const std::string& value) { | 37 NigoriStream& operator<<(const std::string& value) { |
| 38 uint32 size = htonl(value.size()); | 38 uint32 size = htonl(value.size()); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 DCHECK(user_key); | 251 DCHECK(user_key); |
| 252 DCHECK(encryption_key); | 252 DCHECK(encryption_key); |
| 253 DCHECK(mac_key); | 253 DCHECK(mac_key); |
| 254 | 254 |
| 255 return user_key_->GetRawKey(user_key) && | 255 return user_key_->GetRawKey(user_key) && |
| 256 encryption_key_->GetRawKey(encryption_key) && | 256 encryption_key_->GetRawKey(encryption_key) && |
| 257 mac_key_->GetRawKey(mac_key); | 257 mac_key_->GetRawKey(mac_key); |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace browser_sync | 260 } // namespace browser_sync |
| OLD | NEW |