diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 17:37:14 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-14 17:37:14 +0000 |
commit | 4b559b4ddffc0b7f688019bcb80658f05e063af7 (patch) | |
tree | 0be21d8914de707f5125d2cb66733cbcf088606c /remoting | |
parent | 056dd45d610de34312344445d7b078a31f4a1e20 (diff) | |
download | chromium_src-4b559b4ddffc0b7f688019bcb80658f05e063af7.zip chromium_src-4b559b4ddffc0b7f688019bcb80658f05e063af7.tar.gz chromium_src-4b559b4ddffc0b7f688019bcb80658f05e063af7.tar.bz2 |
Move crypto files out of base, to a top level directory.
src/crypto is now an independent project that contains our
cryptographic primitives (except md5 and sha1).
This removes the base dependency from nss, openssl and sqlite.
BUG=76996
TEST=none
Review URL: http://codereview.chromium.org/6805019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81611 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r-- | remoting/DEPS | 1 | ||||
-rw-r--r-- | remoting/host/host_key_pair.cc | 16 | ||||
-rw-r--r-- | remoting/host/host_key_pair.h | 6 | ||||
-rw-r--r-- | remoting/host/keygen_main.cc | 4 | ||||
-rw-r--r-- | remoting/host/simple_host_process.cc | 4 | ||||
-rw-r--r-- | remoting/protocol/jingle_session.cc | 8 | ||||
-rw-r--r-- | remoting/protocol/jingle_session.h | 8 | ||||
-rw-r--r-- | remoting/protocol/jingle_session_manager.cc | 2 | ||||
-rw-r--r-- | remoting/protocol/jingle_session_manager.h | 6 | ||||
-rw-r--r-- | remoting/protocol/jingle_session_unittest.cc | 6 | ||||
-rw-r--r-- | remoting/protocol/protocol_test_client.cc | 8 | ||||
-rw-r--r-- | remoting/remoting.gyp | 3 |
12 files changed, 38 insertions, 34 deletions
diff --git a/remoting/DEPS b/remoting/DEPS index c4ae789..05db1ed 100644 --- a/remoting/DEPS +++ b/remoting/DEPS @@ -1,4 +1,5 @@ include_rules = [ + "+crypto", "+media/base", "-remoting", diff --git a/remoting/host/host_key_pair.cc b/remoting/host/host_key_pair.cc index ad3d59b..948b4ad 100644 --- a/remoting/host/host_key_pair.cc +++ b/remoting/host/host_key_pair.cc @@ -9,12 +9,12 @@ #include <vector> #include "base/base64.h" -#include "base/crypto/rsa_private_key.h" -#include "base/crypto/signature_creator.h" #include "base/logging.h" #include "base/rand_util.h" #include "base/task.h" #include "base/time.h" +#include "crypto/rsa_private_key.h" +#include "crypto/signature_creator.h" #include "net/base/x509_certificate.h" #include "remoting/host/host_config.h" @@ -25,7 +25,7 @@ HostKeyPair::HostKeyPair() { } HostKeyPair::~HostKeyPair() { } void HostKeyPair::Generate() { - key_.reset(base::RSAPrivateKey::Create(2048)); + key_.reset(crypto::RSAPrivateKey::Create(2048)); } bool HostKeyPair::LoadFromString(const std::string& key_base64) { @@ -36,7 +36,7 @@ bool HostKeyPair::LoadFromString(const std::string& key_base64) { } std::vector<uint8> key_buf(key_str.begin(), key_str.end()); - key_.reset(base::RSAPrivateKey::CreateFromPrivateKeyInfo(key_buf)); + key_.reset(crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_buf)); if (key_.get() == NULL) { LOG(ERROR) << "Invalid private key."; return false; @@ -76,8 +76,8 @@ std::string HostKeyPair::GetPublicKey() const { } std::string HostKeyPair::GetSignature(const std::string& message) const { - scoped_ptr<base::SignatureCreator> signature_creator( - base::SignatureCreator::Create(key_.get())); + scoped_ptr<crypto::SignatureCreator> signature_creator( + crypto::SignatureCreator::Create(key_.get())); signature_creator->Update(reinterpret_cast<const uint8*>(message.c_str()), message.length()); std::vector<uint8> signature_buf; @@ -88,10 +88,10 @@ std::string HostKeyPair::GetSignature(const std::string& message) const { return signature_base64; } -base::RSAPrivateKey* HostKeyPair::CopyPrivateKey() const { +crypto::RSAPrivateKey* HostKeyPair::CopyPrivateKey() const { std::vector<uint8> key_bytes; CHECK(key_->ExportPrivateKey(&key_bytes)); - return base::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes); + return crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes); } net::X509Certificate* HostKeyPair::GenerateCertificate() const { diff --git a/remoting/host/host_key_pair.h b/remoting/host/host_key_pair.h index b087e1f..c1f6082 100644 --- a/remoting/host/host_key_pair.h +++ b/remoting/host/host_key_pair.h @@ -11,7 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "base/task.h" -namespace base { +namespace crypto { class RSAPrivateKey; } // namespace base @@ -38,11 +38,11 @@ class HostKeyPair { std::string GetSignature(const std::string& message) const; // Make a new copy of private key. Caller will own the generated private key. - base::RSAPrivateKey* CopyPrivateKey() const; + crypto::RSAPrivateKey* CopyPrivateKey() const; net::X509Certificate* GenerateCertificate() const; private: - scoped_ptr<base::RSAPrivateKey> key_; + scoped_ptr<crypto::RSAPrivateKey> key_; }; } // namespace remoting diff --git a/remoting/host/keygen_main.cc b/remoting/host/keygen_main.cc index 73b1aa2..9102756 100644 --- a/remoting/host/keygen_main.cc +++ b/remoting/host/keygen_main.cc @@ -13,13 +13,13 @@ #include "base/at_exit.h" #include "base/base64.h" -#include "base/crypto/rsa_private_key.h" +#include "crypto/rsa_private_key.h" #include "base/memory/scoped_ptr.h" int main(int argc, char** argv) { base::AtExitManager exit_manager; - scoped_ptr<base::RSAPrivateKey> key(base::RSAPrivateKey::Create(2048)); + scoped_ptr<crypto::RSAPrivateKey> key(crypto::RSAPrivateKey::Create(2048)); std::vector<uint8> private_key_buf; key->ExportPrivateKey(&private_key_buf); diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc index 7c3a595..c10c2c5 100644 --- a/remoting/host/simple_host_process.cc +++ b/remoting/host/simple_host_process.cc @@ -24,10 +24,10 @@ #include "base/file_path.h" #include "base/logging.h" #include "base/mac/scoped_nsautorelease_pool.h" -#include "base/nss_util.h" #include "base/path_service.h" #include "base/test/mock_chrome_application_mac.h" #include "base/threading/thread.h" +#include "crypto/nss_util.h" #include "media/base/media.h" #include "remoting/base/tracer.h" #include "remoting/host/capturer_fake.h" @@ -83,7 +83,7 @@ int main(int argc, char** argv) { const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); base::AtExitManager exit_manager; - base::EnsureNSPRInit(); + crypto::EnsureNSPRInit(); // Allocate a chromoting context and starts it. #if defined(TOOLKIT_USES_GTK) diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc index 701ee9d..78cfbae 100644 --- a/remoting/protocol/jingle_session.cc +++ b/remoting/protocol/jingle_session.cc @@ -4,8 +4,8 @@ #include "remoting/protocol/jingle_session.h" -#include "base/crypto/rsa_private_key.h" #include "base/message_loop.h" +#include "crypto/rsa_private_key.h" #include "jingle/glue/channel_socket_adapter.h" #include "jingle/glue/stream_socket_adapter.h" #include "net/base/cert_status_flags.h" @@ -83,13 +83,13 @@ JingleSession* JingleSession::CreateClientSession( JingleSession* JingleSession::CreateServerSession( JingleSessionManager* manager, scoped_refptr<net::X509Certificate> certificate, - base::RSAPrivateKey* key) { + crypto::RSAPrivateKey* key) { return new JingleSession(manager, certificate, key); } JingleSession::JingleSession( JingleSessionManager* jingle_session_manager, - scoped_refptr<net::X509Certificate> server_cert, base::RSAPrivateKey* key) + scoped_refptr<net::X509Certificate> server_cert, crypto::RSAPrivateKey* key) : jingle_session_manager_(jingle_session_manager), server_cert_(server_cert), state_(INITIALIZING), @@ -105,7 +105,7 @@ JingleSession::JingleSession( if (key) { std::vector<uint8> key_bytes; CHECK(key->ExportPrivateKey(&key_bytes)); - key_.reset(base::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes)); + key_.reset(crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_bytes)); CHECK(key_.get()); } } diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h index 74b0efe..caaa82f 100644 --- a/remoting/protocol/jingle_session.h +++ b/remoting/protocol/jingle_session.h @@ -5,8 +5,8 @@ #ifndef REMOTING_PROTOCOL_JINGLE_SESSION_H_ #define REMOTING_PROTOCOL_JINGLE_SESSION_H_ -#include "base/crypto/rsa_private_key.h" #include "base/memory/ref_counted.h" +#include "crypto/rsa_private_key.h" #include "net/base/completion_callback.h" #include "remoting/protocol/session.h" #include "third_party/libjingle/source/talk/base/sigslot.h" @@ -53,7 +53,7 @@ class JingleSession : public protocol::Session, static JingleSession* CreateServerSession( JingleSessionManager* manager, scoped_refptr<net::X509Certificate> certificate, - base::RSAPrivateKey* key); + crypto::RSAPrivateKey* key); // Chromotocol Session interface. virtual void SetStateChangeCallback(StateChangeCallback* callback); @@ -86,7 +86,7 @@ class JingleSession : public protocol::Session, JingleSession(JingleSessionManager* client, scoped_refptr<net::X509Certificate> server_cert, - base::RSAPrivateKey* key); + crypto::RSAPrivateKey* key); virtual ~JingleSession(); // Called by JingleSessionManager. @@ -129,7 +129,7 @@ class JingleSession : public protocol::Session, scoped_refptr<net::X509Certificate> server_cert_; // Private key used in SSL server sockets. - scoped_ptr<base::RSAPrivateKey> key_; + scoped_ptr<crypto::RSAPrivateKey> key_; State state_; scoped_ptr<StateChangeCallback> state_change_callback_; diff --git a/remoting/protocol/jingle_session_manager.cc b/remoting/protocol/jingle_session_manager.cc index 22ec733..29eacd7 100644 --- a/remoting/protocol/jingle_session_manager.cc +++ b/remoting/protocol/jingle_session_manager.cc @@ -178,7 +178,7 @@ void JingleSessionManager::Init( const std::string& local_jid, cricket::SessionManager* cricket_session_manager, IncomingSessionCallback* incoming_session_callback, - base::RSAPrivateKey* private_key, + crypto::RSAPrivateKey* private_key, scoped_refptr<net::X509Certificate> certificate) { if (MessageLoop::current() != message_loop()) { message_loop()->PostTask( diff --git a/remoting/protocol/jingle_session_manager.h b/remoting/protocol/jingle_session_manager.h index 96f3cc9..943edf6 100644 --- a/remoting/protocol/jingle_session_manager.h +++ b/remoting/protocol/jingle_session_manager.h @@ -18,7 +18,7 @@ class MessageLoop; -namespace base { +namespace crypto { class RSAPrivateKey; } // namespace base @@ -84,7 +84,7 @@ class JingleSessionManager virtual void Init(const std::string& local_jid, cricket::SessionManager* cricket_session_manager, IncomingSessionCallback* incoming_session_callback, - base::RSAPrivateKey* private_key, + crypto::RSAPrivateKey* private_key, scoped_refptr<net::X509Certificate> certificate); // SessionManager interface. @@ -149,7 +149,7 @@ class JingleSessionManager std::list<scoped_refptr<JingleSession> > sessions_; scoped_refptr<net::X509Certificate> certificate_; - scoped_ptr<base::RSAPrivateKey> private_key_; + scoped_ptr<crypto::RSAPrivateKey> private_key_; DISALLOW_COPY_AND_ASSIGN(JingleSessionManager); }; diff --git a/remoting/protocol/jingle_session_unittest.cc b/remoting/protocol/jingle_session_unittest.cc index 692b2f0..e11721a 100644 --- a/remoting/protocol/jingle_session_unittest.cc +++ b/remoting/protocol/jingle_session_unittest.cc @@ -4,11 +4,11 @@ #include "base/file_path.h" #include "base/file_util.h" -#include "base/nss_util.h" #include "base/path_service.h" #include "base/time.h" #include "base/synchronization/waitable_event.h" #include "base/test/test_timeouts.h" +#include "crypto/nss_util.h" #include "net/base/completion_callback.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" @@ -138,8 +138,8 @@ class JingleSessionTest : public testing::Test { reinterpret_cast<const uint8*>(key_string.data()), reinterpret_cast<const uint8*>(key_string.data() + key_string.length())); - scoped_ptr<base::RSAPrivateKey> private_key( - base::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); + scoped_ptr<crypto::RSAPrivateKey> private_key( + crypto::RSAPrivateKey::CreateFromPrivateKeyInfo(key_vector)); session_manager_pair_ = new SessionManagerPair(&thread_); session_manager_pair_->Init(); diff --git a/remoting/protocol/protocol_test_client.cc b/remoting/protocol/protocol_test_client.cc index 6a5881e..c481ca5 100644 --- a/remoting/protocol/protocol_test_client.cc +++ b/remoting/protocol/protocol_test_client.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. @@ -15,9 +15,9 @@ extern "C" { #include "base/at_exit.h" #include "base/command_line.h" -#include "base/nss_util.h" #include "base/test/mock_chrome_application_mac.h" #include "base/time.h" +#include "crypto/nss_util.h" #include "net/base/completion_callback.h" #include "net/base/io_buffer.h" #include "net/base/net_errors.h" @@ -357,8 +357,8 @@ int main(int argc, char** argv) { base::AtExitManager exit_manager; - base::EnsureNSPRInit(); - base::EnsureNSSInit(); + crypto::EnsureNSPRInit(); + crypto::EnsureNSSInit(); #if defined(OS_MACOSX) mock_cr_app::RegisterMockCrApp(); diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp index 74c5817..aea875d 100644 --- a/remoting/remoting.gyp +++ b/remoting/remoting.gyp @@ -189,6 +189,7 @@ 'chromoting_jingle_glue', 'chromoting_protocol', 'differ_block', + '../crypto/crypto.gyp:crypto', ], 'sources': [ 'host/access_verifier.cc', @@ -319,6 +320,7 @@ 'chromoting_base', '../base/base.gyp:base', '../base/base.gyp:base_i18n', + '../crypto/crypto.gyp:crypto', ], 'sources': [ 'host/keygen_main.cc', @@ -363,6 +365,7 @@ 'dependencies': [ 'chromoting_base', 'chromoting_jingle_glue', + '../crypto/crypto.gyp:crypto', '../jingle/jingle.gyp:jingle_glue', ], 'export_dependent_settings': [ |