]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
auth: remove CephCryptoManager
authorColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Tue, 14 Jun 2011 23:27:02 +0000 (16:27 -0700)
committerColin Patrick McCabe <cmccabe@alumni.cmu.edu>
Tue, 14 Jun 2011 23:34:42 +0000 (16:34 -0700)
It doesn't do anything.

Signed-off-by: Colin McCabe <colin.mccabe@dreamhost.com>
src/auth/Crypto.cc
src/auth/Crypto.h
src/auth/cephx/CephxKeyServer.cc
src/test/crypto.cc

index c435366fbbffccbf23a4a3faa86c96dac5e476e5..dd678c879b798ea346290a4109d5540d02fcc408 100644 (file)
@@ -324,7 +324,7 @@ decrypt(const bufferptr& secret, const bufferlist& in, bufferlist& out) const
 static CryptoNone crypto_none;
 static CryptoAES crypto_aes;
 
-CryptoHandler *CryptoManager::get_crypto(int type)
+CryptoHandler *get_crypto_handler(int type)
 {
   switch (type) {
     case CEPH_CRYPTO_NONE:
@@ -336,9 +336,6 @@ CryptoHandler *CryptoManager::get_crypto(int type)
   }
 }
 
-CryptoManager ceph_crypto_mgr;
-
-
 // ---------------------------------------------------
 
 int CryptoKey::set_secret(int type, bufferptr& s)
@@ -346,7 +343,7 @@ int CryptoKey::set_secret(int type, bufferptr& s)
   this->type = type;
   created = g_clock.now();
 
-  CryptoHandler *h = ceph_crypto_mgr.get_crypto(type);
+  CryptoHandler *h = get_crypto_handler(type);
   if (!h)
     return -EOPNOTSUPP;
   int ret = h->validate_secret(s);
@@ -364,7 +361,7 @@ int CryptoKey::create(int t)
   type = t;
   created = g_clock.now();
 
-  CryptoHandler *h = ceph_crypto_mgr.get_crypto(type);
+  CryptoHandler *h = get_crypto_handler(type);
   if (!h)
     return -EOPNOTSUPP;
   return h->create(secret);
@@ -372,7 +369,7 @@ int CryptoKey::create(int t)
 
 int CryptoKey::encrypt(const bufferlist& in, bufferlist& out) const
 {
-  CryptoHandler *h = ceph_crypto_mgr.get_crypto(type);
+  CryptoHandler *h = get_crypto_handler(type);
   if (!h)
     return -EOPNOTSUPP;
   return h->encrypt(this->secret, in, out);
@@ -380,7 +377,7 @@ int CryptoKey::encrypt(const bufferlist& in, bufferlist& out) const
 
 int CryptoKey::decrypt(const bufferlist& in, bufferlist& out) const
 {
-  CryptoHandler *h = ceph_crypto_mgr.get_crypto(type);
+  CryptoHandler *h = get_crypto_handler(type);
   if (!h)
     return -EOPNOTSUPP;
   return h->decrypt(this->secret, in, out);
index c51a69701ee3b7c3726342e939155acb24457d58..f3f88532ecda44ee44a08449f4e97ebb260566dd 100644 (file)
@@ -103,13 +103,7 @@ public:
                      bufferlist& out) const = 0;
 };
 
-
-class CryptoManager {
-public:
-  CryptoHandler *get_crypto(int type);
-};
-
-extern CryptoManager ceph_crypto_mgr;
+extern CryptoHandler *get_crypto_handler(int type);
 
 extern int get_random_bytes(char *buf, int len);
 
index 666094d08a018f26e452aadfbd08ca0495a6183b..c034feb7661bac9167e359a877a86664326289ae 100644 (file)
@@ -254,7 +254,7 @@ bool KeyServer::get_service_secret(uint32_t service_id,
 bool KeyServer::generate_secret(CryptoKey& secret)
 {
   bufferptr bp;
-  CryptoHandler *crypto = ceph_crypto_mgr.get_crypto(CEPH_CRYPTO_AES);
+  CryptoHandler *crypto = get_crypto_handler(CEPH_CRYPTO_AES);
   if (!crypto)
     return false;
 
index 88cab9772c1834d0cbcc989883e7b1b3a359e846..5265a02e4f61059599af3e948e4c359ba65cfab2 100644 (file)
@@ -17,7 +17,7 @@ public:
 ::testing::Environment* const crypto_env = ::testing::AddGlobalTestEnvironment(new CryptoEnvironment);
 
 TEST(AES, ValidateSecret) {
-  CryptoHandler *h = ceph_crypto_mgr.get_crypto(CEPH_CRYPTO_AES);
+  CryptoHandler *h = get_crypto_handler(CEPH_CRYPTO_AES);
   int l;
 
   for (l=0; l<16; l++) {
@@ -36,7 +36,7 @@ TEST(AES, ValidateSecret) {
 }
 
 TEST(AES, Encrypt) {
-  CryptoHandler *h = ceph_crypto_mgr.get_crypto(CEPH_CRYPTO_AES);
+  CryptoHandler *h = get_crypto_handler(CEPH_CRYPTO_AES);
   char secret_s[] = {
     0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
@@ -76,7 +76,7 @@ TEST(AES, Encrypt) {
 }
 
 TEST(AES, Decrypt) {
-  CryptoHandler *h = ceph_crypto_mgr.get_crypto(CEPH_CRYPTO_AES);
+  CryptoHandler *h = get_crypto_handler(CEPH_CRYPTO_AES);
   char secret_s[] = {
     0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
     0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
@@ -128,7 +128,7 @@ TEST(AES, Loop) {
   for (int i=0; i<10000; i++) {
     bufferlist cipher;
     {
-      CryptoHandler *h = ceph_crypto_mgr.get_crypto(CEPH_CRYPTO_AES);
+      CryptoHandler *h = get_crypto_handler(CEPH_CRYPTO_AES);
 
       int success;
       success = h->encrypt(secret, plaintext, cipher);
@@ -137,7 +137,7 @@ TEST(AES, Loop) {
     plaintext.clear();
 
     {
-      CryptoHandler *h = ceph_crypto_mgr.get_crypto(CEPH_CRYPTO_AES);
+      CryptoHandler *h = get_crypto_handler(CEPH_CRYPTO_AES);
       int err;
       err = h->decrypt(secret, cipher, plaintext);
       ASSERT_EQ((int)sizeof(orig_plaintext_s), err);