From 97d5de4ccfa75af899e764dbd1c3f4b7ea370311 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 9 Apr 2015 00:37:47 +0200 Subject: Add encryption key id to the API as a distinct concept which is separate from the encryption key version --- plugin/debug_key_management/debug_key_management_plugin.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'plugin/debug_key_management') diff --git a/plugin/debug_key_management/debug_key_management_plugin.cc b/plugin/debug_key_management/debug_key_management_plugin.cc index a389a8ab04b..33e0c6ab318 100644 --- a/plugin/debug_key_management/debug_key_management_plugin.cc +++ b/plugin/debug_key_management/debug_key_management_plugin.cc @@ -19,6 +19,8 @@ It's used to debug the encryption code with a fixed keys that change only on user request. + It does not support different key ids, the only valid key id is 1. + THIS IS AN EXAMPLE ONLY! ENCRYPTION KEYS ARE HARD-CODED AND *NOT* SECRET! DO NOT USE THIS PLUGIN IN PRODUCTION! EVER! */ @@ -40,13 +42,20 @@ static struct st_mysql_sys_var* sysvars[] = { NULL }; -static unsigned int get_latest_key_version() +static unsigned int get_latest_key_version(unsigned int keyid) { + if (keyid != 1) + return ENCRYPTION_KEY_VERSION_INVALID; + return key_version; } -static unsigned int get_key(unsigned int version, unsigned char* dstbuf, unsigned *buflen) +static unsigned int get_key(unsigned int keyid, unsigned int version, + unsigned char* dstbuf, unsigned *buflen) { + if (keyid != 1) + return ENCRYPTION_KEY_VERSION_INVALID; + if (*buflen < KEY_SIZE) { *buflen= KEY_SIZE; -- cgit v1.2.1