Fix up all of the fallout from that.
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -rdynamic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wstrict-null-sentinel -Woverloaded-virtual")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-new-ttp-matching")
if(NOT WITH_OSD_INSTRUMENT_FUNCTIONS)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
endif()
endif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64|x86_64")
endif(no_yasm)
-# require c++14
-if(CMAKE_VERSION VERSION_LESS "3.1")
+# require c++17
+if(CMAKE_VERSION VERSION_LESS "3.8")
include(CheckCXXCompilerFlag)
- CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
- if(NOT COMPILER_SUPPORTS_CXX14)
+ CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
+ if(NOT COMPILER_SUPPORTS_CXX17)
message(FATAL_ERROR
- "The compiler ${CMAKE_CXX_COMPILER} has no C++14 support.")
+ "The compiler ${CMAKE_CXX_COMPILER} has no C++17 support.")
endif()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
include(CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG("-std=gnu99" COMPILER_SUPPORTS_GNU99)
if(NOT COMPILER_SUPPORTS_GNU99)
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99")
else()
- set(CMAKE_CXX_STANDARD 14)
+ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_C_STANDARD 99)
class HMACSHA1: public CryptoPP::HMAC<CryptoPP::SHA1> {
public:
- HMACSHA1 (const byte *key, size_t length)
+ HMACSHA1 (const ::byte *key, size_t length)
: CryptoPP::HMAC<CryptoPP::SHA1>(key, length)
{
}
class HMACSHA256: public CryptoPP::HMAC<CryptoPP::SHA256> {
public:
- HMACSHA256 (const byte *key, size_t length)
+ HMACSHA256 (const ::byte *key, size_t length)
: CryptoPP::HMAC<CryptoPP::SHA256>(key, length)
{
}
s = PK11_DigestBegin(ctx);
assert(s == SECSuccess);
}
- void Update (const byte *input, size_t length) {
+ void Update (const ::byte *input, size_t length) {
if (length) {
SECStatus s;
s = PK11_DigestOp(ctx, input, length);
assert(s == SECSuccess);
}
}
- void Final (byte *digest) {
+ void Final (::byte *digest) {
SECStatus s;
unsigned int dummy;
s = PK11_DigestFinal(ctx, digest, &dummy, digest_size);
PK11Context *ctx;
unsigned int digest_size;
public:
- HMAC (CK_MECHANISM_TYPE cktype, unsigned int digestsize, const byte *key, size_t length) {
+ HMAC (CK_MECHANISM_TYPE cktype, unsigned int digestsize, const ::byte *key, size_t length) {
digest_size = digestsize;
slot = PK11_GetBestSlot(cktype, NULL);
assert(slot);
s = PK11_DigestBegin(ctx);
assert(s == SECSuccess);
}
- void Update (const byte *input, size_t length) {
+ void Update (const ::byte *input, size_t length) {
SECStatus s;
s = PK11_DigestOp(ctx, input, length);
assert(s == SECSuccess);
}
- void Final (byte *digest) {
+ void Final (::byte *digest) {
SECStatus s;
unsigned int dummy;
s = PK11_DigestFinal(ctx, digest, &dummy, digest_size);
class HMACSHA1 : public HMAC {
public:
- HMACSHA1 (const byte *key, size_t length) : HMAC(CKM_SHA_1_HMAC, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE, key, length) { }
+ HMACSHA1 (const ::byte *key, size_t length) : HMAC(CKM_SHA_1_HMAC, CEPH_CRYPTO_HMACSHA1_DIGESTSIZE, key, length) { }
};
class HMACSHA256 : public HMAC {
public:
- HMACSHA256 (const byte *key, size_t length) : HMAC(CKM_SHA256_HMAC, CEPH_CRYPTO_HMACSHA256_DIGESTSIZE, key, length) { }
+ HMACSHA256 (const ::byte *key, size_t length) : HMAC(CKM_SHA256_HMAC, CEPH_CRYPTO_HMACSHA256_DIGESTSIZE, key, length) { }
};
}
}
<< std::endl;
ceph_abort();
}
- schema.insert({i.name, i});
+ schema.emplace(std::piecewise_construct,
+ std::forward_as_tuple(i.name),
+ std::forward_as_tuple(i));
}
// Populate list of legacy_values according to the OPTION() definitions
#ifndef CEPH_CONFIG_H
#define CEPH_CONFIG_H
+#include <map>
#include "common/backport_std.h"
#include "common/ConfUtils.h"
#include "common/entity_name.h"
* The configuration schema, in the form of Option objects describing
* possible settings.
*/
- std::map<std::string, const Option &> schema;
+ std::map<std::string, const Option&> schema;
/**
* The current values of all settings described by the schema
do { \
if (cct->_conf->subsys.should_gather(sub, v)) { \
if (0) { \
- char __array[((v >= -1) && (v <= 200)) ? 0 : -1] __attribute__((unused)); \
+ [[maybe_unused]] char __array[((v >= -1) && (v <= 200)) ? 0 : -1] = {}; \
} \
static size_t _log_exp_length = 80; \
ceph::logging::Entry *_dout_e = cct->_log->create_entry(v, sub, &_log_exp_length); \
char hex[FILENAME_LFN_DIGEST_SIZE * 2];
SHA1 h;
- h.Update((const byte *)filename, strlen(filename));
- h.Final((byte *)buf);
+ h.Update((const ::byte *)filename, strlen(filename));
+ h.Final((::byte *)buf);
- buf_to_hex((byte *)buf, (FILENAME_HASH_LEN + 1) / 2, hex);
+ buf_to_hex((::byte *)buf, (FILENAME_HASH_LEN + 1) / 2, hex);
strncpy(hash, hex, FILENAME_HASH_LEN);
hash[FILENAME_HASH_LEN] = '\0';
return 0;
#define dout_context g_ceph_context
#define dout_subsys ceph_subsys_rgw
-using boost::none;
-using boost::optional;
-
using rgw::IAM::ARN;
using rgw::IAM::Effect;
using rgw::IAM::op_to_perm;
}
namespace {
-Effect eval_or_pass(const optional<Policy>& policy,
- const rgw::IAM::Environment& env,
- const rgw::auth::Identity& id,
- const uint64_t op,
- const ARN& arn) {
+Effect eval_or_pass(const boost::optional<Policy>& policy,
+ const rgw::IAM::Environment& env,
+ const rgw::auth::Identity& id,
+ const uint64_t op,
+ const ARN& arn) {
if (!policy)
return Effect::Pass;
else
const rgw_bucket& bucket,
RGWAccessControlPolicy * const user_acl,
RGWAccessControlPolicy * const bucket_acl,
- const optional<Policy>& bucket_policy,
+ const boost::optional<Policy>& bucket_policy,
const uint64_t op)
{
if (!verify_requester_payer_permission(s))
const rgw_bucket& bucket,
RGWAccessControlPolicy * const user_acl,
RGWAccessControlPolicy * const bucket_acl,
- const optional<Policy>& bucket_policy,
+ const boost::optional<Policy>& bucket_policy,
const uint8_t deferred_check,
const uint64_t op)
{
RGWAccessControlPolicy * const user_acl,
RGWAccessControlPolicy * const bucket_acl,
RGWAccessControlPolicy * const object_acl,
- const optional<Policy>& bucket_policy,
+ const boost::optional<Policy>& bucket_policy,
const uint64_t op)
{
if (!verify_requester_payer_permission(s))
#ifdef USE_CRYPTOPP
bool encrypt(bufferlist& input, off_t in_ofs, size_t size, bufferlist& output, off_t stream_offset) {
- byte iv[AES_256_IVSIZE];
+ ::byte iv[AES_256_IVSIZE];
ldout(cct, 25)
<< "Encrypt in_ofs " << in_ofs
<< " size=" << size
CTR_Mode< AES >::Encryption e;
e.SetKeyWithIV(key, AES_256_KEYSIZE, iv, AES_256_IVSIZE);
buf.zero();
- e.ProcessData((byte*)buf.c_str(), (byte*)buf.c_str(), buf.length());
+ e.ProcessData((::byte*)buf.c_str(), (::byte*)buf.c_str(), buf.length());
buf.set_length(size);
off_t plaintext_pos = in_ofs;
off_t crypt_pos = 0;
}
while (iter != input.buffers().end()) {
off_t cnt = std::min<off_t>(iter->length() - plaintext_pos, size - crypt_pos);
- byte* src = (byte*)iter->c_str() + plaintext_pos;
- byte* dst = (byte*)buf.c_str() + crypt_pos;
+ auto src = (::byte*)iter->c_str() + plaintext_pos;
+ auto dst = (::byte*)buf.c_str() + crypt_pos;
for (off_t i = 0; i < cnt; i++) {
dst[i] ^= src[i];
}
return encrypt(input, in_ofs, size, output, stream_offset);
}
- void prepare_iv(byte iv[AES_256_IVSIZE], off_t offset) {
+ void prepare_iv(::byte iv[AES_256_IVSIZE], off_t offset) {
off_t index = offset / AES_256_IVSIZE;
off_t i = AES_256_IVSIZE - 1;
unsigned int val;
}
- void prepare_iv(byte (&iv)[AES_256_IVSIZE], off_t offset) {
+ void prepare_iv(::byte (&iv)[AES_256_IVSIZE], off_t offset) {
off_t index = offset / AES_256_IVSIZE;
off_t i = AES_256_IVSIZE - 1;
unsigned int val;
}
MD5 key_hash;
- byte key_hash_res[CEPH_CRYPTO_MD5_DIGESTSIZE];
- key_hash.Update(reinterpret_cast<const byte*>(key_bin.c_str()), key_bin.size());
+ ::byte key_hash_res[CEPH_CRYPTO_MD5_DIGESTSIZE];
+ key_hash.Update(reinterpret_cast<const ::byte*>(key_bin.c_str()), key_bin.size());
key_hash.Final(key_hash_res);
if (memcmp(key_hash_res, keymd5_bin.c_str(), CEPH_CRYPTO_MD5_DIGESTSIZE) != 0) {
MD5 key_hash;
uint8_t key_hash_res[CEPH_CRYPTO_MD5_DIGESTSIZE];
- key_hash.Update(reinterpret_cast<const byte*>(key_bin.c_str()), key_bin.size());
+ key_hash.Update(reinterpret_cast<const ::byte*>(key_bin.c_str()), key_bin.size());
key_hash.Final(key_hash_res);
if ((memcmp(key_hash_res, keymd5_bin.c_str(), CEPH_CRYPTO_MD5_DIGESTSIZE) != 0) ||
if (need_to_wait) {
orig_data = data;
}
- hash.Update((const byte *)data.c_str(), data.length());
+ hash.Update((const ::byte *)data.c_str(), data.length());
op_ret = put_data_and_throttle(filter, data, ofs, need_to_wait);
if (op_ret < 0) {
if (!need_to_wait || op_ret != -EEXIST) {
using std::unordered_map;
using boost::container::flat_set;
-using boost::none;
-using boost::optional;
using boost::regex;
using boost::regex_constants::ECMAScript;
using boost::regex_constants::optimize;
};
namespace {
-optional<Partition> to_partition(const smatch::value_type& p,
- bool wildcards) {
+boost::optional<Partition> to_partition(const smatch::value_type& p,
+ bool wildcards) {
if (p == "aws") {
return Partition::aws;
} else if (p == "aws-cn") {
} else if (p == "*" && wildcards) {
return Partition::wildcard;
} else {
- return none;
+ return boost::none;
}
ceph_abort();
}
-optional<Service> to_service(const smatch::value_type& s,
- bool wildcards) {
+boost::optional<Service> to_service(const smatch::value_type& s,
+ bool wildcards) {
static const unordered_map<string, Service> services = {
{ "acm", Service::acm },
{ "apigateway", Service::apigateway },
auto i = services.find(s);
if (i == services.end()) {
- return none;
+ return boost::none;
} else {
return i->second;
}
resource.append(o);
}
-optional<ARN> ARN::parse(const string& s, bool wildcards) {
+boost::optional<ARN> ARN::parse(const string& s, bool wildcards) {
static const char str_wild[] = "arn:([^:]*):([^:]*):([^:]*):([^:]*):([^:]*)";
static const regex rx_wild(str_wild,
sizeof(str_wild) - 1,
}
}
}
- return none;
+ return boost::none;
}
string ARN::to_string() const {
// I should just rewrite a few helper functions to use iterators,
// which will make all of this ever so much nicer.
-static optional<Principal> parse_principal(CephContext* cct, TokenID t,
- string&& s) {
+static boost::optional<Principal> parse_principal(CephContext* cct, TokenID t,
+ string&& s) {
// Wildcard!
if ((t == TokenID::AWS) && (s == "*")) {
return Principal::wildcard();
}
}
-optional<MaskedIP> Condition::as_network(const string& s) {
+boost::optional<MaskedIP> Condition::as_network(const string& s) {
MaskedIP m;
if (s.empty()) {
- return none;
+ return boost::none;
}
m.v6 = (s.find(':') == string::npos) ? false : true;
m.prefix = strtoul(s.data() + slash + 1, &end, 10);
if (*end != 0 || (m.v6 && m.prefix > 128) ||
(!m.v6 && m.prefix > 32)) {
- return none;
+ return boost::none;
}
}
if (m.v6) {
struct in6_addr a;
if (inet_pton(AF_INET6, p->c_str(), static_cast<void*>(&a)) != 1) {
- return none;
+ return boost::none;
}
m.addr |= Address(a.s6_addr[15]) << 0;
} else {
struct in_addr a;
if (inet_pton(AF_INET, p->c_str(), static_cast<void*>(&a)) != 1) {
- return none;
+ return boost::none;
}
m.addr = ntohl(a.s_addr);
}
Effect Statement::eval(const Environment& e,
- optional<const rgw::auth::Identity&> ida,
+ boost::optional<const rgw::auth::Identity&> ida,
uint64_t act, const ARN& res) const {
if (ida && (!ida->is_identity(princ) || ida->is_identity(noprinc))) {
return Effect::Pass;
}
Effect Policy::eval(const Environment& e,
- optional<const rgw::auth::Identity&> ida,
+ boost::optional<const rgw::auth::Identity&> ida,
std::uint64_t action, const ARN& resource) const {
auto allowed = false;
for (auto& s : statements) {
unsigned char m[CEPH_CRYPTO_MD5_DIGESTSIZE];
MD5 hash;
- hash.Update((const byte *)token.c_str(), token.size());
+ hash.Update((const ::byte *)token.c_str(), token.size());
hash.Final(m);
char calc_md5[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 1];
return get_bucket_instance_policy_from_attr(cct, store, bucket_info, bucket_attrs, policy);
}
-static optional<Policy> get_iam_policy_from_attr(CephContext* cct,
- RGWRados* store,
- map<string, bufferlist>& attrs,
- const string& tenant) {
+static boost::optional<Policy> get_iam_policy_from_attr(CephContext* cct,
+ RGWRados* store,
+ map<string, bufferlist>& attrs,
+ const string& tenant) {
auto i = attrs.find(RGW_ATTR_IAM_POLICY);
if (i != attrs.end()) {
return Policy(cct, tenant, i->second);
RGWBucketInfo& bucket_info,
map<string, bufferlist>& bucket_attrs,
RGWAccessControlPolicy* acl,
- optional<Policy>& policy,
+ boost::optional<Policy>& policy,
rgw_bucket& bucket,
rgw_obj_key& object)
{
int RGWGetObj::read_user_manifest_part(rgw_bucket& bucket,
const rgw_bucket_dir_entry& ent,
RGWAccessControlPolicy * const bucket_acl,
- const optional<Policy>& bucket_policy,
+ const boost::optional<Policy>& bucket_policy,
const off_t start_ofs,
const off_t end_ofs)
{
RGWBucketInfo *pbucket_info,
const string& obj_prefix,
RGWAccessControlPolicy * const bucket_acl,
- const optional<Policy>& bucket_policy,
+ const boost::optional<Policy>& bucket_policy,
uint64_t * const ptotal_len,
uint64_t * const pobj_size,
string * const pobj_sum,
int (*cb)(rgw_bucket& bucket,
const rgw_bucket_dir_entry& ent,
RGWAccessControlPolicy * const bucket_acl,
- const optional<Policy>& bucket_policy,
+ const boost::optional<Policy>& bucket_policy,
off_t start_ofs,
off_t end_ofs,
void *param),
obj_ofs += obj_size;
if (pobj_sum) {
- etag_sum.Update((const byte *)ent.meta.etag.c_str(),
+ etag_sum.Update((const ::byte *)ent.meta.etag.c_str(),
ent.meta.etag.length());
}
int (*cb)(rgw_bucket& bucket,
const rgw_bucket_dir_entry& ent,
RGWAccessControlPolicy *bucket_acl,
- const optional<Policy>& bucket_policy,
+ const boost::optional<Policy>& bucket_policy,
off_t start_ofs,
off_t end_ofs,
void *param),
// SLO is a Swift thing, and Swift has no knowledge of S3 Policies.
int r = cb(part.bucket, ent, part.bucket_acl,
(part.bucket_policy ?
- optional<Policy>(*part.bucket_policy) : none),
+ boost::optional<Policy>(*part.bucket_policy) : none),
start_ofs, end_ofs, cb_param);
if (r < 0)
return r;
static int get_obj_user_manifest_iterate_cb(rgw_bucket& bucket,
const rgw_bucket_dir_entry& ent,
RGWAccessControlPolicy * const bucket_acl,
- const optional<Policy>& bucket_policy,
+ const boost::optional<Policy>& bucket_policy,
const off_t start_ofs,
const off_t end_ofs,
void * const param)
RGWAccessControlPolicy _bucket_acl(s->cct);
RGWAccessControlPolicy *bucket_acl;
- optional<Policy> _bucket_policy;
- optional<Policy>* bucket_policy;
+ boost::optional<Policy> _bucket_policy;
+ boost::optional<Policy>* bucket_policy;
RGWBucketInfo bucket_info;
RGWBucketInfo *pbucket_info;
ldout(s->cct, 2) << "RGWGetObj::handle_slo_manifest()" << dendl;
vector<RGWAccessControlPolicy> allocated_acls;
- map<string, pair<RGWAccessControlPolicy *, optional<Policy>>> policies;
+ map<string, pair<RGWAccessControlPolicy *, boost::optional<Policy>>> policies;
map<string, rgw_bucket> buckets;
map<uint64_t, rgw_slo_part> slo_parts;
<< " etag=" << part.etag
<< dendl;
- etag_sum.Update((const byte *)entry.etag.c_str(),
+ etag_sum.Update((const ::byte *)entry.etag.c_str(),
entry.etag.length());
slo_parts[total_len] = part;
if (copy_source) {
RGWAccessControlPolicy cs_acl(s->cct);
- optional<Policy> policy;
+ boost::optional<Policy> policy;
map<string, bufferlist> cs_attrs;
rgw_bucket cs_bucket(copy_source_bucket_info.bucket);
rgw_obj_key cs_object(copy_source_object_name, copy_source_version_id);
}
if (need_calc_md5) {
- hash.Update((const byte *)data.c_str(), data.length());
+ hash.Update((const ::byte *)data.c_str(), data.length());
}
/* update torrrent */
::encode(*slo_info, manifest_bl);
emplace_attr(RGW_ATTR_SLO_MANIFEST, std::move(manifest_bl));
- hash.Update((byte *)slo_info->raw_data, slo_info->raw_data_len);
+ hash.Update((::byte *)slo_info->raw_data, slo_info->raw_data_len);
complete_etag(hash, &etag);
ldout(s->cct, 10) << __func__ << ": calculated md5 for user manifest: " << etag << dendl;
}
break;
}
- hash.Update((const byte *)data.c_str(), data.length());
+ hash.Update((const ::byte *)data.c_str(), data.length());
op_ret = put_data_and_throttle(filter, data, ofs, false);
ofs += len;
int RGWCopyObj::verify_permission()
{
RGWAccessControlPolicy src_acl(s->cct);
- optional<Policy> src_policy;
+ boost::optional<Policy> src_policy;
op_ret = get_params();
if (op_ret < 0)
return op_ret;
MD5 data_hash;
unsigned char data_hash_res[CEPH_CRYPTO_MD5_DIGESTSIZE];
- data_hash.Update(reinterpret_cast<const byte*>(data), len);
+ data_hash.Update(reinterpret_cast<const ::byte*>(data), len);
data_hash.Final(data_hash_res);
if (memcmp(data_hash_res, content_md5_bin.c_str(), CEPH_CRYPTO_MD5_DIGESTSIZE) != 0) {
hex_to_buf(obj_iter->second.etag.c_str(), petag,
CEPH_CRYPTO_MD5_DIGESTSIZE);
- hash.Update((const byte *)petag, sizeof(petag));
+ hash.Update((const ::byte *)petag, sizeof(petag));
RGWUploadPartInfo& obj_part = obj_iter->second;
accounted_size += obj_part.accounted_size;
}
} while (truncated);
- hash.Final((byte *)final_etag);
+ hash.Final((::byte *)final_etag);
buf_to_hex((unsigned char *)final_etag, sizeof(final_etag), final_etag_str);
snprintf(&final_etag_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2], sizeof(final_etag_str) - CEPH_CRYPTO_MD5_DIGESTSIZE * 2,
op_ret = len;
return op_ret;
} else if (len > 0) {
- hash.Update((const byte *)data.c_str(), data.length());
+ hash.Update((const ::byte *)data.c_str(), data.length());
op_ret = put_data_and_throttle(filter, data, ofs, false);
if (op_ret < 0) {
ldout(s->cct, 20) << "processor->thottle_data() returned ret="
char etag_buf[CEPH_CRYPTO_MD5_DIGESTSIZE];
char etag_buf_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 16];
- hash.Final((byte *)etag_buf);
+ hash.Final((::byte *)etag_buf);
buf_to_hex((const unsigned char *)etag_buf, CEPH_CRYPTO_MD5_DIGESTSIZE,
etag_buf_str);
{
unsigned char md5[CEPH_CRYPTO_MD5_DIGESTSIZE];
MD5 hash;
- hash.Update((const byte *)zone_id.c_str(), zone_id.size());
+ hash.Update((const ::byte *)zone_id.c_str(), zone_id.size());
hash.Final(md5);
uint32_t short_id;
unsigned char md5[CEPH_CRYPTO_MD5_DIGESTSIZE];
char md5_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 1];
MD5 hash;
- hash.Update((const byte *)new_realm_name.c_str(), new_realm_name.length());
+ hash.Update((const ::byte *)new_realm_name.c_str(), new_realm_name.length());
hash.Final(md5);
buf_to_hex(md5, CEPH_CRYPTO_MD5_DIGESTSIZE, md5_str);
string new_realm_id(md5_str);
unsigned char md5[CEPH_CRYPTO_MD5_DIGESTSIZE];
char md5_str[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 1];
MD5 hash;
- hash.Update((const byte *)manifest_bl.c_str(), manifest_bl.length());
+ hash.Update((const ::byte *)manifest_bl.c_str(), manifest_bl.length());
map<string, bufferlist>::iterator iter = attrset.find(RGW_ATTR_ETAG);
if (iter != attrset.end()) {
bufferlist& bl = iter->second;
- hash.Update((const byte *)bl.c_str(), bl.length());
+ hash.Update((const ::byte *)bl.c_str(), bl.length());
}
hash.Final(md5);
MD5 etag_sum;
uint64_t total_size = 0;
for (const auto& entry : slo_info->entries) {
- etag_sum.Update((const byte *)entry.etag.c_str(),
+ etag_sum.Update((const ::byte *)entry.etag.c_str(),
entry.etag.length());
total_size += entry.size_bytes;
for (off_t i = 0; i < num; i++)
{
memset(sha, 0x00, sizeof(sha));
- h->Update((byte *)pstr, info.piece_length);
- h->Final((byte *)sha);
+ h->Update((::byte *)pstr, info.piece_length);
+ h->Final((::byte *)sha);
set_info_pieces(sha);
pstr += info.piece_length;
}
if (0 != remain)
{
memset(sha, 0x00, sizeof(sha));
- h->Update((byte *)pstr, remain);
- h->Final((byte *)sha);
+ h->Update((::byte *)pstr, remain);
+ h->Final((::byte *)sha);
set_info_pieces(sha);
}
}
TEST(MD5, Simple) {
ceph::crypto::MD5 h;
- h.Update((const byte*)"foo", 3);
+ h.Update((const ::byte*)"foo", 3);
unsigned char digest[CEPH_CRYPTO_MD5_DIGESTSIZE];
h.Final(digest);
int err;
TEST(MD5, MultiUpdate) {
ceph::crypto::MD5 h;
- h.Update((const byte*)"", 0);
- h.Update((const byte*)"fo", 2);
- h.Update((const byte*)"", 0);
- h.Update((const byte*)"o", 1);
- h.Update((const byte*)"", 0);
+ h.Update((const ::byte*)"", 0);
+ h.Update((const ::byte*)"fo", 2);
+ h.Update((const ::byte*)"", 0);
+ h.Update((const ::byte*)"o", 1);
+ h.Update((const ::byte*)"", 0);
unsigned char digest[CEPH_CRYPTO_MD5_DIGESTSIZE];
h.Final(digest);
int err;
TEST(MD5, Restart) {
ceph::crypto::MD5 h;
- h.Update((const byte*)"bar", 3);
+ h.Update((const ::byte*)"bar", 3);
h.Restart();
- h.Update((const byte*)"foo", 3);
+ h.Update((const ::byte*)"foo", 3);
unsigned char digest[CEPH_CRYPTO_MD5_DIGESTSIZE];
h.Final(digest);
int err;
}
TEST(HMACSHA1, Simple) {
- ceph::crypto::HMACSHA1 h((const byte*)"sekrit", 6);
- h.Update((const byte*)"foo", 3);
+ ceph::crypto::HMACSHA1 h((const ::byte*)"sekrit", 6);
+ h.Update((const ::byte*)"foo", 3);
unsigned char digest[CEPH_CRYPTO_HMACSHA1_DIGESTSIZE];
h.Final(digest);
int err;
}
TEST(HMACSHA1, MultiUpdate) {
- ceph::crypto::HMACSHA1 h((const byte*)"sekrit", 6);
- h.Update((const byte*)"", 0);
- h.Update((const byte*)"fo", 2);
- h.Update((const byte*)"", 0);
- h.Update((const byte*)"o", 1);
- h.Update((const byte*)"", 0);
+ ceph::crypto::HMACSHA1 h((const ::byte*)"sekrit", 6);
+ h.Update((const ::byte*)"", 0);
+ h.Update((const ::byte*)"fo", 2);
+ h.Update((const ::byte*)"", 0);
+ h.Update((const ::byte*)"o", 1);
+ h.Update((const ::byte*)"", 0);
unsigned char digest[CEPH_CRYPTO_HMACSHA1_DIGESTSIZE];
h.Final(digest);
int err;
}
TEST(HMACSHA1, Restart) {
- ceph::crypto::HMACSHA1 h((const byte*)"sekrit", 6);
- h.Update((const byte*)"bar", 3);
+ ceph::crypto::HMACSHA1 h((const ::byte*)"sekrit", 6);
+ h.Update((const ::byte*)"bar", 3);
h.Restart();
- h.Update((const byte*)"foo", 3);
+ h.Update((const ::byte*)"foo", 3);
unsigned char digest[CEPH_CRYPTO_HMACSHA1_DIGESTSIZE];
h.Final(digest);
int err;
// not exit status 0
ceph::crypto::init(g_ceph_context);
ceph::crypto::MD5 h;
- h.Update((const byte*)"foo", 3);
+ h.Update((const ::byte*)"foo", 3);
unsigned char digest[CEPH_CRYPTO_MD5_DIGESTSIZE];
h.Final(digest);
exit(0);
using boost::intrusive_ptr;
using boost::make_optional;
using boost::none;
-using boost::optional;
using rgw::auth::Identity;
using rgw::auth::Principal;
};
TEST_F(PolicyTest, Parse1) {
- optional<Policy> p;
+ boost::optional<Policy> p;
ASSERT_NO_THROW(p = Policy(cct.get(), arbitrary_tenant,
bufferlist::static_from_string(example1)));
}
TEST_F(PolicyTest, Parse2) {
- optional<Policy> p;
+ boost::optional<Policy> p;
ASSERT_NO_THROW(p = Policy(cct.get(), arbitrary_tenant,
bufferlist::static_from_string(example2)));
}
TEST_F(PolicyTest, Parse3) {
- optional<Policy> p;
+ boost::optional<Policy> p;
ASSERT_NO_THROW(p = Policy(cct.get(), arbitrary_tenant,
bufferlist::static_from_string(example3)));
}
TEST_F(IPPolicyTest, ParseIPAddress) {
- optional<Policy> p;
+ boost::optional<Policy> p;
ASSERT_NO_THROW(p = Policy(cct.get(), arbitrary_tenant,
bufferlist::static_from_string(ip_address_full_example)));
EXPECT_EQ(p->statements[0].conditions[0].vals.size(), 2U);
EXPECT_EQ(p->statements[0].conditions[0].vals[0], "192.168.1.0/24");
EXPECT_EQ(p->statements[0].conditions[0].vals[1], "::1");
- optional<rgw::IAM::MaskedIP> convertedIPv4 = rgw::IAM::Condition::as_network(p->statements[0].conditions[0].vals[0]);
+ boost::optional<rgw::IAM::MaskedIP> convertedIPv4 = rgw::IAM::Condition::as_network(p->statements[0].conditions[0].vals[0]);
EXPECT_TRUE(convertedIPv4.is_initialized());
if (convertedIPv4.is_initialized()) {
EXPECT_EQ(*convertedIPv4, allowedIPv4Range);
EXPECT_EQ(p->statements[0].conditions[1].vals.size(), 2U);
EXPECT_EQ(p->statements[0].conditions[1].vals[0], "192.168.1.1/32");
EXPECT_EQ(p->statements[0].conditions[1].vals[1], "2001:0db8:85a3:0000:0000:8a2e:0370:7334");
- optional<rgw::IAM::MaskedIP> convertedIPv6 = rgw::IAM::Condition::as_network(p->statements[0].conditions[1].vals[1]);
+ boost::optional<rgw::IAM::MaskedIP> convertedIPv6 = rgw::IAM::Condition::as_network(p->statements[0].conditions[1].vals[1]);
EXPECT_TRUE(convertedIPv6.is_initialized());
if (convertedIPv6.is_initialized()) {
EXPECT_EQ(*convertedIPv6, allowedIPv6);