From ca225b4bb17ca2b440a7ac7c6b4a74dfb5201a44 Mon Sep 17 00:00:00 2001 From: "bulach@chromium.org" Date: Fri, 28 Jan 2011 15:41:37 +0000 Subject: Renames secure_hash.cc to secure_hash_default.cc BUG=none TEST=none Review URL: http://codereview.chromium.org/6395006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72963 0039d316-1c4b-4281-b951-d872f2087c98 --- base/base.gypi | 4 ++-- base/crypto/secure_hash.cc | 49 -------------------------------------- base/crypto/secure_hash_default.cc | 49 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 51 deletions(-) delete mode 100644 base/crypto/secure_hash.cc create mode 100644 base/crypto/secure_hash_default.cc (limited to 'base') diff --git a/base/base.gypi b/base/base.gypi index 1081a1f..4fde090 100644 --- a/base/base.gypi +++ b/base/base.gypi @@ -524,7 +524,7 @@ 'sources!': [ 'crypto/encryptor_nss.cc', 'crypto/rsa_private_key_nss.cc', - 'crypto/secure_hash.cc', + 'crypto/secure_hash_default.cc', 'crypto/signature_creator_nss.cc', 'crypto/signature_verifier_nss.cc', 'crypto/symmetric_key_nss.cc', @@ -573,7 +573,7 @@ 'crypto/rsa_private_key_openssl.cc', 'crypto/rsa_private_key_win.cc', 'crypto/secure_hash.h', - 'crypto/secure_hash.cc', + 'crypto/secure_hash_default.cc', 'crypto/secure_hash_openssl.cc', 'crypto/signature_creator.h', 'crypto/signature_creator_mac.cc', diff --git a/base/crypto/secure_hash.cc b/base/crypto/secure_hash.cc deleted file mode 100644 index 436867e..0000000 --- a/base/crypto/secure_hash.cc +++ /dev/null @@ -1,49 +0,0 @@ -// 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 "base/crypto/secure_hash.h" - -#include "base/logging.h" -#include "base/third_party/nss/blapi.h" -#include "base/third_party/nss/sha256.h" - -namespace base { - -namespace { - -class SecureHashSHA256NSS : public SecureHash { - public: - SecureHashSHA256NSS() { - SHA256_Begin(&ctx_); - } - - virtual ~SecureHashSHA256NSS() { - } - - virtual void Update(const void* input, size_t len) { - SHA256_Update(&ctx_, static_cast(input), len); - } - - virtual void Finish(void* output, size_t len) { - SHA256_End(&ctx_, static_cast(output), NULL, - static_cast(len)); - } - - private: - SHA256Context ctx_; -}; - -} // namespace - -SecureHash* SecureHash::Create(Algorithm algorithm) { - switch (algorithm) { - case SHA256: - return new SecureHashSHA256NSS(); - default: - NOTIMPLEMENTED(); - return NULL; - } -} - -} // namespace base diff --git a/base/crypto/secure_hash_default.cc b/base/crypto/secure_hash_default.cc new file mode 100644 index 0000000..436867e --- /dev/null +++ b/base/crypto/secure_hash_default.cc @@ -0,0 +1,49 @@ +// 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 "base/crypto/secure_hash.h" + +#include "base/logging.h" +#include "base/third_party/nss/blapi.h" +#include "base/third_party/nss/sha256.h" + +namespace base { + +namespace { + +class SecureHashSHA256NSS : public SecureHash { + public: + SecureHashSHA256NSS() { + SHA256_Begin(&ctx_); + } + + virtual ~SecureHashSHA256NSS() { + } + + virtual void Update(const void* input, size_t len) { + SHA256_Update(&ctx_, static_cast(input), len); + } + + virtual void Finish(void* output, size_t len) { + SHA256_End(&ctx_, static_cast(output), NULL, + static_cast(len)); + } + + private: + SHA256Context ctx_; +}; + +} // namespace + +SecureHash* SecureHash::Create(Algorithm algorithm) { + switch (algorithm) { + case SHA256: + return new SecureHashSHA256NSS(); + default: + NOTIMPLEMENTED(); + return NULL; + } +} + +} // namespace base -- cgit v1.1