diff --git a/dbsim/db_params.cpp b/dbsim/db_params.cpp index 7493151..37f254e 100644 --- a/dbsim/db_params.cpp +++ b/dbsim/db_params.cpp @@ -69,6 +69,8 @@ db::params db::parse_args(int argc, char** argv) "number of rows per table") ("alg-freq", po::value(¶ms.alg_freq), "ALG frequency") + ("encryption", po::value(¶ms.encryption), + "Enable encryption callback") ("debug-log-level", po::value(¶ms.debug_log_level), "debug logging level: 0 - none, 1 - verbose") ("fast-exit", po::value(¶ms.fast_exit), diff --git a/dbsim/db_params.hpp b/dbsim/db_params.hpp index 1efc9d6..353307e 100644 --- a/dbsim/db_params.hpp +++ b/dbsim/db_params.hpp @@ -32,6 +32,7 @@ namespace db size_t n_transactions; size_t n_rows; size_t alg_freq; + bool encryption; std::string topology; std::string wsrep_provider; std::string wsrep_provider_options; @@ -43,6 +44,7 @@ namespace db , n_transactions(0) , n_rows(1000) , alg_freq(0) + , encryption(false) , topology() , wsrep_provider() , wsrep_provider_options() diff --git a/dbsim/db_server_service.cpp b/dbsim/db_server_service.cpp index 6110d0f..f540378 100644 --- a/dbsim/db_server_service.cpp +++ b/dbsim/db_server_service.cpp @@ -165,10 +165,16 @@ void db::server_service::debug_sync(const char*) int db::server_service::do_crypt(void** ctx WSREP_UNUSED, wsrep::const_buffer& key WSREP_UNUSED, const char (*iv)[32] WSREP_UNUSED, - wsrep::const_buffer& input WSREP_UNUSED, - void* output WSREP_UNUSED, + wsrep::const_buffer& input, + void* output, bool encrypt WSREP_UNUSED, bool last WSREP_UNUSED) { - return -1; + + for (size_t i(0); i < input.size(); ++i) + { + static_cast(output)[i] = + ~static_cast(input.data())[i]; + } + return input.size(); } diff --git a/dbsim/db_server_service.hpp b/dbsim/db_server_service.hpp index fbdece4..59ec7b5 100644 --- a/dbsim/db_server_service.hpp +++ b/dbsim/db_server_service.hpp @@ -65,7 +65,6 @@ namespace db void* output, bool encrypt, bool last) override; - private: db::server& server_; }; diff --git a/dbsim/db_simulator.cpp b/dbsim/db_simulator.cpp index 7f29cf1..3e14681 100644 --- a/dbsim/db_simulator.cpp +++ b/dbsim/db_simulator.cpp @@ -140,7 +140,7 @@ void db::simulator::start() std::string server_options(params_.wsrep_provider_options); if (server.server_state().load_provider( - params_.wsrep_provider, server_options, false)) + params_.wsrep_provider, server_options, params_.encryption)) { throw wsrep::runtime_error("Failed to load provider"); }