common,rgw: rename sha1_digest_t

rename existing sha1_digest_t to sha1_digest_array_t
and add a new sha1_digest_t

Signed-off-by: Myoungwon Oh <omwmw@sk.com>
This commit is contained in:
myoungwon oh 2018-09-08 02:06:47 +09:00
parent 917062df08
commit da749d6336
5 changed files with 12 additions and 12 deletions

View File

@ -2467,7 +2467,7 @@ void buffer::list::invalidate_crc()
#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;
@ -2486,7 +2486,7 @@ boost::optional<sha1_digest_info_t> buffer::list::sha1()
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;
}

View File

@ -82,7 +82,7 @@ class packet;
}
#endif // HAVE_SEASTAR
class deleter;
struct sha1_digest_info_t;
struct sha1_digest_t;
namespace ceph {
@ -956,7 +956,7 @@ namespace buffer CEPH_BUFFER_API {
}
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

View File

@ -541,7 +541,7 @@ WRITE_CLASS_ENCODER(errorcode32_t)
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};
@ -553,13 +553,13 @@ struct sha1_digest_info_t {
}
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;

View File

@ -2619,7 +2619,7 @@ int PrimaryLogPG::do_manifest_flush(OpRequestRef op, ObjectContextRef obc, Flush
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) {

View File

@ -2319,12 +2319,12 @@ extern std::string url_encode(const std::string& src, bool encode_slash = true);
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;
}