We now use the CephContext instances.
Signed-off-by: Sage Weil <sage@inktank.com>
}
-// ---------------------------------------------------
-
-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)
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);
#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
#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()