]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Make rgw_op use MD5 via compatibility shim.
authorTommi Virtanen <tommi.virtanen@dreamhost.com>
Tue, 8 Mar 2011 21:49:56 +0000 (13:49 -0800)
committerTommi Virtanen <tommi.virtanen@dreamhost.com>
Fri, 11 Mar 2011 21:13:40 +0000 (13:13 -0800)
Signed-off-by: Tommi Virtanen <tommi.virtanen@dreamhost.com>
src/Makefile.am
src/common/ceph_crypto.h [new file with mode: 0644]
src/rgw/rgw_common.h
src/rgw/rgw_main.cc
src/rgw/rgw_op.cc

index 4056d4b0b9eb69b96cf2b2d28c9f4e80a4ab8293..c2b9c44a8cdffa2d2941077514abf49446d9b47f 100644 (file)
@@ -732,6 +732,7 @@ noinst_HEADERS = \
         common/run_cmd.h\
        common/safe_io.h\
         common/config.h\
+       common/ceph_crypto.h\
         crush/CrushWrapper.h\
         crush/CrushWrapper.i\
         crush/builder.h\
diff --git a/src/common/ceph_crypto.h b/src/common/ceph_crypto.h
new file mode 100644 (file)
index 0000000..bd2d20a
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef CEPH_CRYPTO_H
+#define CEPH_CRYPTO_H
+
+#include "acconfig.h"
+
+#ifdef USE_CRYPTOPP
+# define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
+# include <cryptopp/md5.h>
+namespace ceph {
+  namespace crypto {
+    static inline void init() {
+      // nothing
+    }
+    using CryptoPP::Weak::MD5;
+  }
+}
+#elif USE_NSS
+# error "TODO NSS support for md5"
+#else
+# error "No supported crypto implementation found."
+#endif
+
+#endif
index cf6e89ec1f9bf738e958f587b18cbaeb10e7da5d..a795b29ca10ae78f7ebd75e8e81d3e5dc9afa21b 100644 (file)
 #ifndef CEPH_RGW_COMMON_H
 #define CEPH_RGW_COMMON_H
 
+#include "common/ceph_crypto.h"
 #include "fcgiapp.h"
 
 #include <string.h>
-#define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1
-#include <cryptopp/md5.h>
 #include <string>
 #include <map>
 #include "include/types.h"
@@ -197,7 +196,8 @@ struct RGWObjEnt {
   std::string name;
   size_t size;
   time_t mtime;
-  char etag[CryptoPP::Weak::MD5::DIGESTSIZE * 2 + 1];
+  // two md5 digests and a terminator
+  char etag[ceph::crypto::MD5::DIGESTSIZE * 2 + 1];
 
   void encode(bufferlist& bl) const {
     __u8 struct_v = 1;
index 5dddb6f9231c498e1c042248e9fb7da03fd39049..5b0a5c05af042c82a5a622ef84c88333ab461cbb 100644 (file)
@@ -258,6 +258,8 @@ int main(int argc, char *argv[])
   sighandler_usr1 = signal(SIGUSR1, godown_handler);
   sighandler_alrm = signal(SIGALRM, godown_alarm);
 
+  ceph::crypto::init();
+
   while (FCGX_Accept(&fcgx.in, &fcgx.out, &fcgx.err, &fcgx.envp) >= 0) 
   {
     rgwhandler.init_state(&s, &fcgx);
index cb274af1c7d99d4120ce9690264233344a121616..f6bda8087ffa5eb1935e743bfe69419e87ffc514 100644 (file)
@@ -13,7 +13,7 @@
 #include "rgw_user.h"
 
 using namespace std;
-using namespace CryptoPP::Weak;
+using ceph::crypto::MD5;
 
 static int parse_range(const char *range, off_t& ofs, off_t& end)
 {