#include "common/ceph_crypto.h"
using ceph::crypto::SHA1;
-boost::optional<sha1_digest_info_t> buffer::list::sha1()
+boost::optional<sha1_digest_t> buffer::list::sha1()
{
ptr nb;
unsigned pos = 0;
SHA1 sha1_gen;
sha1_gen.Update((const unsigned char *)nb.c_str(), size);
sha1_gen.Final(fingerprint);
- sha1_digest_info_t fp_t(fingerprint);
+ sha1_digest_t fp_t(fingerprint);
return fp_t;
}
}
#endif // HAVE_SEASTAR
class deleter;
-struct sha1_digest_info_t;
+struct sha1_digest_t;
namespace ceph {
}
uint32_t crc32c(uint32_t crc) const;
void invalidate_crc();
- boost::optional<sha1_digest_info_t> sha1();
+ boost::optional<sha1_digest_t> sha1();
// These functions return a bufferlist with a pointer to a single
// static buffer. They /must/ not outlive the memory they
WRITE_EQ_OPERATORS_1(errorcode32_t, code)
WRITE_CMP_OPERATORS_1(errorcode32_t, code)
-struct sha1_digest_info_t {
+struct sha1_digest_t {
#define SHA1_DIGEST_SIZE 20
unsigned char v[SHA1_DIGEST_SIZE] = {0};
}
return string(str);
}
- sha1_digest_info_t(unsigned char *_v) {
+ sha1_digest_t(unsigned char *_v) {
memcpy(v, _v, 20);
};
- sha1_digest_info_t() {}
+ sha1_digest_t() {}
};
-inline ostream& operator<<(ostream& out, const sha1_digest_info_t& b)
+inline ostream& operator<<(ostream& out, const sha1_digest_t& b)
{
string str = b.to_str();
return out << str;
switch (fp_algo_t) {
case pg_pool_t::TYPE_FINGERPRINT_SHA1:
{
- boost::optional<sha1_digest_info_t> fp_t = chunk_data.sha1();
+ boost::optional<sha1_digest_t> fp_t = chunk_data.sha1();
object_t fp_oid;
bufferlist in;
if (fp_t != boost::none) {
extern void calc_hmac_sha1(const char *key, int key_len,
const char *msg, int msg_len, char *dest);
-using sha1_digest_t = \
+using sha1_digest_array_t = \
std::array<char, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE>;
-static inline sha1_digest_t
+static inline sha1_digest_array_t
calc_hmac_sha1(const boost::string_view& key, const boost::string_view& msg) {
- sha1_digest_t dest;
+ sha1_digest_array_t dest;
calc_hmac_sha1(key.data(), key.size(), msg.data(), msg.size(), dest.data());
return dest;
}