diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-04-01 18:26:19 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-04-09 18:42:43 +0200 |
commit | c0878f64c5c39b9cc21f66a401040a708f4f0792 (patch) | |
tree | ed5a7be09890c9aed02bb797413ae41f44b5a60f /include | |
parent | bb1b61b312088ba9f5f2cb606594b6f33c284402 (diff) | |
download | mariadb-git-c0878f64c5c39b9cc21f66a401040a708f4f0792.tar.gz |
remove wrappers in encryption_keys.cc
invoke plugin methods directly
Diffstat (limited to 'include')
-rw-r--r-- | include/mysql/plugin_audit.h.pp | 18 | ||||
-rw-r--r-- | include/mysql/plugin_auth.h.pp | 18 | ||||
-rw-r--r-- | include/mysql/plugin_encryption.h.pp | 18 | ||||
-rw-r--r-- | include/mysql/plugin_ftparser.h.pp | 18 | ||||
-rw-r--r-- | include/mysql/plugin_password_validation.h.pp | 18 | ||||
-rw-r--r-- | include/mysql/service_encryption_keys.h | 26 |
6 files changed, 26 insertions, 90 deletions
diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 30647a7c331..0819b053ee3 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -203,26 +203,14 @@ typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -extern struct encryption_keys_service_st { +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; -} *encryption_keys_service; -unsigned int get_latest_encryption_key_version(); -unsigned int has_encryption_key(unsigned int version); -unsigned int get_encryption_key(unsigned int version, unsigned char* key, unsigned int *keybufsize); -int encrypt_data(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); -int decrypt_data(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); +}; +extern struct encryption_keys_service_st encryption_keys_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 e821a7d1bfb..c612eda97d1 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -203,26 +203,14 @@ typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -extern struct encryption_keys_service_st { +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; -} *encryption_keys_service; -unsigned int get_latest_encryption_key_version(); -unsigned int has_encryption_key(unsigned int version); -unsigned int get_encryption_key(unsigned int version, unsigned char* key, unsigned int *keybufsize); -int encrypt_data(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); -int decrypt_data(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); +}; +extern struct encryption_keys_service_st encryption_keys_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 100928f0b19..00eaa7e3095 100644 --- a/include/mysql/plugin_encryption.h.pp +++ b/include/mysql/plugin_encryption.h.pp @@ -203,26 +203,14 @@ typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -extern struct encryption_keys_service_st { +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; -} *encryption_keys_service; -unsigned int get_latest_encryption_key_version(); -unsigned int has_encryption_key(unsigned int version); -unsigned int get_encryption_key(unsigned int version, unsigned char* key, unsigned int *keybufsize); -int encrypt_data(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); -int decrypt_data(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); +}; +extern struct encryption_keys_service_st encryption_keys_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 0c58e6912ca..26a2e17c53a 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -203,26 +203,14 @@ typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -extern struct encryption_keys_service_st { +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; -} *encryption_keys_service; -unsigned int get_latest_encryption_key_version(); -unsigned int has_encryption_key(unsigned int version); -unsigned int get_encryption_key(unsigned int version, unsigned char* key, unsigned int *keybufsize); -int encrypt_data(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); -int decrypt_data(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); +}; +extern struct encryption_keys_service_st encryption_keys_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 8ab0f680815..9d9e2e8f25d 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -203,26 +203,14 @@ typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, const unsigned char* key, unsigned int klen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -extern struct encryption_keys_service_st { +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; -} *encryption_keys_service; -unsigned int get_latest_encryption_key_version(); -unsigned int has_encryption_key(unsigned int version); -unsigned int get_encryption_key(unsigned int version, unsigned char* key, unsigned int *keybufsize); -int encrypt_data(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); -int decrypt_data(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); +}; +extern struct encryption_keys_service_st encryption_keys_handler; struct st_mysql_xid { long formatID; long gtrid_length; diff --git a/include/mysql/service_encryption_keys.h b/include/mysql/service_encryption_keys.h index 105146d00a5..93e96650758 100644 --- a/include/mysql/service_encryption_keys.h +++ b/include/mysql/service_encryption_keys.h @@ -34,16 +34,18 @@ typedef int (*encrypt_decrypt_func)(const unsigned char* src, unsigned int slen, const unsigned char* iv, unsigned int ivlen, int no_padding, unsigned int key_version); -extern struct encryption_keys_service_st { +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; -} *encryption_keys_service; +}; #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)) @@ -51,19 +53,13 @@ extern struct encryption_keys_service_st { #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 -unsigned int get_latest_encryption_key_version(); -unsigned int has_encryption_key(unsigned int version); -unsigned int get_encryption_key(unsigned int version, unsigned char* key, unsigned int *keybufsize); -int encrypt_data(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); -int decrypt_data(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); +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 |