int rgw_s3_prepare_decrypt(req_state* s, optional_yield y,
map<string, bufferlist>& attrs,
std::unique_ptr<BlockCrypt>* block_crypt,
- std::map<std::string, std::string>* crypt_http_responses)
+ std::map<std::string, std::string>* crypt_http_responses,
+ bool copy_source)
{
- const bool copy_source = s->src_object != nullptr;
-
int res = 0;
std::string stored_mode = get_str_attribute(attrs, RGW_ATTR_CRYPT_MODE);
ldpp_dout(s, 15) << "Encryption mode: " << stored_mode << dendl;
int rgw_s3_prepare_decrypt(req_state* s, optional_yield y,
std::map<std::string, ceph::bufferlist>& attrs,
std::unique_ptr<BlockCrypt>* block_crypt,
- std::map<std::string,
- std::string>* crypt_http_responses);
+ std::map<std::string, std::string>* crypt_http_responses,
+ bool copy_source);
static inline void set_attr(std::map<std::string, bufferlist>& attrs,
const char* key,
// decrypt
if (src_encrypted) {
auto attr_iter = s->src_object->get_attrs().find(RGW_ATTR_MANIFEST);
+ static constexpr bool copy_source = true;
ret = get_decrypt_filter(&decrypt, filter, s, s->src_object->get_attrs(),
attr_iter != s->src_object->get_attrs().end() ? &attr_iter->second : nullptr,
- nullptr);
+ nullptr, copy_source);
if (ret < 0) {
return ret;
}
req_state* s,
std::map<std::string, bufferlist>& attrs,
bufferlist* manifest_bl,
- std::map<std::string, std::string>* crypt_http_responses)
+ std::map<std::string, std::string>* crypt_http_responses,
+ bool copy_source)
{
std::unique_ptr<BlockCrypt> block_crypt;
int res = rgw_s3_prepare_decrypt(s, s->yield, attrs, &block_crypt,
- crypt_http_responses);
+ crypt_http_responses, copy_source);
if (res < 0) {
return res;
}
return 0;
}
- return ::get_decrypt_filter(filter, cb, s, attrs, manifest_bl, &crypt_http_responses);
+ static constexpr bool copy_source = false;
+ return ::get_decrypt_filter(filter, cb, s, attrs, manifest_bl, &crypt_http_responses, copy_source);
}
int RGWGetObj_ObjStore_S3::verify_requester(const rgw::auth::StrategyRegistry& auth_registry, optional_yield y)
map<string, bufferlist>& attrs,
bufferlist* manifest_bl)
{
- return ::get_decrypt_filter(filter, cb, s, attrs, manifest_bl, nullptr);
+ static constexpr bool copy_source = true;
+ return ::get_decrypt_filter(filter, cb, s, attrs, manifest_bl, nullptr, copy_source);
}
int RGWPutObj_ObjStore_S3::get_encrypt_filter(
std::unique_ptr<BlockCrypt> block_crypt;
/* We are adding to existing object.
* We use crypto mode that configured as if we were decrypting. */
+ static constexpr bool copy_source = false;
res = rgw_s3_prepare_decrypt(s, s->yield, obj->get_attrs(),
- &block_crypt, &crypt_http_responses);
+ &block_crypt, &crypt_http_responses, copy_source);
if (res == 0 && block_crypt != nullptr)
filter->reset(new RGWPutObj_BlockEncrypt(s, s->cct, cb, std::move(block_crypt), s->yield));
}
//
// in the SSE-KMS and SSE-S3 cases, this unfortunately causes us to fetch
// decryption keys which we don't need :(
- std::unique_ptr<BlockCrypt> block_crypt; // ignored
- return rgw_s3_prepare_decrypt(s, s->yield, attrs, &block_crypt,
- nullptr);
+ static constexpr bool copy_source = false;
+ return rgw_s3_prepare_decrypt(s, s->yield, attrs, nullptr,
+ nullptr, copy_source);
}
void RGWGetObjAttrs_ObjStore_S3::send_response()