diff options
Diffstat (limited to 'chromium/components/password_manager/core/browser/password_manager_util.cc')
-rw-r--r-- | chromium/components/password_manager/core/browser/password_manager_util.cc | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/chromium/components/password_manager/core/browser/password_manager_util.cc b/chromium/components/password_manager/core/browser/password_manager_util.cc index 837afe8f4e0..3cccd72398c 100644 --- a/chromium/components/password_manager/core/browser/password_manager_util.cc +++ b/chromium/components/password_manager/core/browser/password_manager_util.cc @@ -16,8 +16,6 @@ #include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/common/password_manager_features.h" #include "components/sync/driver/sync_service.h" -#include "crypto/openssl_util.h" -#include "third_party/boringssl/src/include/openssl/evp.h" namespace password_manager_util { @@ -90,40 +88,6 @@ bool IsLoggingActive(const password_manager::PasswordManagerClient* client) { return log_manager && log_manager->IsLoggingActive(); } -uint64_t CalculateSyncPasswordHash(const base::StringPiece16& text, - const std::string& salt) { - crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE); - constexpr size_t kBytesFromHash = 8; - constexpr uint64_t kScryptCost = 32; // It must be power of 2. - constexpr uint64_t kScryptBlockSize = 8; - constexpr uint64_t kScryptParallelization = 1; - constexpr size_t kScryptMaxMemory = 1024 * 1024; - - uint8_t hash[kBytesFromHash]; - base::StringPiece text_8bits(reinterpret_cast<const char*>(text.data()), - text.size() * 2); - const uint8_t* salt_ptr = reinterpret_cast<const uint8_t*>(salt.c_str()); - - int scrypt_ok = EVP_PBE_scrypt(text_8bits.data(), text_8bits.size(), salt_ptr, - salt.size(), kScryptCost, kScryptBlockSize, - kScryptParallelization, kScryptMaxMemory, hash, - kBytesFromHash); - - // EVP_PBE_scrypt can only fail due to memory allocation error (which aborts - // Chromium) or invalid parameters. In case of a failure a hash could leak - // information from the stack, so using CHECK is better than DCHECK. - CHECK(scrypt_ok); - - // Take 37 bits of |hash|. - uint64_t hash37 = ((static_cast<uint64_t>(hash[0]))) | - ((static_cast<uint64_t>(hash[1])) << 8) | - ((static_cast<uint64_t>(hash[2])) << 16) | - ((static_cast<uint64_t>(hash[3])) << 24) | - (((static_cast<uint64_t>(hash[4])) & 0x1F) << 32); - - return hash37; -} - bool ManualPasswordGenerationEnabled(syncer::SyncService* sync_service) { if (!(base::FeatureList::IsEnabled( password_manager::features::kEnableManualPasswordGeneration) && |