]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: merge crypto changes
authorYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 16 Mar 2011 17:57:48 +0000 (10:57 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Wed, 16 Mar 2011 17:57:48 +0000 (10:57 -0700)
src/rgw/rgw_common.h
src/rgw/rgw_rest_s3.cc

index df5de0656a409bd007ebf8198b490ed2be63051e..200606050f94361e4e93f5afa0455feea2cb193e 100644 (file)
@@ -26,6 +26,8 @@
 
 using namespace std;
 
+using ceph::crypto::MD5;
+
 #define RGW_ATTR_PREFIX  "user.rgw."
 
 #define RGW_ATTR_ACL           RGW_ATTR_PREFIX "acl"
@@ -277,7 +279,7 @@ struct RGWBucketEnt {
   std::string name;
   size_t size;
   time_t mtime;
-  char etag[CryptoPP::Weak::MD5::DIGESTSIZE * 2 + 1];
+  char etag[MD5::DIGESTSIZE * 2 + 1];
   uint64_t count;
 
   void encode(bufferlist& bl) const {
index 1bc116e877a32dae39151ccb46a361917e7d864c..3e54204e27c5c533a85917bed7b0b068d8ff9b92 100644 (file)
@@ -1,8 +1,7 @@
 #include <errno.h>
 #include <string.h>
 
-#include <cryptopp/sha.h>
-#include <cryptopp/hmac.h>
+#include "common/ceph_crypto.h"
 
 #include "rgw_rest.h"
 #include "rgw_rest_s3.h"
@@ -10,7 +9,7 @@
 #include "common/armor.h"
 
 
-using namespace CryptoPP;
+using namespace ceph::crypto;
 
 void list_all_buckets_start(struct req_state *s)
 {
@@ -356,15 +355,15 @@ static int calc_hmac_sha1(const char *key, int key_len,
                            const char *msg, int msg_len,
                            char *dest, int *len) /* dest should be large enough to hold result */
 {
-  if (*len < HMAC<SHA1>::DIGESTSIZE)
+  if (*len < HMACSHA1::DIGESTSIZE)
     return -EINVAL;
 
-  char hex_str[HMAC<SHA1>::DIGESTSIZE * 2 + 1];
+  char hex_str[HMACSHA1::DIGESTSIZE * 2 + 1];
 
-  HMAC<SHA1> hmac((const unsigned char *)key, key_len);
+  HMACSHA1 hmac((const unsigned char *)key, key_len);
   hmac.Update((const unsigned char *)msg, msg_len);
   hmac.Final((unsigned char *)dest);
-  *len = HMAC<SHA1>::DIGESTSIZE;
+  *len = HMACSHA1::DIGESTSIZE;
   
   buf_to_hex((unsigned char *)dest, *len, hex_str);
 
@@ -428,7 +427,7 @@ bool RGWHandler_REST_S3::authorize(struct req_state *s)
   const char *key = s->user.secret_key.c_str();
   int key_len = strlen(key);
 
-  char hmac_sha1[HMAC<SHA1>::DIGESTSIZE];
+  char hmac_sha1[HMACSHA1::DIGESTSIZE];
   int len = sizeof(hmac_sha1);
   if (calc_hmac_sha1(key, key_len, auth_hdr.c_str(), auth_hdr.size(), hmac_sha1, &len) < 0)
     return false;