Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PS-8337: Remove old keyring encryption code #1494

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions plugin/keyring/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ MYSQL_ADD_PLUGIN(keyring_file
common/keyring_key.cc
common/keys_container.cc
common/keys_iterator.cc
common/system_keys_container.cc
common/system_key_adapter.cc
common/keyring_impl.cc
converter.cc
digest.cc
Expand Down
34 changes: 0 additions & 34 deletions plugin/keyring/common/i_system_keys_container.h

This file was deleted.

20 changes: 4 additions & 16 deletions plugin/keyring/common/keys_container.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <algorithm>

#include <mysqld_error.h>
#include "plugin/keyring/common/system_keys_container.h"

using std::string;
using std::unique_ptr;
Expand All @@ -51,7 +50,6 @@ bool Keys_container::init(IKeyring_io *keyring_io,
this->keyring_io = keyring_io;
this->keyring_storage_url = keyring_storage_url;
keys_hash->clear();
system_keys_container.reset(new System_keys_container(logger));
if (keyring_io->init(&this->keyring_storage_url) ||
load_keys_from_keyring_storage()) {
keys_hash->clear();
Expand Down Expand Up @@ -88,22 +86,16 @@ bool Keys_container::store_key_in_hash(IKey *key) {
}

bool Keys_container::store_key(IKey *key) {
if (system_keys_container->rotate_key_id_if_system_key_without_version(key) ||
flush_to_backup() || store_key_in_hash(key))
return true;
if (flush_to_backup() || store_key_in_hash(key)) return true;
if (flush_to_storage(key, STORE_KEY)) {
remove_key_from_hash(key);
return true;
}
system_keys_container->store_or_update_if_system_key_with_version(key);
return false;
}

IKey *Keys_container::get_key_from_hash(IKey *key) {
IKey *system_key =
system_keys_container->get_latest_key_if_system_key_without_version(key);
return system_key ? system_key
: find_or_nullptr(*keys_hash, *key->get_key_signature());
return find_or_nullptr(*keys_hash, *key->get_key_signature());
}

void Keys_container::allocate_and_set_data_for_key(
Expand Down Expand Up @@ -156,10 +148,8 @@ bool Keys_container::remove_key_from_hash(IKey *key) {

bool Keys_container::remove_key(IKey *key) {
IKey *fetched_key_to_delete = get_key_from_hash(key);
// removing system keys is forbidden
if (fetched_key_to_delete == nullptr ||
system_keys_container->is_system_key(fetched_key_to_delete) ||
flush_to_backup() || remove_key_from_hash(fetched_key_to_delete))
if (fetched_key_to_delete == nullptr || flush_to_backup() ||
remove_key_from_hash(fetched_key_to_delete))
return true;
if (flush_to_storage(fetched_key_to_delete, REMOVE_KEY)) {
// reinsert the key
Expand Down Expand Up @@ -187,8 +177,6 @@ bool Keys_container::load_keys_from_keyring_storage() {
delete key_loaded;
break;
}
system_keys_container->store_or_update_if_system_key_with_version(
key_loaded);
key_loaded = nullptr;
}
delete serialized_keys;
Expand Down
2 changes: 0 additions & 2 deletions plugin/keyring/common/keys_container.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "my_sharedlib.h"
#include "plugin/keyring/common/i_keyring_io.h"
#include "plugin/keyring/common/i_keys_container.h"
#include "plugin/keyring/common/i_system_keys_container.h"
#include "plugin/keyring/common/keyring_key.h"
#include "plugin/keyring/common/keyring_memory.h"
#include "plugin/keyring/common/logger.h"
Expand Down Expand Up @@ -83,7 +82,6 @@ class Keys_container : public IKeys_container {
ILogger *logger;
IKeyring_io *keyring_io;
std::string keyring_storage_url;
std::unique_ptr<ISystem_keys_container> system_keys_container;
};

} // namespace keyring
Expand Down
84 changes: 0 additions & 84 deletions plugin/keyring/common/system_key_adapter.cc

This file was deleted.

147 changes: 0 additions & 147 deletions plugin/keyring/common/system_key_adapter.h

This file was deleted.

Loading