diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-04-09 00:37:47 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-04-09 19:35:40 +0200 |
commit | 97d5de4ccfa75af899e764dbd1c3f4b7ea370311 (patch) | |
tree | 19bfde638b5ccefa3e8160f39e64827f2ddba7e1 /sql/encryption.cc | |
parent | 5dffda3ccc72d026f0ac2eea63b5e1424cc1eca1 (diff) | |
download | mariadb-git-97d5de4ccfa75af899e764dbd1c3f4b7ea370311.tar.gz |
Add encryption key id to the API as a distinct concept
which is separate from the encryption key version
Diffstat (limited to 'sql/encryption.cc')
-rw-r--r-- | sql/encryption.cc | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sql/encryption.cc b/sql/encryption.cc index 81f6d1820cd..44208baf8b3 100644 --- a/sql/encryption.cc +++ b/sql/encryption.cc @@ -23,13 +23,18 @@ static plugin_ref encryption_manager= 0; struct encryption_service_st encryption_handler; -unsigned int has_key(uint version) +unsigned int has_key_id(uint id) +{ + return encryption_key_get_latest_version(id) != ENCRYPTION_KEY_VERSION_INVALID; +} + +unsigned int has_key_version(uint id, uint version) { uint unused; - return encryption_key_get(version, NULL, &unused) != ENCRYPTION_KEY_VERSION_INVALID; + return encryption_key_get(id, version, NULL, &unused) != ENCRYPTION_KEY_VERSION_INVALID; } -uint no_key() +uint no_key(uint) { return ENCRYPTION_KEY_VERSION_INVALID; } @@ -38,7 +43,7 @@ static int no_crypt(const uchar* source, uint source_length, uchar* dest, uint* dest_length, const uchar* key, uint key_length, const uchar* iv, uint iv_length, - int no_padding, uint key_version) + int no_padding, uint key_id, uint key_version) { return 1; } @@ -81,9 +86,10 @@ int finalize_encryption_plugin(st_plugin_int *plugin) { encryption_handler.encryption_encrypt_func= no_crypt; encryption_handler.encryption_decrypt_func= no_crypt; - encryption_handler.encryption_key_exists_func= has_key; + encryption_handler.encryption_key_id_exists_func= has_key_id; + encryption_handler.encryption_key_version_exists_func= has_key_version; encryption_handler.encryption_key_get_func= - (uint (*)(uint, uchar*, uint*))no_key; + (uint (*)(uint, uint, uchar*, uint*))no_key; encryption_handler.encryption_key_get_latest_version_func= no_key; if (plugin && plugin->plugin->deinit && plugin->plugin->deinit(NULL)) |