diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-04-01 21:25:02 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-04-09 18:42:44 +0200 |
commit | 65e782607031721b22397010bd7be57bbd5f6439 (patch) | |
tree | d27e5912eb6b67eff1b4a928e44cda9e8e4f5d25 /include/mysql | |
parent | c0878f64c5c39b9cc21f66a401040a708f4f0792 (diff) | |
download | mariadb-git-65e782607031721b22397010bd7be57bbd5f6439.tar.gz |
renames to follow single consistent naming style
with namespace prefixes
Diffstat (limited to 'include/mysql')
-rw-r--r-- | include/mysql/plugin_audit.h.pp | 16 | ||||
-rw-r--r-- | include/mysql/plugin_auth.h.pp | 16 | ||||
-rw-r--r-- | include/mysql/plugin_encryption.h.pp | 16 | ||||
-rw-r--r-- | include/mysql/plugin_ftparser.h.pp | 16 | ||||
-rw-r--r-- | include/mysql/plugin_password_validation.h.pp | 16 | ||||
-rw-r--r-- | include/mysql/service_encryption.h | 78 | ||||
-rw-r--r-- | include/mysql/service_encryption_keys.h | 71 | ||||
-rw-r--r-- | include/mysql/services.h | 2 |
8 files changed, 119 insertions, 112 deletions
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 0819b053ee3..c874484288d 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -197,20 +197,20 @@ int thd_key_create(MYSQL_THD_KEY_T *key); void thd_key_delete(MYSQL_THD_KEY_T *key); void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key); int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value); -#include <mysql/service_encryption_keys.h> +#include <mysql/service_encryption.h> typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, unsigned char* dst, unsigned int* dlen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -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_func)(unsigned int, unsigned char*, unsigned int*); - encrypt_decrypt_func encrypt_data_func; - encrypt_decrypt_func decrypt_data_func; +struct encryption_service_st { + unsigned int (*encryption_key_get_latest_version_func)(); + unsigned int (*encryption_key_exists_func)(unsigned int); + unsigned int (*encryption_key_get_func)(unsigned int, unsigned char*, unsigned int*); + encrypt_decrypt_func encryption_encrypt_func; + encrypt_decrypt_func encryption_decrypt_func; }; -extern struct encryption_keys_service_st encryption_keys_handler; +extern struct encryption_service_st encryption_handler; struct st_mysql_xid { long formatID; long gtrid_length; diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index c612eda97d1..d12e4eb062b 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -197,20 +197,20 @@ int thd_key_create(MYSQL_THD_KEY_T *key); void thd_key_delete(MYSQL_THD_KEY_T *key); void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key); int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value); -#include <mysql/service_encryption_keys.h> +#include <mysql/service_encryption.h> typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, unsigned char* dst, unsigned int* dlen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -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_func)(unsigned int, unsigned char*, unsigned int*); - encrypt_decrypt_func encrypt_data_func; - encrypt_decrypt_func decrypt_data_func; +struct encryption_service_st { + unsigned int (*encryption_key_get_latest_version_func)(); + unsigned int (*encryption_key_exists_func)(unsigned int); + unsigned int (*encryption_key_get_func)(unsigned int, unsigned char*, unsigned int*); + encrypt_decrypt_func encryption_encrypt_func; + encrypt_decrypt_func encryption_decrypt_func; }; -extern struct encryption_keys_service_st encryption_keys_handler; +extern struct encryption_service_st encryption_handler; struct st_mysql_xid { long formatID; long gtrid_length; diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp index 00eaa7e3095..e1c034271ce 100644 --- a/include/mysql/plugin_encryption.h.pp +++ b/include/mysql/plugin_encryption.h.pp @@ -197,20 +197,20 @@ int thd_key_create(MYSQL_THD_KEY_T *key); void thd_key_delete(MYSQL_THD_KEY_T *key); void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key); int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value); -#include <mysql/service_encryption_keys.h> +#include <mysql/service_encryption.h> typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, unsigned char* dst, unsigned int* dlen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -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_func)(unsigned int, unsigned char*, unsigned int*); - encrypt_decrypt_func encrypt_data_func; - encrypt_decrypt_func decrypt_data_func; +struct encryption_service_st { + unsigned int (*encryption_key_get_latest_version_func)(); + unsigned int (*encryption_key_exists_func)(unsigned int); + unsigned int (*encryption_key_get_func)(unsigned int, unsigned char*, unsigned int*); + encrypt_decrypt_func encryption_encrypt_func; + encrypt_decrypt_func encryption_decrypt_func; }; -extern struct encryption_keys_service_st encryption_keys_handler; +extern struct encryption_service_st encryption_handler; struct st_mysql_xid { long formatID; long gtrid_length; diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index 26a2e17c53a..f163a58f793 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -197,20 +197,20 @@ int thd_key_create(MYSQL_THD_KEY_T *key); void thd_key_delete(MYSQL_THD_KEY_T *key); void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key); int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value); -#include <mysql/service_encryption_keys.h> +#include <mysql/service_encryption.h> typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, unsigned char* dst, unsigned int* dlen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -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_func)(unsigned int, unsigned char*, unsigned int*); - encrypt_decrypt_func encrypt_data_func; - encrypt_decrypt_func decrypt_data_func; +struct encryption_service_st { + unsigned int (*encryption_key_get_latest_version_func)(); + unsigned int (*encryption_key_exists_func)(unsigned int); + unsigned int (*encryption_key_get_func)(unsigned int, unsigned char*, unsigned int*); + encrypt_decrypt_func encryption_encrypt_func; + encrypt_decrypt_func encryption_decrypt_func; }; -extern struct encryption_keys_service_st encryption_keys_handler; +extern struct encryption_service_st encryption_handler; struct st_mysql_xid { long formatID; long gtrid_length; diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp index 9d9e2e8f25d..94d48543103 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -197,20 +197,20 @@ int thd_key_create(MYSQL_THD_KEY_T *key); void thd_key_delete(MYSQL_THD_KEY_T *key); void* thd_getspecific(void* thd, MYSQL_THD_KEY_T key); int thd_setspecific(void* thd, MYSQL_THD_KEY_T key, void *value); -#include <mysql/service_encryption_keys.h> +#include <mysql/service_encryption.h> typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, unsigned char* dst, unsigned int* dlen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -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_func)(unsigned int, unsigned char*, unsigned int*); - encrypt_decrypt_func encrypt_data_func; - encrypt_decrypt_func decrypt_data_func; +struct encryption_service_st { + unsigned int (*encryption_key_get_latest_version_func)(); + unsigned int (*encryption_key_exists_func)(unsigned int); + unsigned int (*encryption_key_get_func)(unsigned int, unsigned char*, unsigned int*); + encrypt_decrypt_func encryption_encrypt_func; + encrypt_decrypt_func encryption_decrypt_func; }; -extern struct encryption_keys_service_st encryption_keys_handler; +extern struct encryption_service_st encryption_handler; struct st_mysql_xid { long formatID; long gtrid_length; diff --git a/include/mysql/service_encryption.h b/include/mysql/service_encryption.h new file mode 100644 index 00000000000..ed012bdb7d6 --- /dev/null +++ b/include/mysql/service_encryption.h @@ -0,0 +1,78 @@ +#ifndef MYSQL_SERVICE_ENCRYPTION_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 service + + Functions to support data encryption and encryption key management. + They are normally implemented in an encryption plugin, so this service + connects encryption *consumers* (storage engines) to the encryption + *provider* (encryption plugin). +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +/* returned from encryption_key_get_latest_version() */ +#define ENCRYPTION_KEY_VERSION_INVALID (~(unsigned int)0) +#define ENCRYPTION_KEY_VERSION_NOT_ENCRYPTED (0) + +/* returned from encryption_key_get() */ +#define ENCRYPTION_KEY_BUFFER_TOO_SMALL (100) + +typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, + unsigned char* dst, unsigned int* dlen, + const unsigned char* key, unsigned int klen, + const unsigned char* iv, unsigned int ivlen, + int no_padding, unsigned int key_version); + +struct encryption_service_st { + unsigned int (*encryption_key_get_latest_version_func)(); + unsigned int (*encryption_key_exists_func)(unsigned int); + unsigned int (*encryption_key_get_func)(unsigned int, unsigned char*, unsigned int*); + encrypt_decrypt_func encryption_encrypt_func; + encrypt_decrypt_func encryption_decrypt_func; +}; + +#ifdef MYSQL_DYNAMIC_PLUGIN + +extern struct encryption_service_st *encryption_service; + +#define encryption_key_get_latest_version() encryption_service->encryption_key_get_latest_version_func() +#define encryption_key_exists(V) encryption_service->encryption_key_exists_func(V) +#define encryption_key_get(V,K,S) encryption_service->encryption_key_get_func((V), (K), (S)) +#define encryption_encrypt(S,SL,D,DL,K,KL,I,IL,NP,KV) encryption_service->encryption_encrypt_func(S,SL,D,DL,K,KL,I,IL,NP,KV) +#define encryption_decrypt(S,SL,D,DL,K,KL,I,IL,NP,KV) encryption_service->encryption_decrypt_func(S,SL,D,DL,K,KL,I,IL,NP,KV) +#else + +extern struct encryption_service_st encryption_handler; + +#define encryption_key_get_latest_version() encryption_handler.encryption_key_get_latest_version_func() +#define encryption_key_exists(V) encryption_handler.encryption_key_exists_func(V) +#define encryption_key_get(V,K,S) encryption_handler.encryption_key_get_func((V), (K), (S)) +#define encryption_encrypt(S,SL,D,DL,K,KL,I,IL,NP,KV) encryption_handler.encryption_encrypt_func(S,SL,D,DL,K,KL,I,IL,NP,KV) +#define encryption_decrypt(S,SL,D,DL,K,KL,I,IL,NP,KV) encryption_handler.encryption_decrypt_func(S,SL,D,DL,K,KL,I,IL,NP,KV) +#endif + +#ifdef __cplusplus +} +#endif + +#define MYSQL_SERVICE_ENCRYPTION_INCLUDED +#endif + diff --git a/include/mysql/service_encryption_keys.h b/include/mysql/service_encryption_keys.h deleted file mode 100644 index 93e96650758..00000000000 --- a/include/mysql/service_encryption_keys.h +++ /dev/null @@ -1,71 +0,0 @@ -#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 from the encryption plugin -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#define BAD_ENCRYPTION_KEY_VERSION (~(unsigned int)0) -#define KEY_BUFFER_TOO_SMALL (100) - -typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, - unsigned char* dst, unsigned int* dlen, - const unsigned char* key, unsigned int klen, - const unsigned char* iv, unsigned int ivlen, - int no_padding, unsigned int key_version); - -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_func)(unsigned int, unsigned char*, unsigned int*); - encrypt_decrypt_func encrypt_data_func; - encrypt_decrypt_func decrypt_data_func; -}; - -#ifdef MYSQL_DYNAMIC_PLUGIN - -extern struct encryption_keys_service_st *encryption_keys_service; - -#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(V,K,S) encryption_keys_service->get_encryption_key_func((V), (K), (S)) -#define encrypt_data(S,SL,D,DL,K,KL,I,IL,NP,KV) encryption_keys_service->encrypt_data_func(S,SL,D,DL,K,KL,I,IL,NP,KV) -#define decrypt_data(S,SL,D,DL,K,KL,I,IL,NP,KV) encryption_keys_service->decrypt_data_func(S,SL,D,DL,K,KL,I,IL,NP,KV) -#else - -extern struct encryption_keys_service_st encryption_keys_handler; - -#define get_latest_encryption_key_version() encryption_keys_handler.get_latest_encryption_key_version_func() -#define has_encryption_key(V) encryption_keys_handler.has_encryption_key_func(V) -#define get_encryption_key(V,K,S) encryption_keys_handler.get_encryption_key_func((V), (K), (S)) -#define encrypt_data(S,SL,D,DL,K,KL,I,IL,NP,KV) encryption_keys_handler.encrypt_data_func(S,SL,D,DL,K,KL,I,IL,NP,KV) -#define decrypt_data(S,SL,D,DL,K,KL,I,IL,NP,KV) encryption_keys_handler.decrypt_data_func(S,SL,D,DL,K,KL,I,IL,NP,KV) -#endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_ENCRYPTION_KEYS_INCLUDED -#endif - diff --git a/include/mysql/services.h b/include/mysql/services.h index 764e05b4dd1..f8f41b19bd9 100644 --- a/include/mysql/services.h +++ b/include/mysql/services.h @@ -32,7 +32,7 @@ extern "C" { #include <mysql/service_thd_autoinc.h> #include <mysql/service_thd_error_context.h> #include <mysql/service_thd_specifics.h> -#include <mysql/service_encryption_keys.h> +#include <mysql/service_encryption.h> /*#include <mysql/service_wsrep.h>*/ #ifdef __cplusplus |