Index: chrome/browser/download/base_file.cc |
diff --git a/chrome/browser/download/base_file.cc b/chrome/browser/download/base_file.cc |
index 4085f601df06db49ae89328452e2857960082601..3bf1987b62f7d5d52fdcfb280f722fdf440b503f 100644 |
--- a/chrome/browser/download/base_file.cc |
+++ b/chrome/browser/download/base_file.cc |
@@ -6,9 +6,8 @@ |
#include "base/file_util.h" |
#include "base/logging.h" |
+#include "base/sha2.h" |
#include "base/stringprintf.h" |
-#include "base/third_party/nss/blapi.h" |
-#include "base/third_party/nss/sha256.h" |
#include "net/base/file_stream.h" |
#include "net/base/net_errors.h" |
#include "chrome/browser/browser_thread.h" |
@@ -50,10 +49,8 @@ bool BaseFile::Initialize(bool calculate_hash) { |
calculate_hash_ = calculate_hash; |
- if (calculate_hash_) { |
- sha_context_.reset(new SHA256Context); |
- SHA256_Begin(sha_context_.get()); |
- } |
+ if (calculate_hash_) |
+ sha_context_.reset(base::SHA256Context::Create()); |
if (!full_path_.empty() || |
download_util::CreateTemporaryFileForDownload(&full_path_)) |
@@ -78,11 +75,8 @@ bool BaseFile::AppendDataToFile(const char* data, size_t data_len) { |
if (written != data_len) |
return false; |
- if (calculate_hash_) { |
- SHA256_Update(sha_context_.get(), |
- reinterpret_cast<const unsigned char*>(data), |
- data_len); |
- } |
+ if (calculate_hash_) |
+ sha_context_->Update(std::string(data, data_len)); |
return true; |
} |
@@ -162,7 +156,7 @@ void BaseFile::Finish() { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
if (calculate_hash_) |
- SHA256_End(sha_context_.get(), sha256_hash_, NULL, kSha256HashLen); |
+ sha_context_->Finish(sha256_hash_, kSha256HashLen); |
Close(); |
} |