diff options
author | Sergei Golubchik <serg@mariadb.org> | 2014-09-26 20:03:20 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2014-10-01 23:38:28 +0200 |
commit | d6141a553c566b3c8f997ae811dd4c00d9019613 (patch) | |
tree | 7c2665d2864172a6f15a284d5f752407a0ce90fb /include | |
parent | 11b6452a0f2f0f99bbd7c2767ebca7d043a2f43c (diff) | |
download | mariadb-git-d6141a553c566b3c8f997ae811dd4c00d9019613.tar.gz |
MD5 service
Diffstat (limited to 'include')
-rw-r--r-- | include/my_md5.h | 2 | ||||
-rw-r--r-- | include/mysql/plugin.h | 2 | ||||
-rw-r--r-- | include/mysql/plugin_audit.h.pp | 15 | ||||
-rw-r--r-- | include/mysql/plugin_auth.h.pp | 15 | ||||
-rw-r--r-- | include/mysql/plugin_ftparser.h.pp | 15 | ||||
-rw-r--r-- | include/mysql/service_md5.h | 69 | ||||
-rw-r--r-- | include/mysql/services.h | 1 | ||||
-rw-r--r-- | include/service_versions.h | 1 |
8 files changed, 118 insertions, 2 deletions
diff --git a/include/my_md5.h b/include/my_md5.h index 77557fb9346..141ea309cae 100644 --- a/include/my_md5.h +++ b/include/my_md5.h @@ -28,7 +28,7 @@ extern "C" { #endif -void compute_md5_hash(char *digest, const char *buf, int len); +#define compute_md5_hash(A,B,C) my_md5(A,B,C) /* Convert an array of bytes to a hexadecimal representation. diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index ceb6ac93ff5..03bf59ad7ac 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -75,7 +75,7 @@ typedef struct st_mysql_xid MYSQL_XID; #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104 /* MariaDB plugin interface version */ -#define MARIA_PLUGIN_INTERFACE_VERSION 0x0108 +#define MARIA_PLUGIN_INTERFACE_VERSION 0x0109 /* The allowable types of plugins diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 48bb552857d..ce456806fb8 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -123,6 +123,21 @@ size_t my_sha1_context_size(); void my_sha1_init(void *context); void my_sha1_input(void *context, const unsigned char *buf, size_t len); void my_sha1_result(void *context, unsigned char *digest); +#include <mysql/service_md5.h> +extern struct my_md5_service_st { + void (*my_md5_type)(unsigned char*, const char*, size_t); + void (*my_md5_multi_type)(unsigned char*, ...); + size_t (*my_md5_context_size_type)(); + void (*my_md5_init_type)(void *); + void (*my_md5_input_type)(void *, const unsigned char *, size_t); + void (*my_md5_result_type)(void *, unsigned char *); +} *my_md5_service; +void my_md5(unsigned char*, const char*, size_t); +void my_md5_multi(unsigned char*, ...); +size_t my_md5_context_size(); +void my_md5_init(void *context); +void my_md5_input(void *context, const unsigned char *buf, size_t len); +void my_md5_result(void *context, unsigned char *digest); #include <mysql/service_logger.h> typedef struct logger_handle_st LOGGER_HANDLE; extern struct logger_service_st { diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 4b45a1f44fd..fefbb06ab8c 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -123,6 +123,21 @@ size_t my_sha1_context_size(); void my_sha1_init(void *context); void my_sha1_input(void *context, const unsigned char *buf, size_t len); void my_sha1_result(void *context, unsigned char *digest); +#include <mysql/service_md5.h> +extern struct my_md5_service_st { + void (*my_md5_type)(unsigned char*, const char*, size_t); + void (*my_md5_multi_type)(unsigned char*, ...); + size_t (*my_md5_context_size_type)(); + void (*my_md5_init_type)(void *); + void (*my_md5_input_type)(void *, const unsigned char *, size_t); + void (*my_md5_result_type)(void *, unsigned char *); +} *my_md5_service; +void my_md5(unsigned char*, const char*, size_t); +void my_md5_multi(unsigned char*, ...); +size_t my_md5_context_size(); +void my_md5_init(void *context); +void my_md5_input(void *context, const unsigned char *buf, size_t len); +void my_md5_result(void *context, unsigned char *digest); #include <mysql/service_logger.h> typedef struct logger_handle_st LOGGER_HANDLE; extern struct logger_service_st { diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index e1e3704e506..0d28f6a00ff 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -123,6 +123,21 @@ size_t my_sha1_context_size(); void my_sha1_init(void *context); void my_sha1_input(void *context, const unsigned char *buf, size_t len); void my_sha1_result(void *context, unsigned char *digest); +#include <mysql/service_md5.h> +extern struct my_md5_service_st { + void (*my_md5_type)(unsigned char*, const char*, size_t); + void (*my_md5_multi_type)(unsigned char*, ...); + size_t (*my_md5_context_size_type)(); + void (*my_md5_init_type)(void *); + void (*my_md5_input_type)(void *, const unsigned char *, size_t); + void (*my_md5_result_type)(void *, unsigned char *); +} *my_md5_service; +void my_md5(unsigned char*, const char*, size_t); +void my_md5_multi(unsigned char*, ...); +size_t my_md5_context_size(); +void my_md5_init(void *context); +void my_md5_input(void *context, const unsigned char *buf, size_t len); +void my_md5_result(void *context, unsigned char *digest); #include <mysql/service_logger.h> typedef struct logger_handle_st LOGGER_HANDLE; extern struct logger_service_st { diff --git a/include/mysql/service_md5.h b/include/mysql/service_md5.h new file mode 100644 index 00000000000..faf967a5739 --- /dev/null +++ b/include/mysql/service_md5.h @@ -0,0 +1,69 @@ +#ifndef MYSQL_SERVICE_MD5_INCLUDED +/* Copyright (c) 2013, Monty Program Ab + + 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 + my md5 service + + Functions to calculate MD5 hash from a memory buffer +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef MYSQL_ABI_CHECK +#include <stdlib.h> +#endif + +#define MY_MD5_HASH_SIZE 16 /* Hash size in bytes */ + +extern struct my_md5_service_st { + void (*my_md5_type)(unsigned char*, const char*, size_t); + void (*my_md5_multi_type)(unsigned char*, ...); + size_t (*my_md5_context_size_type)(); + void (*my_md5_init_type)(void *); + void (*my_md5_input_type)(void *, const unsigned char *, size_t); + void (*my_md5_result_type)(void *, unsigned char *); +} *my_md5_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN + +#define my_md5(A,B,C) my_md5_service->my_md5_type(A,B,C) +#define my_md5_multi my_md5_service->my_md5_multi_type +#define my_md5_context_size() my_md5_service->my_md5_context_size_type() +#define my_md5_init(A) my_md5_service->my_md5_init_type(A) +#define my_md5_input(A,B,C) my_md5_service->my_md5_input_type(A,B,C) +#define my_md5_result(A,B) my_md5_service->my_md5_result_type(A,B) + +#else + +void my_md5(unsigned char*, const char*, size_t); +void my_md5_multi(unsigned char*, ...); +size_t my_md5_context_size(); +void my_md5_init(void *context); +void my_md5_input(void *context, const unsigned char *buf, size_t len); +void my_md5_result(void *context, unsigned char *digest); + +#endif + +#ifdef __cplusplus +} +#endif + +#define MYSQL_SERVICE_MD5_INCLUDED +#endif + diff --git a/include/mysql/services.h b/include/mysql/services.h index 62cac338703..a969cfb388e 100644 --- a/include/mysql/services.h +++ b/include/mysql/services.h @@ -27,6 +27,7 @@ extern "C" { #include <mysql/service_kill_statement.h> #include <mysql/service_thd_timezone.h> #include <mysql/service_sha1.h> +#include <mysql/service_md5.h> #include <mysql/service_logger.h> #include <mysql/service_thd_autoinc.h> #include <mysql/service_thd_error_context.h> diff --git a/include/service_versions.h b/include/service_versions.h index 765a15f12e5..c9d7571fa10 100644 --- a/include/service_versions.h +++ b/include/service_versions.h @@ -29,6 +29,7 @@ #define VERSION_progress_report 0x0100 #define VERSION_thd_timezone 0x0100 #define VERSION_my_sha1 0x0101 +#define VERSION_my_md5 0x0100 #define VERSION_logger 0x0100 #define VERSION_thd_autoinc 0x0100 #define VERSION_thd_error_context 0x0100 |