From: Marcus Watts Date: Mon, 22 Aug 2022 07:37:27 +0000 (-0400) Subject: common: hmacsha512 for radosgw X-Git-Tag: v17.2.8~88^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=13bba346ec4e7228bfd17396d6cc011fb7710072;p=ceph.git common: hmacsha512 for radosgw 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 (cherry picked from commit c32a042433887aadab49443809de66a2a33750cb) --- diff --git a/src/common/ceph_crypto.h b/src/common/ceph_crypto.h index bcdc0044cbd5..ee9a73eb4cd0 100644 --- a/src/common/ceph_crypto.h +++ b/src/common/ceph_crypto.h @@ -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 @@ -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 auto digest(const ceph::buffer::list& bl)