summaryrefslogtreecommitdiffstats
path: root/base/crypto
diff options
context:
space:
mode:
authorjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-22 13:12:34 +0000
committerjoth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-22 13:12:34 +0000
commit70372d49ac0fc1bbfd7e04aa820b646a6c525743 (patch)
tree6fe8307c1f572da2b95033bff6b344df2c883493 /base/crypto
parentc98ca85192efe95c9019ff370350d0b7bf4ef659 (diff)
downloadchromium_src-70372d49ac0fc1bbfd7e04aa820b646a6c525743.zip
chromium_src-70372d49ac0fc1bbfd7e04aa820b646a6c525743.tar.gz
chromium_src-70372d49ac0fc1bbfd7e04aa820b646a6c525743.tar.bz2
Make USE_OPENSSL and USE_NSS mutually exclusive
- that is, defining use_openssl=1 will now remove all dependency on NSS. This does not impact any of the standard, non-openssl builds. Adds stub implementations of several files that need to be fully implemented in follow up patchs. Firefox import code will need some more substatial refactoring, as it makes little sense to be attempting a firefox import without NSS libraries to hand, however the UI etc has numerous assumption about the presence of this importer. BUG=None TEST=None Review URL: http://codereview.chromium.org/3855004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/crypto')
-rw-r--r--base/crypto/encryptor_openssl.cc32
-rw-r--r--base/crypto/rsa_private_key_openssl.cc79
-rw-r--r--base/crypto/signature_creator_openssl.cc32
-rw-r--r--base/crypto/signature_verifier_openssl.cc41
-rw-r--r--base/crypto/symmetric_key.h5
-rw-r--r--base/crypto/symmetric_key_openssl.cc43
6 files changed, 231 insertions, 1 deletions
diff --git a/base/crypto/encryptor_openssl.cc b/base/crypto/encryptor_openssl.cc
new file mode 100644
index 0000000..71a84be
--- /dev/null
+++ b/base/crypto/encryptor_openssl.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2010 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/encryptor.h"
+
+#include "base/logging.h"
+
+namespace base {
+
+Encryptor::Encryptor() {
+}
+
+Encryptor::~Encryptor() {
+}
+
+bool Encryptor::Init(SymmetricKey* key, Mode mode, const std::string& iv) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool Encryptor::Encrypt(const std::string& plaintext, std::string* ciphertext) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool Encryptor::Decrypt(const std::string& ciphertext, std::string* plaintext) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+} // namespace base
diff --git a/base/crypto/rsa_private_key_openssl.cc b/base/crypto/rsa_private_key_openssl.cc
new file mode 100644
index 0000000..ec1d8b5
--- /dev/null
+++ b/base/crypto/rsa_private_key_openssl.cc
@@ -0,0 +1,79 @@
+// Copyright (c) 2010 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/rsa_private_key.h"
+
+#include "base/logging.h"
+
+namespace base {
+
+// static
+RSAPrivateKey* RSAPrivateKey::CreateWithParams(uint16 num_bits,
+ bool permanent,
+ bool sensitive) {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+// static
+RSAPrivateKey* RSAPrivateKey::Create(uint16 num_bits) {
+ return CreateWithParams(num_bits,
+ false /* not permanent */,
+ false /* not sensitive */);
+}
+
+// static
+RSAPrivateKey* RSAPrivateKey::CreateSensitive(uint16 num_bits) {
+ return CreateWithParams(num_bits,
+ true /* permanent */,
+ true /* sensitive */);
+}
+
+// static
+RSAPrivateKey* RSAPrivateKey::CreateFromPrivateKeyInfoWithParams(
+ const std::vector<uint8>& input, bool permanent, bool sensitive) {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+// static
+RSAPrivateKey* RSAPrivateKey::CreateFromPrivateKeyInfo(
+ const std::vector<uint8>& input) {
+ return CreateFromPrivateKeyInfoWithParams(input,
+ false /* not permanent */,
+ false /* not sensitive */);
+}
+
+// static
+RSAPrivateKey* RSAPrivateKey::CreateSensitiveFromPrivateKeyInfo(
+ const std::vector<uint8>& input) {
+ return CreateFromPrivateKeyInfoWithParams(input,
+ true /* permanent */,
+ true /* seneitive */);
+}
+
+// static
+RSAPrivateKey* RSAPrivateKey::FindFromPublicKeyInfo(
+ const std::vector<uint8>& input) {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+RSAPrivateKey::RSAPrivateKey() {
+}
+
+RSAPrivateKey::~RSAPrivateKey() {
+}
+
+bool RSAPrivateKey::ExportPrivateKey(std::vector<uint8>* output) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool RSAPrivateKey::ExportPublicKey(std::vector<uint8>* output) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+} // namespace base
diff --git a/base/crypto/signature_creator_openssl.cc b/base/crypto/signature_creator_openssl.cc
new file mode 100644
index 0000000..5d70f01
--- /dev/null
+++ b/base/crypto/signature_creator_openssl.cc
@@ -0,0 +1,32 @@
+// Copyright (c) 2009 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/signature_creator.h"
+
+#include "base/logging.h"
+
+namespace base {
+
+// static
+SignatureCreator* SignatureCreator::Create(RSAPrivateKey* key) {
+ return NULL;
+}
+
+SignatureCreator::SignatureCreator() {
+}
+
+SignatureCreator::~SignatureCreator() {
+}
+
+bool SignatureCreator::Update(const uint8* data_part, int data_part_len) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+bool SignatureCreator::Final(std::vector<uint8>* signature) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+} // namespace base
diff --git a/base/crypto/signature_verifier_openssl.cc b/base/crypto/signature_verifier_openssl.cc
new file mode 100644
index 0000000..49b5e07
--- /dev/null
+++ b/base/crypto/signature_verifier_openssl.cc
@@ -0,0 +1,41 @@
+// Copyright (c) 2010 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/signature_verifier.h"
+
+#include "base/logging.h"
+
+namespace base {
+
+SignatureVerifier::SignatureVerifier() {
+}
+
+SignatureVerifier::~SignatureVerifier() {
+}
+
+bool SignatureVerifier::VerifyInit(const uint8* signature_algorithm,
+ int signature_algorithm_len,
+ const uint8* signature,
+ int signature_len,
+ const uint8* public_key_info,
+ int public_key_info_len) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+void SignatureVerifier::VerifyUpdate(const uint8* data_part,
+ int data_part_len) {
+ NOTIMPLEMENTED();
+}
+
+bool SignatureVerifier::VerifyFinal() {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+void SignatureVerifier::Reset() {
+ NOTIMPLEMENTED();
+}
+
+} // namespace base
diff --git a/base/crypto/symmetric_key.h b/base/crypto/symmetric_key.h
index d7259be..3f2be76 100644
--- a/base/crypto/symmetric_key.h
+++ b/base/crypto/symmetric_key.h
@@ -65,7 +65,10 @@ class SymmetricKey {
bool GetRawKey(std::string* raw_key);
private:
-#if defined(USE_NSS)
+#if defined(USE_OPENSSL)
+ // TODO(joth): Add a constructor that accepts OpenSSL symmetric key data, and
+ // the appropriate data members to store it in.
+#elif defined(USE_NSS)
explicit SymmetricKey(PK11SymKey* key);
ScopedPK11SymKey key_;
#elif defined(OS_MACOSX)
diff --git a/base/crypto/symmetric_key_openssl.cc b/base/crypto/symmetric_key_openssl.cc
new file mode 100644
index 0000000..591252d
--- /dev/null
+++ b/base/crypto/symmetric_key_openssl.cc
@@ -0,0 +1,43 @@
+// Copyright (c) 2010 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/symmetric_key.h"
+
+#include "base/logging.h"
+
+namespace base {
+
+SymmetricKey::~SymmetricKey() {
+}
+
+// static
+SymmetricKey* SymmetricKey::GenerateRandomKey(Algorithm algorithm,
+ size_t key_size_in_bits) {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+// static
+SymmetricKey* SymmetricKey::DeriveKeyFromPassword(Algorithm algorithm,
+ const std::string& password,
+ const std::string& salt,
+ size_t iterations,
+ size_t key_size_in_bits) {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+// static
+SymmetricKey* SymmetricKey::Import(Algorithm algorithm,
+ const std::string& raw_key) {
+ NOTIMPLEMENTED();
+ return NULL;
+}
+
+bool SymmetricKey::GetRawKey(std::string* raw_key) {
+ NOTIMPLEMENTED();
+ return false;
+}
+
+} // namespace base