File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -1024,12 +1024,13 @@ get_v2_signature(CephContext* const cct,
10241024
10251025 const auto digest = calc_hmac_sha1 (secret_key, string_to_sign);
10261026
1027- /* 64 is really enough */ ;
1028- char buf[64 ];
1029- const int ret = ceph_armor (std::begin (buf),
1030- std::begin (buf) + 64 ,
1031- reinterpret_cast <const char *>(digest.v ),
1032- reinterpret_cast <const char *>(digest.v + digest.SIZE ));
1027+ /* Sized for signature */ ;
1028+ char buf[AWSEngine::VersionAbstractor::SIGNATURE_MAX_SIZE];
1029+ const int ret = ceph_armor (
1030+ std::begin (buf),
1031+ std::begin (buf) + AWSEngine::VersionAbstractor::SIGNATURE_MAX_SIZE,
1032+ reinterpret_cast <const char *>(digest.v ),
1033+ reinterpret_cast <const char *>(digest.v + digest.SIZE ));
10331034 if (ret < 0 ) {
10341035 ldout (cct, 10 ) << " ceph_armor failed" << dendl;
10351036 throw ret;
Original file line number Diff line number Diff line change @@ -958,13 +958,14 @@ class AWSEngine : public rgw::auth::Engine {
958958 static constexpr size_t DIGEST_SIZE_V2 = CEPH_CRYPTO_HMACSHA1_DIGESTSIZE;
959959 static constexpr size_t DIGEST_SIZE_V4 = CEPH_CRYPTO_HMACSHA256_DIGESTSIZE;
960960
961+ public:
962+
961963 /* Knowing the signature max size allows us to employ the sstring, and thus
962964 * avoid dynamic allocations. The multiplier comes from representing digest
963965 * in the base64-encoded form. */
964966 static constexpr size_t SIGNATURE_MAX_SIZE = \
965967 std::max (DIGEST_SIZE_V2, DIGEST_SIZE_V4) * 2 + sizeof (' \0 ' );
966968
967- public:
968969 virtual ~VersionAbstractor () {};
969970
970971 using access_key_id_t = std::string_view;
You can’t perform that action at this time.
0 commit comments