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
c6b95222
Commit
c6b95222
authored
Sep 26, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use MD5 service in innodb/xtradb
parent
d6141a55
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
266 deletions
+16
-266
include/mysql/service_md5.h
include/mysql/service_md5.h
+1
-1
libservices/my_md5_service.c
libservices/my_md5_service.c
+1
-1
storage/innobase/CMakeLists.txt
storage/innobase/CMakeLists.txt
+0
-25
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+7
-6
storage/innobase/wsrep/md5.cc
storage/innobase/wsrep/md5.cc
+0
-75
storage/innobase/wsrep/wsrep_md5.h
storage/innobase/wsrep/wsrep_md5.h
+0
-26
storage/xtradb/CMakeLists.txt
storage/xtradb/CMakeLists.txt
+0
-25
storage/xtradb/handler/ha_innodb.cc
storage/xtradb/handler/ha_innodb.cc
+7
-6
storage/xtradb/wsrep/md5.cc
storage/xtradb/wsrep/md5.cc
+0
-75
storage/xtradb/wsrep/wsrep_md5.h
storage/xtradb/wsrep/wsrep_md5.h
+0
-26
No files found.
include/mysql/service_md5.h
View file @
c6b95222
#ifndef MYSQL_SERVICE_MD5_INCLUDED
/* Copyright (c) 201
3
, Monty Program Ab
/* Copyright (c) 201
4
, 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
...
...
libservices/my_md5_service.c
View file @
c6b95222
/* Copyright (c) 201
3
Monty Program Ab
/* Copyright (c) 201
4
Monty Program Ab
Use is subject to license terms.
This program is free software; you can redistribute it and/or modify
...
...
storage/innobase/CMakeLists.txt
View file @
c6b95222
...
...
@@ -251,27 +251,6 @@ ENDIF()
INCLUDE_DIRECTORIES
(
${
CMAKE_SOURCE_DIR
}
/storage/innobase/include
${
CMAKE_SOURCE_DIR
}
/storage/innobase/handler
)
IF
(
WITH_WSREP
)
# ssl include directory
INCLUDE_DIRECTORIES
(
${
SSL_INCLUDE_DIRS
}
${
CMAKE_SOURCE_DIR
}
/storage/innobase/wsrep
)
IF
(
SSL_DEFINES
)
ADD_DEFINITIONS
(
${
SSL_DEFINES
}
)
ENDIF
()
LINK_LIBRARIES
(
${
SSL_LIBRARIES
}
)
# We do RESTRICT_SYMBOL_EXPORTS(yassl) elsewhere.
# In order to get correct symbol visibility, these files
# must be compiled with "-fvisibility=hidden"
IF
(
WITH_SSL STREQUAL
"bundled"
AND HAVE_VISIBILITY_HIDDEN
)
SET_SOURCE_FILES_PROPERTIES
(
{CMAKE_CURRENT_SOURCE_DIR}/wsrep/md5.cc
PROPERTIES COMPILE_FLAGS
"-fvisibility=hidden"
)
ENDIF
()
ENDIF
()
# Sun Studio bug with -xO2
IF
(
CMAKE_CXX_COMPILER_ID MATCHES
"SunPro"
AND CMAKE_CXX_FLAGS_RELEASE MATCHES
"O2"
...
...
@@ -420,10 +399,6 @@ SET(INNOBASE_SOURCES
ut/ut0wqueue.cc
ut/ut0timer.cc
)
IF
(
WITH_WSREP
)
SET
(
INNOBASE_SOURCES
${
INNOBASE_SOURCES
}
wsrep/md5.cc
)
ENDIF
()
IF
(
WITH_INNODB
)
# Legacy option
SET
(
WITH_INNOBASE_STORAGE_ENGINE TRUE
)
...
...
storage/innobase/handler/ha_innodb.cc
View file @
c6b95222
...
...
@@ -122,7 +122,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "dict0priv.h"
#include "../storage/innobase/include/ut0byte.h"
#include <wsrep_mysqld.h>
#include <
wsrep
_md5.h>
#include <
mysql/service
_md5.h>
extern
my_bool
wsrep_certify_nonPK
;
class
binlog_trx_data
;
...
...
@@ -8142,7 +8142,8 @@ wsrep_calc_row_hash(
ulint
col_type
;
uint
i
;
void
*
ctx
=
wsrep_md5_init
();
void
*
ctx
=
alloca
(
my_md5_context_size
());
my_md5_init
(
ctx
);
n_fields
=
table
->
s
->
fields
;
...
...
@@ -8191,14 +8192,14 @@ wsrep_calc_row_hash(
*/
if
(
field
->
is_null_in_record
(
row
))
{
wsrep_md5_update
(
ctx
,
(
char
*
)
&
null_byte
,
1
);
my_md5_input
(
ctx
,
&
null_byte
,
1
);
}
else
{
wsrep_md5_update
(
ctx
,
(
char
*
)
&
true_byte
,
1
);
wsrep_md5_update
(
ctx
,
(
char
*
)
ptr
,
len
);
my_md5_input
(
ctx
,
&
true_byte
,
1
);
my_md5_input
(
ctx
,
ptr
,
len
);
}
}
wsrep_compute_md5_hash
((
char
*
)
digest
,
ctx
);
my_md5_result
(
ctx
,
digest
);
return
(
0
);
}
...
...
storage/innobase/wsrep/md5.cc
deleted
100644 → 0
View file @
d6141a55
/*
Copyright (c) 2014 SkySQL 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "my_config.h"
#if defined(HAVE_YASSL)
#include "md5.hpp"
#elif defined(HAVE_OPENSSL)
#include <openssl/md5.h>
#endif
/* HAVE_YASSL */
#ifdef WITH_WSREP
/* Initialize md5 object. */
void
*
wsrep_md5_init
()
{
#if defined(HAVE_YASSL)
TaoCrypt
::
MD5
*
hasher
=
new
TaoCrypt
::
MD5
;
return
(
void
*
)
hasher
;
#elif defined(HAVE_OPENSSL)
MD5_CTX
*
ctx
=
new
MD5_CTX
();
MD5_Init
(
ctx
);
return
(
void
*
)
ctx
;
#endif
/* HAVE_YASSL */
}
/**
Supply message to be hashed.
@param ctx [IN] Pointer to MD5 context
@param buf [IN] Message to be computed.
@param len [IN] Length of the message.
*/
void
wsrep_md5_update
(
void
*
ctx
,
char
*
buf
,
int
len
)
{
#if defined(HAVE_YASSL)
((
TaoCrypt
::
MD5
*
)
ctx
)
->
Update
((
TaoCrypt
::
byte
*
)
buf
,
len
);
#elif defined(HAVE_OPENSSL)
MD5_Update
((
MD5_CTX
*
)(
ctx
),
buf
,
len
);
#endif
/* HAVE_YASSL */
}
/**
Place computed MD5 digest into the given buffer.
@param digest [OUT] Computed MD5 digest
@param ctx [IN] Pointer to MD5 context
*/
void
wsrep_compute_md5_hash
(
char
*
digest
,
void
*
ctx
)
{
#if defined(HAVE_YASSL)
((
TaoCrypt
::
MD5
*
)
ctx
)
->
Final
((
TaoCrypt
::
byte
*
)
digest
);
delete
(
TaoCrypt
::
MD5
*
)
ctx
;
#elif defined(HAVE_OPENSSL)
MD5_Final
((
unsigned
char
*
)
digest
,
(
MD5_CTX
*
)
ctx
);
delete
(
MD5_CTX
*
)
ctx
;
#endif
/* HAVE_YASSL */
}
#endif
/* WITH_WSREP */
storage/innobase/wsrep/wsrep_md5.h
deleted
100644 → 0
View file @
d6141a55
#ifndef WSREP_MD5_INCLUDED
#define WSREP_MD5_INCLUDED
/* Copyright (c) 2014 SkySQL 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 Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef WITH_WSREP
void
*
wsrep_md5_init
();
void
wsrep_md5_update
(
void
*
ctx
,
char
*
buf
,
int
len
);
void
wsrep_compute_md5_hash
(
char
*
digest
,
void
*
ctx
);
#endif
/* WITH_WSREP */
#endif
/* WSREP_MD5_INCLUDED */
storage/xtradb/CMakeLists.txt
View file @
c6b95222
...
...
@@ -268,27 +268,6 @@ ENDIF()
INCLUDE_DIRECTORIES
(
${
CMAKE_SOURCE_DIR
}
/storage/xtradb/include
${
CMAKE_SOURCE_DIR
}
/storage/xtradb/handler
)
IF
(
WITH_WSREP
)
# ssl include directory
INCLUDE_DIRECTORIES
(
${
SSL_INCLUDE_DIRS
}
${
CMAKE_SOURCE_DIR
}
/storage/xtradb/wsrep
)
IF
(
SSL_DEFINES
)
ADD_DEFINITIONS
(
${
SSL_DEFINES
}
)
ENDIF
()
LINK_LIBRARIES
(
${
SSL_LIBRARIES
}
)
# We do RESTRICT_SYMBOL_EXPORTS(yassl) elsewhere.
# In order to get correct symbol visibility, these files
# must be compiled with "-fvisibility=hidden"
IF
(
WITH_SSL STREQUAL
"bundled"
AND HAVE_VISIBILITY_HIDDEN
)
SET_SOURCE_FILES_PROPERTIES
(
{CMAKE_CURRENT_SOURCE_DIR}/wsrep/md5.cc
PROPERTIES COMPILE_FLAGS
"-fvisibility=hidden"
)
ENDIF
()
ENDIF
()
# Sun Studio bug with -xO2
IF
(
CMAKE_CXX_COMPILER_ID MATCHES
"SunPro"
AND CMAKE_CXX_FLAGS_RELEASE MATCHES
"O2"
...
...
@@ -430,10 +409,6 @@ SET(INNOBASE_SOURCES
ut/ut0wqueue.cc
ut/ut0timer.cc
)
IF
(
WITH_WSREP
)
SET
(
INNOBASE_SOURCES
${
INNOBASE_SOURCES
}
wsrep/md5.cc
)
ENDIF
()
IF
(
NOT XTRADB_OK
)
MESSAGE
(
FATAL_ERROR
"Percona XtraDB is not supported on this platform"
)
ENDIF
()
...
...
storage/xtradb/handler/ha_innodb.cc
View file @
c6b95222
...
...
@@ -125,7 +125,7 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "dict0priv.h"
#include "../storage/innobase/include/ut0byte.h"
#include <wsrep_mysqld.h>
#include <
wsrep
_md5.h>
#include <
mysql/service
_md5.h>
extern
my_bool
wsrep_certify_nonPK
;
class
binlog_trx_data
;
...
...
@@ -8605,7 +8605,8 @@ wsrep_calc_row_hash(
ulint
col_type
;
uint
i
;
void
*
ctx
=
wsrep_md5_init
();
void
*
ctx
=
alloca
(
my_md5_context_size
());
my_md5_init
(
ctx
);
n_fields
=
table
->
s
->
fields
;
...
...
@@ -8654,14 +8655,14 @@ wsrep_calc_row_hash(
*/
if
(
field
->
is_null_in_record
(
row
))
{
wsrep_md5_update
(
ctx
,
(
char
*
)
&
null_byte
,
1
);
my_md5_input
(
ctx
,
&
null_byte
,
1
);
}
else
{
wsrep_md5_update
(
ctx
,
(
char
*
)
&
true_byte
,
1
);
wsrep_md5_update
(
ctx
,
(
char
*
)
ptr
,
len
);
my_md5_input
(
ctx
,
&
true_byte
,
1
);
my_md5_input
(
ctx
,
ptr
,
len
);
}
}
wsrep_compute_md5_hash
((
char
*
)
digest
,
ctx
);
my_md5_result
(
ctx
,
digest
);
return
(
0
);
}
...
...
storage/xtradb/wsrep/md5.cc
deleted
100644 → 0
View file @
d6141a55
/*
Copyright (c) 2014 SkySQL 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "my_config.h"
#if defined(HAVE_YASSL)
#include "md5.hpp"
#elif defined(HAVE_OPENSSL)
#include <openssl/md5.h>
#endif
/* HAVE_YASSL */
#ifdef WITH_WSREP
/* Initialize md5 object. */
void
*
wsrep_md5_init
()
{
#if defined(HAVE_YASSL)
TaoCrypt
::
MD5
*
hasher
=
new
TaoCrypt
::
MD5
;
return
(
void
*
)
hasher
;
#elif defined(HAVE_OPENSSL)
MD5_CTX
*
ctx
=
new
MD5_CTX
();
MD5_Init
(
ctx
);
return
(
void
*
)
ctx
;
#endif
/* HAVE_YASSL */
}
/**
Supply message to be hashed.
@param ctx [IN] Pointer to MD5 context
@param buf [IN] Message to be computed.
@param len [IN] Length of the message.
*/
void
wsrep_md5_update
(
void
*
ctx
,
char
*
buf
,
int
len
)
{
#if defined(HAVE_YASSL)
((
TaoCrypt
::
MD5
*
)
ctx
)
->
Update
((
TaoCrypt
::
byte
*
)
buf
,
len
);
#elif defined(HAVE_OPENSSL)
MD5_Update
((
MD5_CTX
*
)(
ctx
),
buf
,
len
);
#endif
/* HAVE_YASSL */
}
/**
Place computed MD5 digest into the given buffer.
@param digest [OUT] Computed MD5 digest
@param ctx [IN] Pointer to MD5 context
*/
void
wsrep_compute_md5_hash
(
char
*
digest
,
void
*
ctx
)
{
#if defined(HAVE_YASSL)
((
TaoCrypt
::
MD5
*
)
ctx
)
->
Final
((
TaoCrypt
::
byte
*
)
digest
);
delete
(
TaoCrypt
::
MD5
*
)
ctx
;
#elif defined(HAVE_OPENSSL)
MD5_Final
((
unsigned
char
*
)
digest
,
(
MD5_CTX
*
)
ctx
);
delete
(
MD5_CTX
*
)
ctx
;
#endif
/* HAVE_YASSL */
}
#endif
/* WITH_WSREP */
storage/xtradb/wsrep/wsrep_md5.h
deleted
100644 → 0
View file @
d6141a55
#ifndef WSREP_MD5_INCLUDED
#define WSREP_MD5_INCLUDED
/* Copyright (c) 2014 SkySQL 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 Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifdef WITH_WSREP
void
*
wsrep_md5_init
();
void
wsrep_md5_update
(
void
*
ctx
,
char
*
buf
,
int
len
);
void
wsrep_compute_md5_hash
(
char
*
digest
,
void
*
ctx
);
#endif
/* WITH_WSREP */
#endif
/* WSREP_MD5_INCLUDED */
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