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

Side by Side Diff: chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_operation.cc

Issue 1223983002: Move WriteInto to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/login/easy_unlock/easy_unlock_create_keys_oper ation.h" 5 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_create_keys_oper ation.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 256 }
257 257
258 void EasyUnlockCreateKeysOperation::CreateKeyForDeviceAtIndex(size_t index) { 258 void EasyUnlockCreateKeysOperation::CreateKeyForDeviceAtIndex(size_t index) {
259 DCHECK_GE(index, 0u); 259 DCHECK_GE(index, 0u);
260 if (index == devices_.size()) { 260 if (index == devices_.size()) {
261 callback_.Run(true); 261 callback_.Run(true);
262 return; 262 return;
263 } 263 }
264 264
265 std::string user_key; 265 std::string user_key;
266 crypto::RandBytes(WriteInto(&user_key, kUserKeyByteSize + 1), 266 crypto::RandBytes(base::WriteInto(&user_key, kUserKeyByteSize + 1),
267 kUserKeyByteSize); 267 kUserKeyByteSize);
268 268
269 scoped_ptr<crypto::SymmetricKey> session_key( 269 scoped_ptr<crypto::SymmetricKey> session_key(
270 crypto::SymmetricKey::GenerateRandomKey(crypto::SymmetricKey::AES, 270 crypto::SymmetricKey::GenerateRandomKey(crypto::SymmetricKey::AES,
271 kSessionKeyByteSize * 8)); 271 kSessionKeyByteSize * 8));
272 272
273 std::string iv(kSessionKeyByteSize, ' '); 273 std::string iv(kSessionKeyByteSize, ' ');
274 crypto::Encryptor encryptor; 274 crypto::Encryptor encryptor;
275 if (!encryptor.Init(session_key.get(), crypto::Encryptor::CBC, iv)) { 275 if (!encryptor.Init(session_key.get(), crypto::Encryptor::CBC, iv)) {
276 LOG(ERROR) << "Easy unlock failed to init encryptor for key creation."; 276 LOG(ERROR) << "Easy unlock failed to init encryptor for key creation.";
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 user_context_.GetKey()->GetLabel() == 385 user_context_.GetKey()->GetLabel() ==
386 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) { 386 EasyUnlockKeyManager::GetKeyLabel(key_creation_index_)) {
387 user_context_.SetKey(user_key); 387 user_context_.SetKey(user_key);
388 } 388 }
389 389
390 ++key_creation_index_; 390 ++key_creation_index_;
391 CreateKeyForDeviceAtIndex(key_creation_index_); 391 CreateKeyForDeviceAtIndex(key_creation_index_);
392 } 392 }
393 393
394 } // namespace chromeos 394 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698