mirror of
https://github.com/codership/wsrep-lib.git
synced 2025-07-28 20:02:00 +03:00
Revert "codership/mariadb-wsrep#27 Galera cache encryption"
This reverts commit 7e9419e811
.
This commit is contained in:
@ -626,18 +626,6 @@ wsrep::server_state::wait_for_gtid(const wsrep::gtid& gtid, int timeout)
|
||||
return provider().wait_for_gtid(gtid, timeout);
|
||||
}
|
||||
|
||||
int
|
||||
wsrep::server_state::set_encryption_key(std::vector<unsigned char>& key)
|
||||
{
|
||||
encryption_key_ = key;
|
||||
if (state_ != s_disconnected)
|
||||
{
|
||||
return provider_->enc_set_key(wsrep::const_buffer(encryption_key_.data(),
|
||||
encryption_key_.size()));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::pair<wsrep::gtid, enum wsrep::provider::status>
|
||||
wsrep::server_state::causal_read(int timeout) const
|
||||
{
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "wsrep_provider_v26.hpp"
|
||||
|
||||
#include "wsrep/server_state.hpp"
|
||||
#include "wsrep/server_service.hpp"
|
||||
#include "wsrep/high_priority_service.hpp"
|
||||
#include "wsrep/view.hpp"
|
||||
#include "wsrep/exception.hpp"
|
||||
@ -422,36 +421,14 @@ namespace
|
||||
}
|
||||
}
|
||||
|
||||
int encrypt_cb(void* app_ctx,
|
||||
wsrep_enc_ctx_t* enc_ctx,
|
||||
const wsrep_buf_t* input,
|
||||
void* output,
|
||||
wsrep_enc_direction_t direction,
|
||||
bool last)
|
||||
wsrep_cb_status_t encrypt_cb(void* /* app ctx */,
|
||||
wsrep_enc_ctx_t* /*ctx*/,
|
||||
const wsrep_buf_t* /*input*/,
|
||||
void* /*output*/,
|
||||
wsrep_enc_direction_t /*direction*/,
|
||||
bool /*final*/)
|
||||
{
|
||||
assert(app_ctx);
|
||||
wsrep::server_state& server_state(
|
||||
*static_cast<wsrep::server_state*>(app_ctx));
|
||||
|
||||
|
||||
wsrep::const_buffer key(enc_ctx->key->ptr, enc_ctx->key->len);
|
||||
wsrep::const_buffer in(input->ptr, input->len);
|
||||
try
|
||||
{
|
||||
return server_state.server_service().do_crypt(&enc_ctx->ctx,
|
||||
key,
|
||||
enc_ctx->iv,
|
||||
in,
|
||||
output,
|
||||
direction == WSREP_ENC,
|
||||
last);
|
||||
}
|
||||
catch (const wsrep::runtime_error& e)
|
||||
{
|
||||
free(enc_ctx->ctx);
|
||||
// Return negative value in case of callback error
|
||||
return -1;
|
||||
}
|
||||
return WSREP_CB_SUCCESS;
|
||||
}
|
||||
|
||||
wsrep_cb_status_t apply_cb(void* ctx,
|
||||
@ -605,16 +582,6 @@ wsrep::wsrep_provider_v26::wsrep_provider_v26(
|
||||
{
|
||||
throw wsrep::runtime_error("Failed to initialize wsrep provider");
|
||||
}
|
||||
|
||||
const std::vector<unsigned char>& key = server_state.get_encryption_key();
|
||||
if (key.size())
|
||||
{
|
||||
wsrep::const_buffer const_key(key.data(), key.size());
|
||||
if(enc_set_key(const_key))
|
||||
{
|
||||
throw wsrep::runtime_error("Failed to set encryption key");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wsrep::wsrep_provider_v26::~wsrep_provider_v26()
|
||||
@ -889,16 +856,6 @@ int wsrep::wsrep_provider_v26::sst_received(const wsrep::gtid& gtid, int err)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wsrep::wsrep_provider_v26::enc_set_key(const wsrep::const_buffer& key)
|
||||
{
|
||||
wsrep_enc_key_t enc_key = {key.data(), key.size()};
|
||||
if (wsrep_->enc_set_key(wsrep_, &enc_key) != WSREP_OK)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<wsrep::provider::status_variable>
|
||||
wsrep::wsrep_provider_v26::status() const
|
||||
{
|
||||
|
@ -78,7 +78,7 @@ namespace wsrep
|
||||
wsrep::gtid last_committed_gtid() const;
|
||||
int sst_sent(const wsrep::gtid&,int);
|
||||
int sst_received(const wsrep::gtid& gtid, int);
|
||||
int enc_set_key(const wsrep::const_buffer& key);
|
||||
|
||||
std::vector<status_variable> status() const;
|
||||
void reset_status();
|
||||
std::string options() const;
|
||||
|
Reference in New Issue
Block a user