-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move debug_use_static_encryption_keys and debug_encryption_key_versio…
…n to a plugin
- Loading branch information
Showing
12 changed files
with
137 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
show variables like 'innodb_encrypt%'; | ||
Variable_name Value | ||
innodb_encrypt_log OFF | ||
innodb_encrypt_tables ON | ||
innodb_encryption_rotate_key_age 2 | ||
innodb_encryption_rotation_iops 100 | ||
innodb_encryption_threads 4 | ||
select space,name,min_key_version,current_key_version from information_schema.innodb_tablespaces_encryption; | ||
space name min_key_version current_key_version | ||
1 mysql/innodb_table_stats 0 1 | ||
2 mysql/innodb_index_stats 0 1 | ||
0 NULL 0 1 | ||
set global debug_key_management_plugin_version=10; | ||
select space,name,min_key_version,current_key_version from information_schema.innodb_tablespaces_encryption; | ||
space name min_key_version current_key_version | ||
1 mysql/innodb_table_stats 0 10 | ||
2 mysql/innodb_index_stats 0 10 | ||
0 NULL 0 10 | ||
set global debug_key_management_plugin_version=1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--innodb-encrypt-tables=ON | ||
--innodb-encryption-rotate-key-age=2 | ||
--innodb-encryption-threads=4 | ||
--innodb-tablespaces-encryption | ||
--plugin-load-add=$DEBUG_KEY_MANAGEMENT_PLUGIN_SO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- source include/have_innodb.inc | ||
if (`select count(*) = 0 from information_schema.plugins | ||
where plugin_name = 'debug_key_management_plugin' and plugin_status='active'`) | ||
{ | ||
--skip Needs debug_key_management_plugin | ||
} | ||
|
||
show variables like 'innodb_encrypt%'; | ||
select space,name,min_key_version,current_key_version from information_schema.innodb_tablespaces_encryption; | ||
set global debug_key_management_plugin_version=10; | ||
select space,name,min_key_version,current_key_version from information_schema.innodb_tablespaces_encryption; | ||
set global debug_key_management_plugin_version=1; | ||
|
3 changes: 0 additions & 3 deletions
3
mysql-test/suite/sys_vars/r/debug_use_static_encryption_keys_basic.result
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
mysql-test/suite/sys_vars/t/debug_encryption_key_version_basic.test
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
mysql-test/suite/sys_vars/t/debug_use_static_encryption_keys_basic.test
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
MYSQL_ADD_PLUGIN(DEBUG_KEY_MANAGEMENT_PLUGIN debug_key_management_plugin.cc | ||
MODULE_ONLY) |
98 changes: 98 additions & 0 deletions
98
plugin/debug_key_management_plugin/debug_key_management_plugin.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
Copyright (c) 2015 MariaDB Corporation | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; version 2 of the License. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ | ||
|
||
/** | ||
Debug key management plugin. | ||
It's used to debug the encryption code with a fixed keys that change | ||
only on user request. | ||
THIS IS AN EXAMPLE ONLY! ENCRYPTION KEYS ARE HARD-CODED AND *NOT* SECRET! | ||
DO NOT USE THIS PLUGIN IN PRODUCTION! EVER! | ||
*/ | ||
|
||
#include <my_global.h> | ||
#include <mysql/plugin_encryption_key_management.h> | ||
#include <string.h> | ||
#include <myisampack.h> | ||
|
||
static uint key_version; | ||
|
||
static MYSQL_SYSVAR_UINT(version, key_version, PLUGIN_VAR_RQCMDARG, | ||
"Latest key version", NULL, NULL, 1, 0, UINT_MAX, 1); | ||
|
||
static struct st_mysql_sys_var* sysvars[] = { | ||
MYSQL_SYSVAR(version), | ||
NULL | ||
}; | ||
|
||
static unsigned int get_latest_key_version() | ||
{ | ||
return key_version; | ||
} | ||
|
||
static int get_key(unsigned int version, unsigned char* dstbuf, unsigned buflen) | ||
{ | ||
if (buflen < 4) | ||
return 1; | ||
memset(dstbuf, 0, buflen); | ||
mi_int4store(dstbuf, version); | ||
return 0; | ||
} | ||
|
||
static unsigned int has_key(unsigned int ver) | ||
{ | ||
return 1; | ||
} | ||
|
||
static unsigned int get_key_size(unsigned int ver) | ||
{ | ||
return 16; | ||
} | ||
|
||
static int get_iv(unsigned int ver, unsigned char* dstbuf, unsigned buflen) | ||
{ | ||
return 0; // to be removed | ||
} | ||
|
||
struct st_mariadb_encryption_key_management debug_key_management_plugin= { | ||
MariaDB_ENCRYPTION_KEY_MANAGEMENT_INTERFACE_VERSION, | ||
get_latest_key_version, | ||
has_key, | ||
get_key_size, | ||
get_key, | ||
get_iv | ||
}; | ||
|
||
/* | ||
Plugin library descriptor | ||
*/ | ||
maria_declare_plugin(debug_key_management_plugin) | ||
{ | ||
MariaDB_ENCRYPTION_KEY_MANAGEMENT_PLUGIN, | ||
&debug_key_management_plugin, | ||
"debug_key_management_plugin", | ||
"Sergei Golubchik", | ||
"Debug key management plugin", | ||
PLUGIN_LICENSE_GPL, | ||
NULL, | ||
NULL, | ||
0x0100, | ||
NULL, | ||
sysvars, | ||
"1.0", | ||
MariaDB_PLUGIN_MATURITY_EXPERIMENTAL | ||
} | ||
maria_declare_plugin_end; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters