diff options
author | Sergei Golubchik <serg@mariadb.org> | 2015-03-26 17:16:37 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2015-04-05 13:14:37 +0200 |
commit | 6a7ee5a5a540f2c69c8b56448e06098d368ecdb4 (patch) | |
tree | 92cf8574a44eb226b791492dd5c6c3e512e8eafb /storage | |
parent | 87604c4cadac0c9f86068d7f0075bb3cdeabdf0b (diff) | |
download | mariadb-git-6a7ee5a5a540f2c69c8b56448e06098d368ecdb4.tar.gz |
encryption cleanup: small changes
* comments
* move my_bytes_to_key() and my_aes_hex2uint() into file_key_management_plugin
* rename HA_INSERT_ORDER -> HA_PRESERVE_INSERT_ORDER
* remove unused variables and declarations
* fix casts
* don't link innodb with pcre
* remove redundant entries from aria's TARGET_LINK_LIBRARIES
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/CMakeLists.txt | 2 | ||||
-rw-r--r-- | storage/maria/CMakeLists.txt | 2 | ||||
-rw-r--r-- | storage/maria/ma_create.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_crypt.c | 33 | ||||
-rw-r--r-- | storage/maria/ma_crypt.h | 21 |
5 files changed, 43 insertions, 17 deletions
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 87c6a1467e6..94a913cbe4c 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -474,5 +474,5 @@ ENDIF() MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE MODULE_ONLY MODULE_OUTPUT_NAME ha_innodb - LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT} pcre pcreposix) + LINK_LIBRARIES ${ZLIB_LIBRARY} ${LINKER_SCRIPT}) diff --git a/storage/maria/CMakeLists.txt b/storage/maria/CMakeLists.txt index 09c816aee4e..b8e3350ca76 100644 --- a/storage/maria/CMakeLists.txt +++ b/storage/maria/CMakeLists.txt @@ -64,7 +64,7 @@ IF(NOT WITH_ARIA_STORAGE_ENGINE) ENDIF() TARGET_LINK_LIBRARIES(aria myisam - mysys mysys_ssl ${LIBCRYPT} ${LIBDL} ${SSL_LIBRARIES}) + mysys mysys_ssl) MYSQL_ADD_EXECUTABLE(aria_ftdump maria_ftdump.c COMPONENT Server) TARGET_LINK_LIBRARIES(aria_ftdump aria) diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index b7fcb6b7058..35491b1d31d 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -74,7 +74,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, myf sync_dir= 0; uchar *log_data= NULL; my_bool encrypted= MY_TEST(flags & HA_CREATE_ENCRYPTED); - my_bool insert_order= MY_TEST(flags & HA_INSERT_ORDER); + my_bool insert_order= MY_TEST(flags & HA_PRESERVE_INSERT_ORDER); uint crypt_page_header_space= 0; DBUG_ENTER("maria_create"); DBUG_PRINT("enter", ("keys: %u columns: %u uniques: %u flags: %u", diff --git a/storage/maria/ma_crypt.c b/storage/maria/ma_crypt.c index 89defe8cec9..f21f2c4d964 100644 --- a/storage/maria/ma_crypt.c +++ b/storage/maria/ma_crypt.c @@ -1,4 +1,19 @@ -/* Copyright 2013 Google Inc. All Rights Reserved. */ +/* + Copyright (c) 2013 Google Inc. + Copyright (c) 2014, 2015 MariaDB Corporation + + 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 <my_global.h> #include "ma_crypt.h" @@ -136,12 +151,10 @@ ma_crypt_read(MARIA_SHARE* share, uchar *buff) return buff + 2 + iv_length; } -static void ma_encrypt(MARIA_CRYPT_DATA *crypt_data, - const uchar *src, uchar *dst, uint size, - uint pageno, LSN lsn, uint *key_version); -static void ma_decrypt(MARIA_CRYPT_DATA *crypt_data, - const uchar *src, uchar *dst, uint size, - uint pageno, LSN lsn, uint key_version); +static void ma_encrypt(MARIA_CRYPT_DATA *, const uchar *, uchar *, uint, + uint, LSN, uint *); +static void ma_decrypt(MARIA_CRYPT_DATA *, const uchar *, uchar *, uint, + uint, LSN, uint); static my_bool ma_crypt_pre_read_hook(PAGECACHE_IO_HOOK_ARGS *args) { @@ -249,7 +262,7 @@ static my_bool ma_crypt_data_pre_write_hook(PAGECACHE_IO_HOOK_ARGS *args) /* 1 - copy head */ memcpy(dst, src, head); - /* 2 - decrypt page */ + /* 2 - encrypt page */ ma_encrypt(share->crypt_data, src + head, dst + head, size - (head + tail), pageno, lsn, &key_version); @@ -368,7 +381,7 @@ static my_bool ma_crypt_index_pre_write_hook(PAGECACHE_IO_HOOK_ARGS *args) /* 1 - copy head */ memcpy(dst, src, head); - /* 2 - decrypt page */ + /* 2 - encrypt page */ ma_encrypt(share->crypt_data, src + head, dst + head, size, pageno, lsn, &key_version); /* 3 - copy tail */ @@ -456,6 +469,4 @@ static void ma_decrypt(MARIA_CRYPT_DATA *crypt_data, fatal("failed to decrypt! rc: %d, dstlen: %d size: %d\n", rc, dstlen, (int)size); } - - (void)key_version; } diff --git a/storage/maria/ma_crypt.h b/storage/maria/ma_crypt.h index 76752e19449..309a8300eb8 100644 --- a/storage/maria/ma_crypt.h +++ b/storage/maria/ma_crypt.h @@ -1,7 +1,22 @@ -/* Copyright 2013 Google Inc. All Rights Reserved. */ +/* + Copyright (c) 2013 Google Inc. + Copyright (c) 2014, 2015 MariaDB Corporation -#ifndef _ma_crypt_h -#define _ma_crypt_h + 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 */ + +#ifndef STORAGE_MARIA_MA_CRYPT_INCLUDED +#define STORAGE_MARIA_MA_CRYPT_INCLUDED #include <my_global.h> |