]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
common: hmacsha512 for radosgw
authorMarcus Watts <mwatts@redhat.com>
Mon, 22 Aug 2022 07:37:27 +0000 (03:37 -0400)
committerKonstantin Shalygin <k0ste@k0ste.ru>
Tue, 20 Aug 2024 12:54:49 +0000 (19:54 +0700)
swift tempurl (and formpost) now suport sha256 and sha512.
hmacsha256 was there, adding hmacsha512 to round out the collection.

Fixes: https://tracker.ceph.com/issues/56564
Signed-off-by: Marcus Watts <mwatts@redhat.com>
(cherry picked from commit c32a042433887aadab49443809de66a2a33750cb)

src/common/ceph_crypto.h

index bcdc0044cbd59685c595b1a7e58e9629af2e862d..ee9a73eb4cd0e7c4e69227778b9b2ad0d9ab8466 100644 (file)
@@ -14,6 +14,7 @@
 #define CEPH_CRYPTO_SHA1_DIGESTSIZE 20
 #define CEPH_CRYPTO_HMACSHA256_DIGESTSIZE 32
 #define CEPH_CRYPTO_SHA256_DIGESTSIZE 32
+#define CEPH_CRYPTO_HMACSHA512_DIGESTSIZE 64
 #define CEPH_CRYPTO_SHA512_DIGESTSIZE 64
 
 #include <openssl/evp.h>
@@ -185,6 +186,12 @@ namespace TOPNSPC::crypto {
       : HMAC(EVP_sha256(), key, length) {
     }
   };
+
+  struct HMACSHA512 : public HMAC {
+    HMACSHA512 (const unsigned char *key, size_t length)
+      : HMAC(EVP_sha512(), key, length) {
+    }
+  };
 }
 
 
@@ -195,6 +202,7 @@ namespace TOPNSPC::crypto {
 
   using ssl::HMACSHA256;
   using ssl::HMACSHA1;
+  using ssl::HMACSHA512;
 
 template<class Digest>
 auto digest(const ceph::buffer::list& bl)