summaryrefslogtreecommitdiff
path: root/plugin/file_key_management
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-04-09 00:37:47 +0200
committerSergei Golubchik <serg@mariadb.org>2015-04-09 19:35:40 +0200
commit97d5de4ccfa75af899e764dbd1c3f4b7ea370311 (patch)
tree19bfde638b5ccefa3e8160f39e64827f2ddba7e1 /plugin/file_key_management
parent5dffda3ccc72d026f0ac2eea63b5e1424cc1eca1 (diff)
downloadmariadb-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 'plugin/file_key_management')
-rw-r--r--plugin/file_key_management/file_key_management_plugin.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/plugin/file_key_management/file_key_management_plugin.cc b/plugin/file_key_management/file_key_management_plugin.cc
index bf193c252b3..08c0c9b74c8 100644
--- a/plugin/file_key_management/file_key_management_plugin.cc
+++ b/plugin/file_key_management/file_key_management_plugin.cc
@@ -78,20 +78,18 @@ static keyentry *get_key(unsigned int key_id)
return a->id == key_id ? a : 0;
}
-/**
- This method is using with the id 0 if exists.
- This method is used by innobase/xtradb for the key
- rotation feature of encrypting log files.
-*/
-
-static unsigned int get_highest_key_used_in_key_file()
+/* the version is always the same, no automatic key rotation */
+static unsigned int get_latest_version(uint key_id)
{
- return 0;
+ return get_key(key_id) ? 1 : ENCRYPTION_KEY_VERSION_INVALID;
}
static unsigned int get_key_from_key_file(unsigned int key_id,
- unsigned char* dstbuf, unsigned *buflen)
+ unsigned int key_version, unsigned char* dstbuf, unsigned *buflen)
{
+ if (key_version != 1)
+ return ENCRYPTION_KEY_VERSION_INVALID;
+
keyentry* entry = get_key(key_id);
if (entry == NULL)
@@ -112,7 +110,7 @@ static unsigned int get_key_from_key_file(unsigned int key_id,
struct st_mariadb_encryption file_key_management_plugin= {
MariaDB_ENCRYPTION_INTERFACE_VERSION,
- get_highest_key_used_in_key_file,
+ get_latest_version,
get_key_from_key_file,
0,0
};