const auto digest = calc_hmac_sha1(secret_key, string_to_sign);
- /* 64 is really enough */;
- char buf[64];
- const int ret = ceph_armor(std::begin(buf),
- std::begin(buf) + 64,
- reinterpret_cast<const char *>(digest.v),
- reinterpret_cast<const char *>(digest.v + digest.SIZE));
+ /* Sized for signature */;
+ char buf[AWSEngine::VersionAbstractor::SIGNATURE_MAX_SIZE];
+ const int ret = ceph_armor(
+ std::begin(buf),
+ std::begin(buf) + AWSEngine::VersionAbstractor::SIGNATURE_MAX_SIZE,
+ reinterpret_cast<const char*>(digest.v),
+ reinterpret_cast<const char*>(digest.v + digest.SIZE));
if (ret < 0) {
ldout(cct, 10) << "ceph_armor failed" << dendl;
throw ret;
static constexpr size_t DIGEST_SIZE_V2 = CEPH_CRYPTO_HMACSHA1_DIGESTSIZE;
static constexpr size_t DIGEST_SIZE_V4 = CEPH_CRYPTO_HMACSHA256_DIGESTSIZE;
+ public:
+
/* Knowing the signature max size allows us to employ the sstring, and thus
* avoid dynamic allocations. The multiplier comes from representing digest
* in the base64-encoded form. */
static constexpr size_t SIGNATURE_MAX_SIZE = \
std::max(DIGEST_SIZE_V2, DIGEST_SIZE_V4) * 2 + sizeof('\0');
- public:
virtual ~VersionAbstractor() {};
using access_key_id_t = std::string_view;