25 changed files with 245 additions and 44 deletions
-
34include/my_crypt_key_management.h
-
13include/mysql/plugin_audit.h.pp
-
13include/mysql/plugin_auth.h.pp
-
13include/mysql/plugin_encryption_key_management.h.pp
-
13include/mysql/plugin_ftparser.h.pp
-
13include/mysql/plugin_password_validation.h.pp
-
60include/mysql/service_cryptokeys.h
-
60include/mysql/service_encryption_keys.h
-
1include/mysql/services.h
-
1include/service_versions.h
-
1libservices/CMakeLists.txt
-
17libservices/cryptokeys_service.c
-
17libservices/encryption_keys_service.c
-
1mysys/my_thr_init.c
-
1plugin/file_key_management_plugin/file_key_management_plugin.cc
-
2sql/encryption_keys.cc
-
11sql/encryption_keys.h
-
10sql/sql_plugin_services.h
-
2sql/sys_vars.cc
-
1storage/innobase/fil/fil0crypt.cc
-
1storage/innobase/include/fsp0pageencryption.ic
-
1storage/innobase/include/log0crypt.h
-
1storage/xtradb/fil/fil0crypt.cc
-
1storage/xtradb/include/fsp0pageencryption.ic
-
1storage/xtradb/include/log0crypt.h
@ -1,34 +0,0 @@ |
|||
|
|||
#ifndef INCLUDE_MY_CRYPT_KEY_MANAGMENT_INCLUDED |
|||
#define INCLUDE_MY_CRYPT_KEY_MANAGMENT_INCLUDED |
|||
|
|||
#include "my_global.h" |
|||
#include "my_pthread.h" |
|||
#include "mysql/psi/psi.h" |
|||
|
|||
#ifndef DBUG_OFF |
|||
extern my_bool debug_use_static_encryption_keys; |
|||
|
|||
#ifdef HAVE_PSI_INTERFACE |
|||
extern PSI_rwlock_key key_LOCK_dbug_encryption_key_version; |
|||
#endif |
|||
|
|||
extern mysql_rwlock_t LOCK_dbug_encryption_key_version; |
|||
extern uint opt_debug_encryption_key_version; |
|||
#endif /* DBUG_OFF */ |
|||
|
|||
C_MODE_START |
|||
|
|||
/** |
|||
* Functions to interact with key management |
|||
*/ |
|||
|
|||
uint get_latest_encryption_key_version(); |
|||
uint has_encryption_key(uint version); |
|||
uint get_encryption_key_size(uint version); |
|||
int get_encryption_key(uint version, uchar* key, uint size); |
|||
int get_encryption_iv(uint version, uchar* iv, uint size); |
|||
|
|||
C_MODE_END |
|||
|
|||
#endif // INCLUDE_MY_CRYPT_KEY_MANAGMENT_INCLUDED |
@ -0,0 +1,60 @@ |
|||
#ifndef MYSQL_SERVICE_CRYPTOKEYS_INCLUDED |
|||
/* Copyright (c) 2015, MariaDB |
|||
|
|||
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 */ |
|||
|
|||
/** |
|||
@file |
|||
cryptokeys service |
|||
|
|||
Functions get cryptographical keys and IV from the cryptokey management plugin |
|||
*/ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
extern struct cryptokeys_service_st { |
|||
unsigned int (*get_latest_crypto_key_version_func)(); |
|||
unsigned int (*has_crypto_key_func)(unsigned int); |
|||
unsigned int (*get_crypto_key_size_func)(unsigned int); |
|||
int (*get_crypto_key_func)(unsigned int, unsigned char*, unsigned int); |
|||
int (*get_crypto_iv_func)(unsigned int, unsigned char*, unsigned int); |
|||
} *cryptokeys_service; |
|||
|
|||
#ifdef MYSQL_DYNAMIC_PLUGIN |
|||
|
|||
#define get_latest_crypto_key_version() cryptokeys_service->get_latest_crypto_key_version_func() |
|||
#define has_crypto_key(V) cryptokeys_service->has_crypto_key_func(V) |
|||
#define get_crypto_key_size(V) cryptokeys_service->get_crypto_key_size_func(V) |
|||
#define get_crypto_key(V,K,S) cryptokeys_service->get_crypto_key_func((V), (K), (S)) |
|||
#define get_crypto_iv(V, I, S) cryptokeys_service->get_crypto_iv_func((V), (I), (S)) |
|||
|
|||
#else |
|||
|
|||
unsigned int get_latest_crypto_key_version(); |
|||
unsigned int has_crypto_key(unsigned int version); |
|||
unsigned int get_crypto_key_size(unsigned int version); |
|||
int get_crypto_key(unsigned int version, unsigned char* key, unsigned int keybufsize); |
|||
int get_crypto_iv(unsigned int version, unsigned char* iv, unsigned int ivbufsize); |
|||
|
|||
#endif |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#define MYSQL_SERVICE_CRYPTOKEYS_INCLUDED |
|||
#endif |
|||
|
@ -0,0 +1,60 @@ |
|||
#ifndef MYSQL_SERVICE_ENCRYPTION_KEYS_INCLUDED |
|||
/* Copyright (c) 2015, MariaDB |
|||
|
|||
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 */ |
|||
|
|||
/** |
|||
@file |
|||
encryption keys service |
|||
|
|||
Functions to get encryption keys and IV from the encryption key management plugin |
|||
*/ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
extern struct encryption_keys_service_st { |
|||
unsigned int (*get_latest_encryption_key_version_func)(); |
|||
unsigned int (*has_encryption_key_func)(unsigned int); |
|||
unsigned int (*get_encryption_key_size_func)(unsigned int); |
|||
int (*get_encryption_key_func)(unsigned int, unsigned char*, unsigned int); |
|||
int (*get_encryption_iv_func)(unsigned int, unsigned char*, unsigned int); |
|||
} *encryption_keys_service; |
|||
|
|||
#ifdef MYSQL_DYNAMIC_PLUGIN |
|||
|
|||
#define get_latest_encryption_key_version() encryption_keys_service->get_latest_encryption_key_version_func() |
|||
#define has_encryption_key(V) encryption_keys_service->has_encryption_key_func(V) |
|||
#define get_encryption_key_size(V) encryption_keys_service->get_encryption_key_size_func(V) |
|||
#define get_encryption_key(V,K,S) encryption_keys_service->get_encryption_key_func((V), (K), (S)) |
|||
#define get_encryption_iv(V, I, S) encryption_keys_service->get_encryption_iv_func((V), (I), (S)) |
|||
|
|||
#else |
|||
|
|||
unsigned int get_latest_encryption_key_version(); |
|||
unsigned int has_encryption_key(unsigned int version); |
|||
unsigned int get_encryption_key_size(unsigned int version); |
|||
int get_encryption_key(unsigned int version, unsigned char* key, unsigned int keybufsize); |
|||
int get_encryption_iv(unsigned int version, unsigned char* iv, unsigned int ivbufsize); |
|||
|
|||
#endif |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#define MYSQL_SERVICE_ENCRYPTION_KEYS_INCLUDED |
|||
#endif |
|||
|
@ -0,0 +1,17 @@ |
|||
/* Copyright (c) 2015 MariaDB |
|||
|
|||
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 */ |
|||
|
|||
#include <service_versions.h> |
|||
SERVICE_VERSION cryptokeys_service= (void*)VERSION_cryptokeys; |
@ -0,0 +1,17 @@ |
|||
/* Copyright (c) 2015 MariaDB |
|||
|
|||
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 */ |
|||
|
|||
#include <service_versions.h> |
|||
SERVICE_VERSION encryption_keys_service= (void*)VERSION_encryption_keys; |
@ -0,0 +1,11 @@ |
|||
#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 |
Write
Preview
Loading…
Cancel
Save
Reference in new issue