diff options
Diffstat (limited to 'chrome/browser')
41 files changed, 181 insertions, 186 deletions
diff --git a/chrome/browser/browser_main_gtk.cc b/chrome/browser/browser_main_gtk.cc index 342c643..072ed0e 100644 --- a/chrome/browser/browser_main_gtk.cc +++ b/chrome/browser/browser_main_gtk.cc @@ -27,7 +27,7 @@ #include "ui/gfx/gtk_util.h" #if defined(USE_NSS) -#include "base/nss_util.h" +#include "crypto/nss_util.h" #endif #if defined(USE_LINUX_BREAKPAD) @@ -69,7 +69,7 @@ void BrowserMainPartsGtk::PreEarlyInitialization() { #if defined(USE_NSS) // We want to be sure to init NSPR on the main thread. - base::EnsureNSPRInit(); + crypto::EnsureNSPRInit(); #endif } diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm index 806c6e7..5ebe23d 100644 --- a/chrome/browser/browser_main_mac.mm +++ b/chrome/browser/browser_main_mac.mm @@ -11,8 +11,8 @@ #include "base/file_path.h" #include "base/mac/mac_util.h" #include "base/memory/scoped_nsobject.h" -#include "base/nss_util.h" #include "base/path_service.h" +#include "crypto/nss_util.h" #include "chrome/app/breakpad_mac.h" #import "chrome/browser/app_controller_mac.h" #include "chrome/browser/browser_main_win.h" @@ -137,7 +137,7 @@ class BrowserMainPartsMac : public BrowserMainPartsPosix { net::ClientSocketFactory::UseSystemSSL(); } else { // We want to be sure to init NSPR on the main thread. - base::EnsureNSPRInit(); + crypto::EnsureNSPRInit(); } } }; diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc index fc69fcd..0a5ded4 100644 --- a/chrome/browser/browser_main_win.cc +++ b/chrome/browser/browser_main_win.cc @@ -15,11 +15,11 @@ #include "base/i18n/rtl.h" #include "base/memory/scoped_native_library.h" #include "base/memory/scoped_ptr.h" -#include "base/nss_util.h" #include "base/path_service.h" #include "base/utf_string_conversions.h" #include "base/win/windows_version.h" #include "base/win/wrapped_window_proc.h" +#include "crypto/nss_util.h" #include "chrome/browser/first_run/first_run.h" #include "chrome/browser/first_run/upgrade_util.h" #include "chrome/browser/metrics/metrics_service.h" @@ -295,7 +295,7 @@ class BrowserMainPartsWin : public BrowserMainParts { net::ClientSocketFactory::UseSystemSSL(); } else { // We want to be sure to init NSPR on the main thread. - base::EnsureNSPRInit(); + crypto::EnsureNSPRInit(); } } }; diff --git a/chrome/browser/chromeos/login/google_authenticator.cc b/chrome/browser/chromeos/login/google_authenticator.cc index f927e60..3ecece9 100644 --- a/chrome/browser/chromeos/login/google_authenticator.cc +++ b/chrome/browser/chromeos/login/google_authenticator.cc @@ -11,11 +11,10 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/path_service.h" -#include "base/sha2.h" #include "base/string_util.h" #include "base/synchronization/lock.h" -#include "base/third_party/nss/blapi.h" -#include "base/third_party/nss/sha256.h" +#include "crypto/third_party/nss/blapi.h" +#include "crypto/third_party/nss/sha256.h" #include "chrome/browser/chromeos/boot_times_loader.h" #include "chrome/browser/chromeos/cros/cryptohome_library.h" #include "chrome/browser/chromeos/login/auth_response_handler.h" diff --git a/chrome/browser/chromeos/login/mock_owner_key_utils.h b/chrome/browser/chromeos/login/mock_owner_key_utils.h index e755ca8..57b47dc 100644 --- a/chrome/browser/chromeos/login/mock_owner_key_utils.h +++ b/chrome/browser/chromeos/login/mock_owner_key_utils.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,16 +9,14 @@ #include <vector> #include "base/basictypes.h" -#include "base/crypto/rsa_private_key.h" #include "base/file_path.h" +#include "crypto/rsa_private_key.h" #include "chrome/browser/chromeos/cros/login_library.h" #include "chrome/browser/chromeos/login/owner_key_utils.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::base::RSAPrivateKey; - namespace chromeos { class MockKeyUtils : public OwnerKeyUtils { @@ -31,10 +29,11 @@ class MockKeyUtils : public OwnerKeyUtils { const std::vector<uint8> public_key)); MOCK_METHOD3(Sign, bool(const std::string& data, std::vector<uint8>* OUT_signature, - base::RSAPrivateKey* key)); - MOCK_METHOD1(FindPrivateKey, RSAPrivateKey*(const std::vector<uint8>& key)); + crypto::RSAPrivateKey* key)); + MOCK_METHOD1(FindPrivateKey, + crypto::RSAPrivateKey*(const std::vector<uint8>& key)); MOCK_METHOD0(GetOwnerKeyFilePath, FilePath()); - MOCK_METHOD2(ExportPublicKeyToFile, bool(base::RSAPrivateKey* pair, + MOCK_METHOD2(ExportPublicKeyToFile, bool(crypto::RSAPrivateKey* pair, const FilePath& key_file)); protected: virtual ~MockKeyUtils() {} diff --git a/chrome/browser/chromeos/login/owner_key_utils.cc b/chrome/browser/chromeos/login/owner_key_utils.cc index bdfc489..119eb33 100644 --- a/chrome/browser/chromeos/login/owner_key_utils.cc +++ b/chrome/browser/chromeos/login/owner_key_utils.cc @@ -6,19 +6,18 @@ #include <limits> -#include "base/crypto/rsa_private_key.h" -#include "base/crypto/signature_creator.h" -#include "base/crypto/signature_verifier.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/string_util.h" +#include "crypto/rsa_private_key.h" +#include "crypto/signature_creator.h" +#include "crypto/signature_verifier.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/login_library.h" #include "chrome/common/extensions/extension_constants.h" -using base::RSAPrivateKey; using extension_misc::kSignatureAlgorithm; namespace chromeos { @@ -49,16 +48,17 @@ class OwnerKeyUtilsImpl : public OwnerKeyUtils { bool Sign(const std::string& data, std::vector<uint8>* OUT_signature, - base::RSAPrivateKey* key); + crypto::RSAPrivateKey* key); - RSAPrivateKey* FindPrivateKey(const std::vector<uint8>& key); + crypto::RSAPrivateKey* FindPrivateKey(const std::vector<uint8>& key); FilePath GetOwnerKeyFilePath(); protected: virtual ~OwnerKeyUtilsImpl(); - bool ExportPublicKeyToFile(RSAPrivateKey* pair, const FilePath& key_file); + bool ExportPublicKeyToFile(crypto::RSAPrivateKey* pair, + const FilePath& key_file); private: // The file outside the owner's encrypted home directory where her @@ -83,7 +83,7 @@ OwnerKeyUtilsImpl::OwnerKeyUtilsImpl() {} OwnerKeyUtilsImpl::~OwnerKeyUtilsImpl() {} -bool OwnerKeyUtilsImpl::ExportPublicKeyToFile(RSAPrivateKey* pair, +bool OwnerKeyUtilsImpl::ExportPublicKeyToFile(crypto::RSAPrivateKey* pair, const FilePath& key_file) { DCHECK(pair); bool ok = false; @@ -134,7 +134,7 @@ bool OwnerKeyUtilsImpl::ImportPublicKey(const FilePath& key_file, bool OwnerKeyUtilsImpl::Verify(const std::string& data, const std::vector<uint8> signature, const std::vector<uint8> public_key) { - base::SignatureVerifier verifier; + crypto::SignatureVerifier verifier; if (!verifier.VerifyInit(kSignatureAlgorithm, sizeof(kSignatureAlgorithm), &signature[0], signature.size(), &public_key[0], public_key.size())) { @@ -148,9 +148,9 @@ bool OwnerKeyUtilsImpl::Verify(const std::string& data, bool OwnerKeyUtilsImpl::Sign(const std::string& data, std::vector<uint8>* OUT_signature, - base::RSAPrivateKey* key) { - scoped_ptr<base::SignatureCreator> signer( - base::SignatureCreator::Create(key)); + crypto::RSAPrivateKey* key) { + scoped_ptr<crypto::SignatureCreator> signer( + crypto::SignatureCreator::Create(key)); if (!signer->Update(reinterpret_cast<const uint8*>(data.c_str()), data.length())) { return false; @@ -158,9 +158,9 @@ bool OwnerKeyUtilsImpl::Sign(const std::string& data, return signer->Final(OUT_signature); } -RSAPrivateKey* OwnerKeyUtilsImpl::FindPrivateKey( +crypto::RSAPrivateKey* OwnerKeyUtilsImpl::FindPrivateKey( const std::vector<uint8>& key) { - return RSAPrivateKey::FindFromPublicKeyInfo(key); + return crypto::RSAPrivateKey::FindFromPublicKeyInfo(key); } FilePath OwnerKeyUtilsImpl::GetOwnerKeyFilePath() { diff --git a/chrome/browser/chromeos/login/owner_key_utils.h b/chrome/browser/chromeos/login/owner_key_utils.h index 3a2c84c..e8ba047f 100644 --- a/chrome/browser/chromeos/login/owner_key_utils.h +++ b/chrome/browser/chromeos/login/owner_key_utils.h @@ -15,7 +15,7 @@ class FilePath; -namespace base { +namespace crypto { class RSAPrivateKey; } @@ -60,12 +60,12 @@ class OwnerKeyUtils : public base::RefCounted<OwnerKeyUtils> { // and populate |OUT_signature|. virtual bool Sign(const std::string& data, std::vector<uint8>* OUT_signature, - base::RSAPrivateKey* key) = 0; + crypto::RSAPrivateKey* key) = 0; // Looks for the private key associated with |key| in the default slot, // and returns it if it can be found. Returns NULL otherwise. // Caller takes ownership. - virtual base::RSAPrivateKey* FindPrivateKey( + virtual crypto::RSAPrivateKey* FindPrivateKey( const std::vector<uint8>& key) = 0; virtual FilePath GetOwnerKeyFilePath() = 0; @@ -76,7 +76,7 @@ class OwnerKeyUtils : public base::RefCounted<OwnerKeyUtils> { // DER encodes public half of |pair| and writes it out to |key_file|. // The blob on disk is a DER-encoded X509 SubjectPublicKeyInfo object. // Returns false on error. - virtual bool ExportPublicKeyToFile(base::RSAPrivateKey* pair, + virtual bool ExportPublicKeyToFile(crypto::RSAPrivateKey* pair, const FilePath& key_file) = 0; private: diff --git a/chrome/browser/chromeos/login/owner_key_utils_unittest.cc b/chrome/browser/chromeos/login/owner_key_utils_unittest.cc index 6033455..1b5ef26 100644 --- a/chrome/browser/chromeos/login/owner_key_utils_unittest.cc +++ b/chrome/browser/chromeos/login/owner_key_utils_unittest.cc @@ -7,13 +7,13 @@ #include <string> #include <vector> -#include "base/crypto/rsa_private_key.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/memory/ref_counted.h" #include "base/memory/scoped_temp_dir.h" -#include "base/nss_util.h" -#include "base/nss_util_internal.h" +#include "crypto/nss_util.h" +#include "crypto/nss_util_internal.h" +#include "crypto/rsa_private_key.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -25,7 +25,7 @@ class OwnerKeyUtilsTest : public ::testing::Test { virtual ~OwnerKeyUtilsTest() {} virtual void SetUp() { - base::OpenPersistentNSSDB(); + crypto::OpenPersistentNSSDB(); } // Key generation parameters. @@ -39,9 +39,9 @@ class OwnerKeyUtilsTest : public ::testing::Test { const uint16 OwnerKeyUtilsTest::kKeySizeInBits = 2048; TEST_F(OwnerKeyUtilsTest, ExportImportPublicKey) { - scoped_ptr<base::RSAPrivateKey> pair( - base::RSAPrivateKey::CreateSensitive(kKeySizeInBits)); - ASSERT_NE(pair.get(), reinterpret_cast<base::RSAPrivateKey*>(NULL)); + scoped_ptr<crypto::RSAPrivateKey> pair( + crypto::RSAPrivateKey::CreateSensitive(kKeySizeInBits)); + ASSERT_NE(pair.get(), reinterpret_cast<crypto::RSAPrivateKey*>(NULL)); // Export public key to file. ScopedTempDir tmpdir; diff --git a/chrome/browser/chromeos/login/owner_manager.h b/chrome/browser/chromeos/login/owner_manager.h index 06f700a..9b0f036 100644 --- a/chrome/browser/chromeos/login/owner_manager.h +++ b/chrome/browser/chromeos/login/owner_manager.h @@ -9,8 +9,8 @@ #include <vector> #include "base/basictypes.h" -#include "base/crypto/rsa_private_key.h" #include "base/memory/ref_counted.h" +#include "crypto/rsa_private_key.h" #include "chrome/browser/chromeos/login/owner_key_utils.h" #include "content/browser/browser_thread.h" @@ -89,7 +89,7 @@ class OwnerManager : public base::RefCountedThreadSafe<OwnerManager> { d->OnKeyOpComplete(return_code, payload); } - scoped_ptr<base::RSAPrivateKey> private_key_; + scoped_ptr<crypto::RSAPrivateKey> private_key_; std::vector<uint8> public_key_; scoped_refptr<OwnerKeyUtils> utils_; diff --git a/chrome/browser/chromeos/login/owner_manager_unittest.cc b/chrome/browser/chromeos/login/owner_manager_unittest.cc index edeeab9..b2e7f88e 100644 --- a/chrome/browser/chromeos/login/owner_manager_unittest.cc +++ b/chrome/browser/chromeos/login/owner_manager_unittest.cc @@ -7,18 +7,18 @@ #include <string> -#include "base/crypto/rsa_private_key.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" #include "base/memory/scoped_temp_dir.h" -#include "base/nss_util.h" +#include "crypto/nss_util.h" +#include "crypto/rsa_private_key.h" #include "chrome/browser/chromeos/login/mock_owner_key_utils.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::base::RSAPrivateKey; +using ::crypto::RSAPrivateKey; using ::testing::DoAll; using ::testing::Eq; using ::testing::Invoke; @@ -40,7 +40,7 @@ class OwnerManagerTest : public ::testing::Test { virtual ~OwnerManagerTest() {} virtual void SetUp() { - base::OpenPersistentNSSDB(); // TODO(cmasone): use test DB instead + crypto::OpenPersistentNSSDB(); // TODO(cmasone): use test DB instead fake_private_key_.reset(RSAPrivateKey::Create(256)); ASSERT_TRUE(fake_private_key_->ExportPublicKey(&fake_public_key_)); diff --git a/chrome/browser/chromeos/login/ownership_service_unittest.cc b/chrome/browser/chromeos/login/ownership_service_unittest.cc index 24b5959..dfa4f25 100644 --- a/chrome/browser/chromeos/login/ownership_service_unittest.cc +++ b/chrome/browser/chromeos/login/ownership_service_unittest.cc @@ -6,20 +6,20 @@ #include <string> -#include "base/crypto/rsa_private_key.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_temp_dir.h" -#include "base/nss_util.h" +#include "crypto/nss_util.h" +#include "crypto/rsa_private_key.h" #include "chrome/browser/chromeos/login/mock_owner_key_utils.h" #include "chrome/browser/chromeos/login/owner_manager_unittest.h" #include "content/browser/browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using ::base::RSAPrivateKey; +using ::crypto::RSAPrivateKey; using ::testing::DoAll; using ::testing::Eq; using ::testing::Invoke; @@ -42,7 +42,7 @@ class OwnershipServiceTest : public ::testing::Test { virtual ~OwnershipServiceTest() {} virtual void SetUp() { - base::OpenPersistentNSSDB(); // TODO(cmasone): use test DB instead + crypto::OpenPersistentNSSDB(); // TODO(cmasone): use test DB instead fake_private_key_.reset(RSAPrivateKey::Create(256)); ASSERT_TRUE(fake_private_key_->ExportPublicKey(&fake_public_key_)); diff --git a/chrome/browser/chromeos/login/parallel_authenticator.cc b/chrome/browser/chromeos/login/parallel_authenticator.cc index d2f9b84..e419059 100644 --- a/chrome/browser/chromeos/login/parallel_authenticator.cc +++ b/chrome/browser/chromeos/login/parallel_authenticator.cc @@ -11,11 +11,10 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/path_service.h" -#include "base/sha2.h" #include "base/string_util.h" #include "base/synchronization/lock.h" -#include "base/third_party/nss/blapi.h" -#include "base/third_party/nss/sha256.h" +#include "crypto/third_party/nss/blapi.h" +#include "crypto/third_party/nss/sha256.h" #include "chrome/browser/chromeos/cros/cryptohome_library.h" #include "chrome/browser/chromeos/login/auth_response_handler.h" #include "chrome/browser/chromeos/login/authentication_notification_details.h" diff --git a/chrome/browser/chromeos/login/signed_settings_unittest.cc b/chrome/browser/chromeos/login/signed_settings_unittest.cc index 6570cac..80f6815 100644 --- a/chrome/browser/chromeos/login/signed_settings_unittest.cc +++ b/chrome/browser/chromeos/login/signed_settings_unittest.cc @@ -7,7 +7,6 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/memory/scoped_temp_dir.h" -#include "base/nss_util.h" #include "base/stringprintf.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/mock_library_loader.h" @@ -18,6 +17,7 @@ #include "chrome/browser/policy/proto/device_management_backend.pb.h" #include "chrome/test/thread_test_helper.h" #include "content/browser/browser_thread.h" +#include "crypto/rsa_private_key.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -259,7 +259,7 @@ class SignedSettingsTest : public ::testing::Test { BrowserThread file_thread_; std::vector<uint8> fake_public_key_; - scoped_ptr<RSAPrivateKey> fake_private_key_; + scoped_ptr<crypto::RSAPrivateKey> fake_private_key_; MockKeyUtils* mock_; MockInjector injector_; diff --git a/chrome/browser/chromeos/login/user_manager.cc b/chrome/browser/chromeos/login/user_manager.cc index 671eaf4..1b71734 100644 --- a/chrome/browser/chromeos/login/user_manager.cc +++ b/chrome/browser/chromeos/login/user_manager.cc @@ -10,13 +10,13 @@ #include "base/file_util.h" #include "base/lazy_instance.h" #include "base/logging.h" -#include "base/nss_util.h" #include "base/path_service.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/time.h" #include "base/utf_string_conversions.h" #include "base/values.h" +#include "crypto/nss_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/cryptohome_library.h" @@ -567,14 +567,14 @@ void UserManager::NotifyOnLogin() { // Let the window manager know that we're logged in now. WmIpc::instance()->SetLoggedInProperty(true); // Ensure we've opened the real user's key/certificate database. - base::OpenPersistentNSSDB(); + crypto::OpenPersistentNSSDB(); // Only load the Opencryptoki library into NSS if we have this switch. // TODO(gspencer): Remove this switch once cryptohomed work is finished: // http://crosbug.com/12295 and http://crosbug.com/12304 if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kLoadOpencryptoki)) { - base::EnableTPMForNSS(); + crypto::EnableTPMForNSS(); } // Schedules current user ownership check on file thread. diff --git a/chrome/browser/download/base_file.cc b/chrome/browser/download/base_file.cc index 5f5a53b..d135191 100644 --- a/chrome/browser/download/base_file.cc +++ b/chrome/browser/download/base_file.cc @@ -4,11 +4,11 @@ #include "chrome/browser/download/base_file.h" -#include "base/crypto/secure_hash.h" #include "base/file_util.h" #include "base/format_macros.h" #include "base/logging.h" #include "base/stringprintf.h" +#include "crypto/secure_hash.h" #include "net/base/file_stream.h" #include "net/base/net_errors.h" #include "chrome/browser/download/download_util.h" @@ -52,7 +52,7 @@ bool BaseFile::Initialize(bool calculate_hash) { calculate_hash_ = calculate_hash; if (calculate_hash_) - secure_hash_.reset(base::SecureHash::Create(base::SecureHash::SHA256)); + secure_hash_.reset(crypto::SecureHash::Create(crypto::SecureHash::SHA256)); if (!full_path_.empty() || download_util::CreateTemporaryFileForDownload(&full_path_)) diff --git a/chrome/browser/download/base_file.h b/chrome/browser/download/base_file.h index fcbd2d9..f9a5c28 100644 --- a/chrome/browser/download/base_file.h +++ b/chrome/browser/download/base_file.h @@ -14,7 +14,7 @@ #include "chrome/browser/power_save_blocker.h" #include "googleurl/src/gurl.h" -namespace base { +namespace crypto { class SecureHash; } namespace net { @@ -94,7 +94,7 @@ class BaseFile { // Used to calculate sha256 hash for the file when calculate_hash_ // is set. - scoped_ptr<base::SecureHash> secure_hash_; + scoped_ptr<crypto::SecureHash> secure_hash_; unsigned char sha256_hash_[kSha256HashLen]; diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc index 7897476..8b0f6be 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -12,7 +12,6 @@ #include "base/file_path.h" #include "base/file_version_info_win.h" #include "base/metrics/histogram.h" -#include "base/sha2.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/time.h" @@ -21,6 +20,7 @@ #include "base/version.h" #include "base/win/registry.h" #include "base/win/scoped_handle.h" +#include "crypto/sha2.h" #include "chrome/browser/net/service_providers_win.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" @@ -262,7 +262,7 @@ static void GenerateHash(const std::string& input, std::string* output) { } uint8 hash[4]; - base::SHA256HashString(input, hash, sizeof(hash)); + crypto::SHA256HashString(input, hash, sizeof(hash)); *output = StringToLowerASCII(base::HexEncode(hash, sizeof(hash))); } diff --git a/chrome/browser/extensions/convert_user_script.cc b/chrome/browser/extensions/convert_user_script.cc index 3f89b74..e1f7e79 100644 --- a/chrome/browser/extensions/convert_user_script.cc +++ b/chrome/browser/extensions/convert_user_script.cc @@ -12,8 +12,8 @@ #include "base/file_util.h" #include "base/memory/scoped_temp_dir.h" #include "base/path_service.h" -#include "base/sha2.h" #include "base/string_util.h" +#include "crypto/sha2.h" #include "chrome/browser/extensions/user_script_master.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" @@ -72,10 +72,10 @@ scoped_refptr<Extension> ConvertUserScriptToExtension( // identity is its namespace+name, so we hash that to create a public key. // There will be no corresponding private key, which means user scripts cannot // be auto-updated, or claimed in the gallery. - char raw[base::SHA256_LENGTH] = {0}; + char raw[crypto::SHA256_LENGTH] = {0}; std::string key; - base::SHA256HashString(script_name, raw, base::SHA256_LENGTH); - base::Base64Encode(std::string(raw, base::SHA256_LENGTH), &key); + crypto::SHA256HashString(script_name, raw, crypto::SHA256_LENGTH); + base::Base64Encode(std::string(raw, crypto::SHA256_LENGTH), &key); // The script may not have a name field, but we need one for an extension. If // it is missing, use the filename of the original URL. diff --git a/chrome/browser/extensions/convert_web_app.cc b/chrome/browser/extensions/convert_web_app.cc index 27a0fc9..f3305a7 100644 --- a/chrome/browser/extensions/convert_web_app.cc +++ b/chrome/browser/extensions/convert_web_app.cc @@ -15,10 +15,10 @@ #include "base/logging.h" #include "base/memory/scoped_temp_dir.h" #include "base/path_service.h" -#include "base/sha2.h" #include "base/stringprintf.h" #include "base/time.h" #include "base/utf_string_conversions.h" +#include "crypto/sha2.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_constants.h" @@ -46,12 +46,12 @@ const char kIconsDirName[] = "icons"; // auto-updated using ExtensionUpdater. But Chrome does notice updates to the // manifest and regenerates these extensions. std::string GenerateKey(const GURL& manifest_url) { - char raw[base::SHA256_LENGTH] = {0}; + char raw[crypto::SHA256_LENGTH] = {0}; std::string key; - base::SHA256HashString(manifest_url.spec().c_str(), - raw, - base::SHA256_LENGTH); - base::Base64Encode(std::string(raw, base::SHA256_LENGTH), &key); + crypto::SHA256HashString(manifest_url.spec().c_str(), + raw, + crypto::SHA256_LENGTH); + base::Base64Encode(std::string(raw, crypto::SHA256_LENGTH), &key); return key; } diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index 4aa7d8c..2f4acf1 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -7,12 +7,12 @@ #include <vector> #include <string> -#include "base/crypto/rsa_private_key.h" -#include "base/crypto/signature_creator.h" #include "base/file_util.h" #include "base/memory/scoped_handle.h" #include "base/memory/scoped_temp_dir.h" #include "base/string_util.h" +#include "crypto/rsa_private_key.h" +#include "crypto/signature_creator.h" #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_file_util.h" @@ -74,7 +74,7 @@ bool ExtensionCreator::InitializeInput( return true; } -base::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath& +crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath& private_key_path) { if (!file_util::PathExists(private_key_path)) { error_message_ = @@ -98,14 +98,14 @@ base::RSAPrivateKey* ExtensionCreator::ReadInputKey(const FilePath& return NULL; } - return base::RSAPrivateKey::CreateFromPrivateKeyInfo( + return crypto::RSAPrivateKey::CreateFromPrivateKeyInfo( std::vector<uint8>(private_key_bytes.begin(), private_key_bytes.end())); } -base::RSAPrivateKey* ExtensionCreator::GenerateKey(const FilePath& +crypto::RSAPrivateKey* ExtensionCreator::GenerateKey(const FilePath& output_private_key_path) { - scoped_ptr<base::RSAPrivateKey> key_pair( - base::RSAPrivateKey::Create(kRSAKeySize)); + scoped_ptr<crypto::RSAPrivateKey> key_pair( + crypto::RSAPrivateKey::Create(kRSAKeySize)); if (!key_pair.get()) { error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_FAILED_TO_GENERATE); @@ -163,10 +163,10 @@ bool ExtensionCreator::CreateZip(const FilePath& extension_dir, } bool ExtensionCreator::SignZip(const FilePath& zip_path, - base::RSAPrivateKey* private_key, + crypto::RSAPrivateKey* private_key, std::vector<uint8>* signature) { - scoped_ptr<base::SignatureCreator> signature_creator( - base::SignatureCreator::Create(private_key)); + scoped_ptr<crypto::SignatureCreator> signature_creator( + crypto::SignatureCreator::Create(private_key)); ScopedStdioHandle zip_handle(file_util::OpenFile(zip_path, "rb")); size_t buffer_size = 1 << 16; scoped_array<uint8> buffer(new uint8[buffer_size]); @@ -186,7 +186,7 @@ bool ExtensionCreator::SignZip(const FilePath& zip_path, } bool ExtensionCreator::WriteCRX(const FilePath& zip_path, - base::RSAPrivateKey* private_key, + crypto::RSAPrivateKey* private_key, const std::vector<uint8>& signature, const FilePath& crx_path) { if (file_util::PathExists(crx_path)) @@ -246,7 +246,7 @@ bool ExtensionCreator::Run(const FilePath& extension_dir, } // Initialize Key Pair - scoped_ptr<base::RSAPrivateKey> key_pair; + scoped_ptr<crypto::RSAPrivateKey> key_pair; if (!private_key_path.value().empty()) key_pair.reset(ReadInputKey(private_key_path)); else diff --git a/chrome/browser/extensions/extension_creator.h b/chrome/browser/extensions/extension_creator.h index 6235584..0499821 100644 --- a/chrome/browser/extensions/extension_creator.h +++ b/chrome/browser/extensions/extension_creator.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,7 @@ #include "base/basictypes.h" -namespace base { +namespace crypto { class RSAPrivateKey; } @@ -45,11 +45,11 @@ class ExtensionCreator { const FilePath& private_key_output_path); // Reads private key from |private_key_path|. - base::RSAPrivateKey* ReadInputKey(const FilePath& private_key_path); + crypto::RSAPrivateKey* ReadInputKey(const FilePath& private_key_path); // Generates a key pair and writes the private key to |private_key_path| // if provided. - base::RSAPrivateKey* GenerateKey(const FilePath& private_key_path); + crypto::RSAPrivateKey* GenerateKey(const FilePath& private_key_path); // Creates temporary zip file for the extension. bool CreateZip(const FilePath& extension_dir, const FilePath& temp_path, @@ -57,12 +57,12 @@ class ExtensionCreator { // Signs the temporary zip and returns the signature. bool SignZip(const FilePath& zip_path, - base::RSAPrivateKey* private_key, + crypto::RSAPrivateKey* private_key, std::vector<uint8>* signature); // Export installable .crx to |crx_path|. bool WriteCRX(const FilePath& zip_path, - base::RSAPrivateKey* private_key, + crypto::RSAPrivateKey* private_key, const std::vector<uint8>& signature, const FilePath& crx_path); diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index 5aeeab6..ca05574 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -12,7 +12,6 @@ #include "base/file_util.h" #include "base/metrics/histogram.h" #include "base/rand_util.h" -#include "base/sha2.h" #include "base/stl_util-inl.h" #include "base/string_number_conversions.h" #include "base/string_split.h" @@ -20,6 +19,7 @@ #include "base/time.h" #include "base/threading/thread.h" #include "base/version.h" +#include "crypto/sha2.h" #include "content/common/notification_service.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extension_error_reporter.h" @@ -787,10 +787,10 @@ void ExtensionUpdater::HandleManifestResults( void ExtensionUpdater::ProcessBlacklist(const std::string& data) { DCHECK(alive_); // Verify sha256 hash value. - char sha256_hash_value[base::SHA256_LENGTH]; - base::SHA256HashString(data, sha256_hash_value, base::SHA256_LENGTH); + char sha256_hash_value[crypto::SHA256_LENGTH]; + crypto::SHA256HashString(data, sha256_hash_value, crypto::SHA256_LENGTH); std::string hash_in_hex = base::HexEncode(sha256_hash_value, - base::SHA256_LENGTH); + crypto::SHA256_LENGTH); if (current_extension_fetch_.package_hash != hash_in_hex) { NOTREACHED() << "Fetched blacklist checksum is not as expected. " diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc index 8aead47..3cb5173 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc @@ -7,7 +7,6 @@ #include <set> #include "base/base64.h" -#include "base/crypto/signature_verifier.h" #include "base/file_util.h" #include "base/file_util_proxy.h" #include "base/memory/scoped_handle.h" @@ -16,6 +15,7 @@ #include "base/path_service.h" #include "base/task.h" #include "base/utf_string_conversions.h" // TODO(viettrungluu): delete me. +#include "crypto/signature_verifier.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" @@ -367,7 +367,7 @@ bool SandboxedExtensionUnpacker::ValidateSignature() { return false; } - base::SignatureVerifier verifier; + crypto::SignatureVerifier verifier; if (!verifier.VerifyInit(extension_misc::kSignatureAlgorithm, sizeof(extension_misc::kSignatureAlgorithm), &signature.front(), diff --git a/chrome/browser/importer/nss_decryptor_system_nss.cc b/chrome/browser/importer/nss_decryptor_system_nss.cc index 58ce34e..f51a777 100644 --- a/chrome/browser/importer/nss_decryptor_system_nss.cc +++ b/chrome/browser/importer/nss_decryptor_system_nss.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,9 +9,9 @@ #include "base/basictypes.h" #include "base/file_path.h" -#include "base/nss_util.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" +#include "crypto/nss_util.h" NSSDecryptor::NSSDecryptor() : is_nss_initialized_(false), db_slot_(NULL) {} NSSDecryptor::~NSSDecryptor() { @@ -25,7 +25,7 @@ NSSDecryptor::~NSSDecryptor() { } bool NSSDecryptor::Init(const FilePath& dll_path, const FilePath& db_path) { - base::EnsureNSSInit(); + crypto::EnsureNSSInit(); is_nss_initialized_ = true; const std::string modspec = StringPrintf("configDir='%s' tokenDescription='Firefox NSS database' " diff --git a/chrome/browser/password_manager/encryptor_linux.cc b/chrome/browser/password_manager/encryptor_linux.cc index 5da8fd8..9cdbb10 100644 --- a/chrome/browser/password_manager/encryptor_linux.cc +++ b/chrome/browser/password_manager/encryptor_linux.cc @@ -4,11 +4,11 @@ #include "chrome/browser/password_manager/encryptor.h" -#include "base/crypto/encryptor.h" -#include "base/crypto/symmetric_key.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/utf_string_conversions.h" +#include "crypto/encryptor.h" +#include "crypto/symmetric_key.h" namespace { @@ -32,7 +32,7 @@ const char kObfuscationPrefix[] = "v10"; // Generates a newly allocated SymmetricKey object based a hard-coded password. // Ownership of the key is passed to the caller. Returns NULL key if a key // generation error occurs. -base::SymmetricKey* GetEncryptionKey() { +crypto::SymmetricKey* GetEncryptionKey() { // We currently "obfuscate" by encrypting and decrypting with hard-coded // password. We need to improve this password situation by moving a secure // password into a system-level key store. @@ -41,12 +41,12 @@ base::SymmetricKey* GetEncryptionKey() { std::string salt(kSalt); // Create an encryption key from our password and salt. - scoped_ptr<base::SymmetricKey> encryption_key( - base::SymmetricKey::DeriveKeyFromPassword(base::SymmetricKey::AES, - password, - salt, - kEncryptionIterations, - kDerivedKeySizeInBits)); + scoped_ptr<crypto::SymmetricKey> encryption_key( + crypto::SymmetricKey::DeriveKeyFromPassword(crypto::SymmetricKey::AES, + password, + salt, + kEncryptionIterations, + kDerivedKeySizeInBits)); DCHECK(encryption_key.get()); return encryption_key.release(); @@ -81,13 +81,13 @@ bool Encryptor::EncryptString(const std::string& plaintext, return true; } - scoped_ptr<base::SymmetricKey> encryption_key(GetEncryptionKey()); + scoped_ptr<crypto::SymmetricKey> encryption_key(GetEncryptionKey()); if (!encryption_key.get()) return false; std::string iv(kIVBlockSizeAES128, ' '); - base::Encryptor encryptor; - if (!encryptor.Init(encryption_key.get(), base::Encryptor::CBC, iv)) + crypto::Encryptor encryptor; + if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv)) return false; if (!encryptor.Encrypt(plaintext, ciphertext)) @@ -123,13 +123,13 @@ bool Encryptor::DecryptString(const std::string& ciphertext, // Strip off the versioning prefix before decrypting. std::string raw_ciphertext = ciphertext.substr(strlen(kObfuscationPrefix)); - scoped_ptr<base::SymmetricKey> encryption_key(GetEncryptionKey()); + scoped_ptr<crypto::SymmetricKey> encryption_key(GetEncryptionKey()); if (!encryption_key.get()) return false; std::string iv(kIVBlockSizeAES128, ' '); - base::Encryptor encryptor; - if (!encryptor.Init(encryption_key.get(), base::Encryptor::CBC, iv)) + crypto::Encryptor encryptor; + if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv)) return false; if (!encryptor.Decrypt(raw_ciphertext, plaintext)) diff --git a/chrome/browser/password_manager/encryptor_mac.mm b/chrome/browser/password_manager/encryptor_mac.mm index a2d9f1c..56b048c 100644 --- a/chrome/browser/password_manager/encryptor_mac.mm +++ b/chrome/browser/password_manager/encryptor_mac.mm @@ -6,11 +6,11 @@ #include <CommonCrypto/CommonCryptor.h> // for kCCBlockSizeAES128 -#include "base/crypto/encryptor.h" -#include "base/crypto/symmetric_key.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/utf_string_conversions.h" +#include "crypto/encryptor.h" +#include "crypto/symmetric_key.h" #include "chrome/browser/password_manager/encryptor_password_mac.h" #include "chrome/browser/keychain_mac.h" @@ -37,7 +37,7 @@ const char kEncryptionVersionPrefix[] = "v10"; // in the Keychain. The generated key is for AES encryption. Ownership of the // key is passed to the caller. Returns NULL key in the case password access // is denied or key generation error occurs. -base::SymmetricKey* GetEncryptionKey() { +crypto::SymmetricKey* GetEncryptionKey() { std::string password; if (use_mock_keychain) { @@ -54,12 +54,12 @@ base::SymmetricKey* GetEncryptionKey() { std::string salt(kSalt); // Create an encryption key from our password and salt. - scoped_ptr<base::SymmetricKey> encryption_key( - base::SymmetricKey::DeriveKeyFromPassword(base::SymmetricKey::AES, - password, - salt, - kEncryptionIterations, - kDerivedKeySizeInBits)); + scoped_ptr<crypto::SymmetricKey> encryption_key( + crypto::SymmetricKey::DeriveKeyFromPassword(crypto::SymmetricKey::AES, + password, + salt, + kEncryptionIterations, + kDerivedKeySizeInBits)); DCHECK(encryption_key.get()); return encryption_key.release(); @@ -89,13 +89,13 @@ bool Encryptor::EncryptString(const std::string& plaintext, return true; } - scoped_ptr<base::SymmetricKey> encryption_key(GetEncryptionKey()); + scoped_ptr<crypto::SymmetricKey> encryption_key(GetEncryptionKey()); if (!encryption_key.get()) return false; std::string iv(kCCBlockSizeAES128, ' '); - base::Encryptor encryptor; - if (!encryptor.Init(encryption_key.get(), base::Encryptor::CBC, iv)) + crypto::Encryptor encryptor; + if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv)) return false; if (!encryptor.Encrypt(plaintext, ciphertext)) @@ -127,13 +127,13 @@ bool Encryptor::DecryptString(const std::string& ciphertext, std::string raw_ciphertext = ciphertext.substr(strlen(kEncryptionVersionPrefix)); - scoped_ptr<base::SymmetricKey> encryption_key(GetEncryptionKey()); + scoped_ptr<crypto::SymmetricKey> encryption_key(GetEncryptionKey()); if (!encryption_key.get()) return false; std::string iv(kCCBlockSizeAES128, ' '); - base::Encryptor encryptor; - if (!encryptor.Init(encryption_key.get(), base::Encryptor::CBC, iv)) + crypto::Encryptor encryptor; + if (!encryptor.Init(encryption_key.get(), crypto::Encryptor::CBC, iv)) return false; if (!encryptor.Decrypt(raw_ciphertext, plaintext)) diff --git a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc index 3548806..e69a59d 100644 --- a/chrome/browser/safe_browsing/filter_false_positive_perftest.cc +++ b/chrome/browser/safe_browsing/filter_false_positive_perftest.cc @@ -64,10 +64,10 @@ #include "base/memory/scoped_ptr.h" #include "base/path_service.h" #include "base/rand_util.h" -#include "base/sha2.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/time.h" +#include "crypto/sha2.h" #include "chrome/browser/safe_browsing/bloom_filter.h" #include "chrome/browser/safe_browsing/safe_browsing_util.h" #include "chrome/common/chrome_paths.h" @@ -176,7 +176,7 @@ int GeneratePrefixHits(const std::string url, for (size_t i = 0; i < hosts.size(); ++i) { for (size_t j = 0; j < paths.size(); ++j) { SBPrefix prefix; - base::SHA256HashString(hosts[i] + paths[j], &prefix, sizeof(prefix)); + crypto::SHA256HashString(hosts[i] + paths[j], &prefix, sizeof(prefix)); if (bloom_filter->Exists(prefix)) prefixes->push_back(prefix); } diff --git a/chrome/browser/safe_browsing/safe_browsing_database.cc b/chrome/browser/safe_browsing/safe_browsing_database.cc index ecc208c..0f979d4 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database.cc @@ -13,7 +13,7 @@ #include "base/time.h" #include "base/message_loop.h" #include "base/process_util.h" -#include "base/sha2.h" +#include "crypto/sha2.h" #include "chrome/browser/safe_browsing/bloom_filter.h" #include "chrome/browser/safe_browsing/prefix_set.h" #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" @@ -71,8 +71,8 @@ void GetDownloadUrlPrefix(const GURL& url, SBPrefix* prefix) { safe_browsing_util::CanonicalizeUrl(url, &hostname, &path, &query); SBFullHash full_hash; - base::SHA256HashString(hostname + path + query, &full_hash, - sizeof(full_hash)); + crypto::SHA256HashString(hostname + path + query, &full_hash, + sizeof(full_hash)); *prefix = full_hash.prefix; } @@ -103,8 +103,8 @@ void BrowseFullHashesToCheck(const GURL& url, for (size_t j = 0; j < paths.size(); ++j) { const std::string& path = paths[j]; SBFullHash full_hash; - base::SHA256HashString(hosts[i] + path, &full_hash, - sizeof(full_hash)); + crypto::SHA256HashString(hosts[i] + path, &full_hash, + sizeof(full_hash)); full_hashes->push_back(full_hash); // We may have /foo as path-prefix in the whitelist which should @@ -113,8 +113,8 @@ void BrowseFullHashesToCheck(const GURL& url, if (include_whitelist_hashes && path.size() > 1 && path[path.size() - 1] == '/') { - base::SHA256HashString(hosts[i] + path.substr(0, path.size() - 1), - &full_hash, sizeof(full_hash)); + crypto::SHA256HashString(hosts[i] + path.substr(0, path.size() - 1), + &full_hash, sizeof(full_hash)); full_hashes->push_back(full_hash); } } @@ -1297,7 +1297,8 @@ void SafeBrowsingDatabaseNew::LoadCsdWhitelist( std::sort(new_csd_whitelist.begin(), new_csd_whitelist.end()); SBFullHash kill_switch; - base::SHA256HashString(kCsdKillSwitchUrl, &kill_switch, sizeof(kill_switch)); + crypto::SHA256HashString(kCsdKillSwitchUrl, &kill_switch, + sizeof(kill_switch)); if (std::binary_search(new_csd_whitelist.begin(), new_csd_whitelist.end(), kill_switch)) { // The kill switch is whitelisted hence we whitelist all URLs. diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc index 5af27d1..11ea60c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc @@ -10,8 +10,8 @@ #include "base/logging.h" #include "base/memory/scoped_temp_dir.h" #include "base/message_loop.h" -#include "base/sha2.h" #include "base/time.h" +#include "crypto/sha2.h" #include "chrome/browser/safe_browsing/safe_browsing_database.h" #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" #include "chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h" @@ -26,13 +26,13 @@ namespace { SBPrefix Sha256Prefix(const std::string& str) { SBPrefix prefix; - base::SHA256HashString(str, &prefix, sizeof(prefix)); + crypto::SHA256HashString(str, &prefix, sizeof(prefix)); return prefix; } SBFullHash Sha256Hash(const std::string& str) { SBFullHash hash; - base::SHA256HashString(str, &hash, sizeof(hash)); + crypto::SHA256HashString(str, &hash, sizeof(hash)); return hash; } diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index 5434a53..8abecac 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc @@ -9,7 +9,7 @@ #include "base/command_line.h" #include "base/memory/ref_counted.h" #include "base/metrics/histogram.h" -#include "base/sha2.h" +#include "crypto/sha2.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/safe_browsing/safe_browsing_database.h" #include "chrome/browser/safe_browsing/safe_browsing_service.h" @@ -256,8 +256,8 @@ class SafeBrowsingServiceTest : public InProcessBrowserTest { std::string host; std::string path; safe_browsing_util::CanonicalizeUrl(url, &host, &path, NULL); - base::SHA256HashString(host + path, &full_hash->hash, - sizeof(SBFullHash)); + crypto::SHA256HashString(host + path, &full_hash->hash, + sizeof(SBFullHash)); full_hash->list_name = list_name; full_hash->add_chunk_id = add_chunk_id; } diff --git a/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h b/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h index 5fa8ece..0868531 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h +++ b/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,7 +8,7 @@ #include "chrome/browser/safe_browsing/safe_browsing_store.h" -#include "base/sha2.h" +#include "crypto/sha2.h" #include "testing/gtest/include/gtest/gtest.h" // Helper code for testing that a SafeBrowsingStore implementation @@ -17,7 +17,7 @@ // Helper to make it easy to initialize SBFullHash constants. inline const SBFullHash SBFullHashFromString(const char* str) { SBFullHash h; - base::SHA256HashString(str, &h.full_hash, sizeof(h.full_hash)); + crypto::SHA256HashString(str, &h.full_hash, sizeof(h.full_hash)); return h; } diff --git a/chrome/browser/safe_browsing/safe_browsing_util.cc b/chrome/browser/safe_browsing/safe_browsing_util.cc index d42ba79..427b9c7 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util.cc +++ b/chrome/browser/safe_browsing/safe_browsing_util.cc @@ -1,13 +1,13 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/safe_browsing/safe_browsing_util.h" #include "base/base64.h" -#include "base/hmac.h" -#include "base/sha2.h" #include "base/string_util.h" +#include "crypto/hmac.h" +#include "crypto/sha2.h" #include "chrome/browser/google/google_util.h" #include "googleurl/src/gurl.h" #include "googleurl/src/url_util.h" @@ -436,9 +436,9 @@ int GetUrlHashIndex(const GURL& url, for (size_t h = 0; h < hosts.size(); ++h) { for (size_t p = 0; p < paths.size(); ++p) { SBFullHash key; - base::SHA256HashString(hosts[h] + paths[p], - key.full_hash, - sizeof(SBFullHash)); + crypto::SHA256HashString(hosts[h] + paths[p], + key.full_hash, + sizeof(SBFullHash)); int index = GetHashIndex(key, full_hashes); if (index != -1) return index; } @@ -485,7 +485,7 @@ bool VerifyMAC(const std::string& key, const std::string& mac, std::string decoded_mac; base::Base64Decode(mac_copy, &decoded_mac); - base::HMAC hmac(base::HMAC::SHA1); + crypto::HMAC hmac(crypto::HMAC::SHA1); if (!hmac.Init(decoded_key)) return false; const std::string data_str(data, data_length); @@ -520,12 +520,12 @@ GURL GeneratePhishingReportUrl(const std::string& report_page, } void StringToSBFullHash(const std::string& hash_in, SBFullHash* hash_out) { - DCHECK_EQ(static_cast<size_t>(base::SHA256_LENGTH), hash_in.size()); - memcpy(hash_out->full_hash, hash_in.data(), base::SHA256_LENGTH); + DCHECK_EQ(static_cast<size_t>(crypto::SHA256_LENGTH), hash_in.size()); + memcpy(hash_out->full_hash, hash_in.data(), crypto::SHA256_LENGTH); } std::string SBFullHashToString(const SBFullHash& hash) { - DCHECK_EQ(static_cast<size_t>(base::SHA256_LENGTH), sizeof(hash.full_hash)); + DCHECK_EQ(static_cast<size_t>(crypto::SHA256_LENGTH), sizeof(hash.full_hash)); return std::string(hash.full_hash, sizeof(hash.full_hash)); } } // namespace safe_browsing_util diff --git a/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc index 0cc0b3b..be20d31 100644 --- a/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_util_unittest.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <algorithm> -#include "base/sha2.h" #include "base/string_util.h" +#include "crypto/sha2.h" #include "chrome/browser/safe_browsing/safe_browsing_util.h" #include "googleurl/src/gurl.h" #include "testing/gtest/include/gtest/gtest.h" @@ -283,7 +283,7 @@ TEST(SafeBrowsingUtilTest, CanonicalizeUrl) { TEST(SafeBrowsingUtilTest, GetUrlHashIndex) { GURL url("http://www.evil.com/phish.html"); SBFullHashResult full_hash; - base::SHA256HashString(url.host() + url.path(), + crypto::SHA256HashString(url.host() + url.path(), &full_hash.hash, sizeof(SBFullHash)); std::vector<SBFullHashResult> full_hashes; diff --git a/chrome/browser/sync/util/nigori.cc b/chrome/browser/sync/util/nigori.cc index 51f767b..cc17499 100644 --- a/chrome/browser/sync/util/nigori.cc +++ b/chrome/browser/sync/util/nigori.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -14,18 +14,18 @@ #include <vector> #include "base/base64.h" -#include "base/crypto/encryptor.h" -#include "base/hmac.h" #include "base/logging.h" #include "base/rand_util.h" #include "base/string_util.h" +#include "crypto/encryptor.h" +#include "crypto/hmac.h" using base::Base64Encode; using base::Base64Decode; -using base::Encryptor; -using base::HMAC; using base::RandInt; -using base::SymmetricKey; +using crypto::Encryptor; +using crypto::HMAC; +using crypto::SymmetricKey; namespace browser_sync { diff --git a/chrome/browser/sync/util/nigori.h b/chrome/browser/sync/util/nigori.h index 4aeb767..74fd6ec 100644 --- a/chrome/browser/sync/util/nigori.h +++ b/chrome/browser/sync/util/nigori.h @@ -8,8 +8,8 @@ #include <string> -#include "base/crypto/symmetric_key.h" #include "base/memory/scoped_ptr.h" +#include "crypto/symmetric_key.h" namespace browser_sync { @@ -73,9 +73,9 @@ class Nigori { static const size_t kSigningIterations = 1004; private: - scoped_ptr<base::SymmetricKey> user_key_; - scoped_ptr<base::SymmetricKey> encryption_key_; - scoped_ptr<base::SymmetricKey> mac_key_; + scoped_ptr<crypto::SymmetricKey> user_key_; + scoped_ptr<crypto::SymmetricKey> encryption_key_; + scoped_ptr<crypto::SymmetricKey> mac_key_; }; } // namespace browser_sync diff --git a/chrome/browser/ui/crypto_module_password_dialog.h b/chrome/browser/ui/crypto_module_password_dialog.h index ec8ba07..c1e70d7 100644 --- a/chrome/browser/ui/crypto_module_password_dialog.h +++ b/chrome/browser/ui/crypto_module_password_dialog.h @@ -12,7 +12,7 @@ #include "base/callback.h" #include "base/memory/ref_counted.h" -namespace base { +namespace crypto { class CryptoModuleBlockingPasswordDelegate; } @@ -48,7 +48,7 @@ void ShowCryptoModulePasswordDialog(const std::string& module_name, // Returns a CryptoModuleBlockingPasswordDelegate to open a dialog and block // until returning. Should only be used on a worker thread. -base::CryptoModuleBlockingPasswordDelegate* +crypto::CryptoModuleBlockingPasswordDelegate* NewCryptoModuleBlockingDialogDelegate( CryptoModulePasswordReason reason, const std::string& server); diff --git a/chrome/browser/ui/crypto_module_password_dialog_nss.cc b/chrome/browser/ui/crypto_module_password_dialog_nss.cc index 2727868..0932904 100644 --- a/chrome/browser/ui/crypto_module_password_dialog_nss.cc +++ b/chrome/browser/ui/crypto_module_password_dialog_nss.cc @@ -12,7 +12,7 @@ #include "net/base/x509_certificate.h" #if defined(OS_CHROMEOS) -#include "base/nss_util.h" +#include "crypto/nss_util.h" #endif namespace { @@ -66,11 +66,11 @@ void SlotUnlocker::Start() { for (; current_ < modules_.size(); ++current_) { if (ShouldShowDialog(modules_[current_].get())) { #if defined(OS_CHROMEOS) - if (modules_[current_]->GetTokenName() == base::GetTPMTokenName()) { + if (modules_[current_]->GetTokenName() == crypto::GetTPMTokenName()) { // The user PIN is a well known secret on this machine, and // the user didn't set it, so we need to fetch the value and // supply it for them here. - GotPassword(base::GetTPMUserPIN().c_str()); + GotPassword(crypto::GetTPMUserPIN().c_str()); return; } #endif diff --git a/chrome/browser/ui/gtk/certificate_viewer.cc b/chrome/browser/ui/gtk/certificate_viewer.cc index ff7f4a7..1a1a8fe 100644 --- a/chrome/browser/ui/gtk/certificate_viewer.cc +++ b/chrome/browser/ui/gtk/certificate_viewer.cc @@ -11,7 +11,6 @@ #include "base/i18n/time_formatting.h" #include "base/memory/scoped_ptr.h" -#include "base/nss_util.h" #include "base/string_number_conversions.h" #include "base/time.h" #include "base/utf_string_conversions.h" diff --git a/chrome/browser/ui/gtk/crypto_module_password_dialog.cc b/chrome/browser/ui/gtk/crypto_module_password_dialog.cc index 2abe3f9..31f07ce 100644 --- a/chrome/browser/ui/gtk/crypto_module_password_dialog.cc +++ b/chrome/browser/ui/gtk/crypto_module_password_dialog.cc @@ -7,10 +7,10 @@ #include <gtk/gtk.h> #include "base/basictypes.h" -#include "base/crypto/crypto_module_blocking_password_delegate.h" #include "base/synchronization/waitable_event.h" #include "base/task.h" #include "base/utf_string_conversions.h" +#include "crypto/crypto_module_blocking_password_delegate.h" #include "chrome/browser/ui/gtk/gtk_util.h" #include "content/browser/browser_thread.h" #include "googleurl/src/gurl.h" @@ -21,7 +21,7 @@ namespace { class CryptoModuleBlockingDialogDelegate - : public base::CryptoModuleBlockingPasswordDelegate { + : public crypto::CryptoModuleBlockingPasswordDelegate { public: CryptoModuleBlockingDialogDelegate(browser::CryptoModulePasswordReason reason, const std::string& server) @@ -36,7 +36,7 @@ class CryptoModuleBlockingDialogDelegate password_.replace(0, password_.size(), password_.size(), 0); } - // base::CryptoModuleBlockingDialogDelegate implementation. + // crypto::CryptoModuleBlockingDialogDelegate implementation. virtual std::string RequestPassword(const std::string& slot_name, bool retry, bool* cancelled) { DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); @@ -220,7 +220,7 @@ void ShowCryptoModulePasswordDialog(const std::string& slot_name, callback))->Show(); } -base::CryptoModuleBlockingPasswordDelegate* +crypto::CryptoModuleBlockingPasswordDelegate* NewCryptoModuleBlockingDialogDelegate( CryptoModulePasswordReason reason, const std::string& server) { diff --git a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc index 56a7e2a..76dedf3 100644 --- a/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc +++ b/chrome/browser/ui/gtk/ssl_client_certificate_selector.cc @@ -11,7 +11,6 @@ #include "base/i18n/time_formatting.h" #include "base/logging.h" -#include "base/nss_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/ssl/ssl_client_auth_handler.h" #include "chrome/browser/ui/crypto_module_password_dialog.h" diff --git a/chrome/browser/ui/webui/options/certificate_manager_handler.cc b/chrome/browser/ui/webui/options/certificate_manager_handler.cc index b785c77..180201b 100644 --- a/chrome/browser/ui/webui/options/certificate_manager_handler.cc +++ b/chrome/browser/ui/webui/options/certificate_manager_handler.cc @@ -6,7 +6,6 @@ #include "base/file_util.h" // for FileAccessProvider #include "base/memory/scoped_vector.h" -#include "base/nss_util.h" #include "base/safe_strerror_posix.h" #include "base/string_number_conversions.h" #include "base/values.h" |