# include <pk11pub.h>
#endif
-#include "include/ceph_fs.h"
+#include "common/Clock.h"
+#include "common/armor.h"
+#include "common/ceph_crypto.h"
#include "common/config.h"
#include "common/debug.h"
-#include "common/armor.h"
-#include "common/Clock.h"
#include "common/hex.h"
#include "common/safe_io.h"
+#include "include/ceph_fs.h"
#include <errno.h>
class CryptoNone : public CryptoHandler {
public:
- CryptoNone() {}
+ CryptoNone() { }
~CryptoNone() {}
int create(bufferptr& secret);
int validate_secret(bufferptr& secret);
class CryptoAES : public CryptoHandler {
public:
- CryptoAES() {}
+ CryptoAES() { }
~CryptoAES() {}
int create(bufferptr& secret);
int validate_secret(bufferptr& secret);
CryptoHandler *h = ceph_crypto_mgr.get_crypto(type);
if (!h)
return -EOPNOTSUPP;
-
int ret = h->validate_secret(s);
if (ret < 0)
#include <pthread.h>
+static bool crypto_init = false;
+
+void ceph::crypto::assert_init() {
+ assert(crypto_init == true);
+}
+
#ifdef USE_CRYPTOPP
+void ceph::crypto::init() {
+ crypto_init = true;
+}
+
+void ceph::crypto::shutdown() {
+ crypto_init = false;
+}
+
// nothing
ceph::crypto::HMACSHA1::~HMACSHA1()
{
#elif USE_NSS
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
-static bool crypto_init = false;
void ceph::crypto::init() {
pthread_mutex_lock(&lock);
# include <cryptopp/hmac.h>
namespace ceph {
namespace crypto {
- static inline void init() {
- // nothing
- }
- static inline void shutdown() {
- // nothing
- }
+ void assert_init();
+ void init();
+ void shutdown();
+
using CryptoPP::Weak::MD5;
using CryptoPP::SHA1;
using CryptoPP::SHA256;
namespace ceph {
namespace crypto {
+ void assert_init();
void init();
void shutdown();
class Digest {