Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c238e68d
Commit
c238e68d
authored
Mar 26, 2015
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move debug_use_static_encryption_keys and debug_encryption_key_version to a plugin
parent
b9375742
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
137 additions
and
94 deletions
+137
-94
mysql-test/suite/innodb/r/innodb_encryption_debug.result
mysql-test/suite/innodb/r/innodb_encryption_debug.result
+19
-0
mysql-test/suite/innodb/t/innodb_encryption_debug.opt
mysql-test/suite/innodb/t/innodb_encryption_debug.opt
+5
-0
mysql-test/suite/innodb/t/innodb_encryption_debug.test
mysql-test/suite/innodb/t/innodb_encryption_debug.test
+13
-0
mysql-test/suite/sys_vars/r/debug_use_static_encryption_keys_basic.result
.../sys_vars/r/debug_use_static_encryption_keys_basic.result
+0
-3
mysql-test/suite/sys_vars/r/sysvars_debug.result
mysql-test/suite/sys_vars/r/sysvars_debug.result
+0
-28
mysql-test/suite/sys_vars/t/debug_encryption_key_version_basic.test
.../suite/sys_vars/t/debug_encryption_key_version_basic.test
+0
-3
mysql-test/suite/sys_vars/t/debug_use_static_encryption_keys_basic.test
...te/sys_vars/t/debug_use_static_encryption_keys_basic.test
+0
-3
plugin/debug_key_management_plugin/CMakeLists.txt
plugin/debug_key_management_plugin/CMakeLists.txt
+2
-0
plugin/debug_key_management_plugin/debug_key_management_plugin.cc
...ebug_key_management_plugin/debug_key_management_plugin.cc
+98
-0
sql/encryption_keys.cc
sql/encryption_keys.cc
+0
-29
sql/encryption_keys.h
sql/encryption_keys.h
+0
-11
sql/sys_vars.cc
sql/sys_vars.cc
+0
-17
No files found.
mysql-test/suite/innodb/r/innodb_encryption_debug.result
0 → 100644
View file @
c238e68d
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;
mysql-test/suite/innodb/t/innodb_encryption_debug.opt
0 → 100644
View file @
c238e68d
--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
mysql-test/suite/innodb/t/innodb_encryption_debug.test
0 → 100644
View file @
c238e68d
--
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
;
mysql-test/suite/sys_vars/r/debug_use_static_encryption_keys_basic.result
deleted
100644 → 0
View file @
b9375742
show global variables like "debug_use_static_encryption_keys";
Variable_name Value
debug_use_static_encryption_keys OFF
mysql-test/suite/sys_vars/r/sysvars_debug.result
View file @
c238e68d
...
...
@@ -57,20 +57,6 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME DEBUG_ENCRYPTION_KEY_VERSION
SESSION_VALUE NULL
GLOBAL_VALUE 0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Encryption key version. Only to be used in internal testing.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME DEBUG_MUTEX_DEADLOCK_DETECTOR
SESSION_VALUE NULL
GLOBAL_VALUE ON
...
...
@@ -113,17 +99,3 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT NULL
VARIABLE_NAME DEBUG_USE_STATIC_ENCRYPTION_KEYS
SESSION_VALUE NULL
GLOBAL_VALUE OFF
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE OFF
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BOOLEAN
VARIABLE_COMMENT Enable use of nonrandom encryption keys. Only to be used in internal testing
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY YES
COMMAND_LINE_ARGUMENT OPTIONAL
mysql-test/suite/sys_vars/t/debug_encryption_key_version_basic.test
deleted
100644 → 0
View file @
b9375742
--
source
include
/
have_debug
.
inc
# This is just to satisfy all_vars
select
1
;
mysql-test/suite/sys_vars/t/debug_use_static_encryption_keys_basic.test
deleted
100644 → 0
View file @
b9375742
# This is just to satisfy all_vars
--
source
include
/
have_debug
.
inc
show
global
variables
like
"debug_use_static_encryption_keys"
;
plugin/debug_key_management_plugin/CMakeLists.txt
0 → 100644
View file @
c238e68d
MYSQL_ADD_PLUGIN
(
DEBUG_KEY_MANAGEMENT_PLUGIN debug_key_management_plugin.cc
MODULE_ONLY
)
plugin/debug_key_management_plugin/debug_key_management_plugin.cc
0 → 100644
View file @
c238e68d
/*
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
;
sql/encryption_keys.cc
View file @
c238e68d
#include <my_global.h>
#include <mysql/plugin_encryption_key_management.h>
#include "encryption_keys.h"
#include "log.h"
#include "sql_plugin.h"
#ifndef DBUG_OFF
my_bool
debug_use_static_encryption_keys
=
0
;
uint
opt_debug_encryption_key_version
=
0
;
#endif
/* there can be only one encryption key management plugin enabled */
static
plugin_ref
encryption_key_manager
=
0
;
static
struct
st_mariadb_encryption_key_management
*
handle
;
unsigned
int
get_latest_encryption_key_version
()
{
#ifndef DBUG_OFF
if
(
debug_use_static_encryption_keys
)
{
//mysql_mutex_lock(&LOCK_global_system_variables);
uint
res
=
opt_debug_encryption_key_version
;
//mysql_mutex_unlock(&LOCK_global_system_variables);
return
res
;
}
#endif
if
(
encryption_key_manager
)
return
handle
->
get_latest_key_version
();
...
...
@@ -49,19 +33,6 @@ unsigned int get_encryption_key_size(uint version)
int
get_encryption_key
(
uint
version
,
uchar
*
key
,
uint
size
)
{
#ifndef DBUG_OFF
if
(
debug_use_static_encryption_keys
)
{
memset
(
key
,
0
,
size
);
// Just don't support tiny keys, no point anyway.
if
(
size
<
4
)
return
1
;
mi_int4store
(
key
,
version
);
return
0
;
}
#endif
if
(
encryption_key_manager
)
return
handle
->
get_key
(
version
,
key
,
size
);
...
...
sql/encryption_keys.h
deleted
100644 → 0
View file @
b9375742
#ifndef SQL_CRYPTOKEY_INCLUDED
#define SQL_CRYPTOKEY_INCLUDED
#include "my_global.h"
#ifndef DBUG_OFF
extern
my_bool
debug_use_static_encryption_keys
;
extern
uint
opt_debug_encryption_key_version
;
#endif
/* DBUG_OFF */
#endif // SQL_CRYPTOKEY_INCLUDED
sql/sys_vars.cc
View file @
c238e68d
...
...
@@ -62,7 +62,6 @@
#include "sql_repl.h"
#include "opt_range.h"
#include "rpl_parallel.h"
#include "encryption_keys.h"
/*
The rule for this file: everything should be 'static'. When a sys_var
...
...
@@ -1126,22 +1125,6 @@ static Sys_var_mybool Sys_log_bin(
READ_ONLY
GLOBAL_VAR
(
opt_bin_log
),
NO_CMD_LINE
,
DEFAULT
(
FALSE
));
#ifndef DBUG_OFF
static
Sys_var_mybool
Sys_debug_use_static_keys
(
"debug_use_static_encryption_keys"
,
"Enable use of nonrandom encryption keys. Only to be used in "
"internal testing"
,
READ_ONLY
GLOBAL_VAR
(
debug_use_static_encryption_keys
),
CMD_LINE
(
OPT_ARG
),
DEFAULT
(
FALSE
));
static
Sys_var_uint
Sys_debug_encryption_key_version
(
"debug_encryption_key_version"
,
"Encryption key version. Only to be used in internal testing."
,
GLOBAL_VAR
(
opt_debug_encryption_key_version
),
CMD_LINE
(
REQUIRED_ARG
),
VALID_RANGE
(
0
,
UINT_MAX
),
DEFAULT
(
0
),
BLOCK_SIZE
(
1
));
#endif
static
Sys_var_mybool
Sys_trust_function_creators
(
"log_bin_trust_function_creators"
,
"If set to FALSE (the default), then when --log-bin is used, creation "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment