]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crypto: remove old crypto globals
authorSage Weil <sage@inktank.com>
Fri, 17 Aug 2012 17:49:33 +0000 (10:49 -0700)
committerSage Weil <sage@inktank.com>
Fri, 17 Aug 2012 17:49:33 +0000 (10:49 -0700)
We now use the CephContext instances.

Signed-off-by: Sage Weil <sage@inktank.com>
src/auth/Crypto.cc
src/auth/Crypto.h
src/common/ceph_crypto.cc

index 5db2ff3b72df3a89764d614c838b8b79c57cb4b1..c37fc85e13f2b58719c6ce9b1c0389a1a497cc4b 100644 (file)
@@ -302,39 +302,6 @@ void CryptoAES::decrypt(const bufferptr& secret, const bufferlist& in,
 }
 
 
-// ---------------------------------------------------
-
-static CryptoNone *crypto_none = 0;
-static CryptoAES *crypto_aes = 0;
-
-void crypto_init_handlers()
-{
-  crypto_none = new CryptoNone;
-  crypto_aes = new CryptoAES;
-}
-
-void crypto_shutdown_handlers()
-{
-  assert(crypto_none);
-  delete crypto_none;
-  crypto_none = NULL;
-  assert(crypto_aes);
-  delete crypto_aes;
-  crypto_aes = NULL;
-}
-
-CryptoHandler *get_crypto_handler(int type)
-{
-  switch (type) {
-    case CEPH_CRYPTO_NONE:
-      return crypto_none;
-    case CEPH_CRYPTO_AES:
-      return crypto_aes;
-    default:
-      return NULL;
-  }
-}
-
 // ---------------------------------------------------
 
 int CryptoKey::set_secret(CephContext *cct, int type, bufferptr& s)
index 1176fd1c2cc18714683b7ccff8125aabc7a00d1a..4464c79854ebad551c5c3b27e5972d3745ea62a3 100644 (file)
@@ -108,10 +108,6 @@ public:
                      bufferlist& out, std::string &error) const = 0;
 };
 
-extern void crypto_init_handlers();
-extern void crypto_shutdown_handlers();
-extern CryptoHandler *get_crypto_handler(int type);
-
 extern int get_random_bytes(char *buf, int len);
 
 
index e55908975a78240c9f409c6efaee1b70bac823c8..95909d07e744c414a45c9151f0f1e1e15a0d982b 100644 (file)
 #include "auth/Crypto.h"
 
 #include <pthread.h>
+#include <stdlib.h>
 
-static bool crypto_init = false;
-
-void ceph::crypto::assert_init() {
-  assert(crypto_init == true);
-}
+void ceph::crypto::shutdown();
 
 #ifdef USE_CRYPTOPP
-void ceph::crypto::init() {
-  crypto_init = true;
-  crypto_init_handlers();
+void ceph::crypto::init()
+{
 }
 
-void ceph::crypto::shutdown() {
-  crypto_init = false;
-  crypto_shutdown_handlers();
+void ceph::crypto::shutdown()
+{
 }
 
 // nothing
@@ -41,24 +36,18 @@ ceph::crypto::HMACSHA1::~HMACSHA1()
 
 #elif USE_NSS
 
-void ceph::crypto::init() {
-  if (crypto_init)
-    return;
-  crypto_init = true;
+void ceph::crypto::init()
+{
   SECStatus s;
   s = NSS_NoDB_Init(NULL);
   assert(s == SECSuccess);
-  crypto_init_handlers();
 }
 
-void ceph::crypto::shutdown() {
-  if (!crypto_init)
-    return;
-  crypto_init = false;
+void ceph::crypto::shutdown()
+{
   SECStatus s;
   s = NSS_Shutdown();
   assert(s == SECSuccess);
-  crypto_shutdown_handlers();
 }
 
 ceph::crypto::HMACSHA1::~HMACSHA1()