summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-04-01 22:15:11 +0200
committerSergei Golubchik <serg@mariadb.org>2015-04-09 18:42:44 +0200
commit4d40a7d133b1e5a3241ec673721687158e235be0 (patch)
tree0e434bd7789a09ef39cf52389b0b9bb80ad08add
parent65e782607031721b22397010bd7be57bbd5f6439 (diff)
downloadmariadb-git-4d40a7d133b1e5a3241ec673721687158e235be0.tar.gz
remove now-empty my_aes.{h,cc}
move remaning defines to my_crypt, add MY_ namespace prefix
-rw-r--r--include/my_aes.h54
-rw-r--r--include/my_crypt.h50
-rw-r--r--mysys_ssl/CMakeLists.txt1
-rw-r--r--mysys_ssl/my_aes.cc40
-rw-r--r--mysys_ssl/my_crypt.cc39
-rw-r--r--sql/item_strfunc.cc7
-rw-r--r--sql/mysqld.cc1
-rw-r--r--storage/innobase/fil/fil0crypt.cc8
-rw-r--r--storage/innobase/include/log0crypt.h2
-rw-r--r--storage/innobase/log/log0crypt.cc12
-rw-r--r--storage/innobase/log/log0log.cc10
-rw-r--r--storage/maria/ma_crypt.c8
-rw-r--r--storage/xtradb/fil/fil0crypt.cc8
-rw-r--r--storage/xtradb/include/log0crypt.h2
-rw-r--r--storage/xtradb/log/log0crypt.cc12
-rw-r--r--storage/xtradb/log/log0log.cc10
16 files changed, 100 insertions, 164 deletions
diff --git a/include/my_aes.h b/include/my_aes.h
deleted file mode 100644
index b5df86fb5ab..00000000000
--- a/include/my_aes.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (c) 2002, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
- Copyright (c) 2014, 2015 MariaDB Corporation
- Use is subject to license terms.
-
- 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 */
-
-
-/* Header file for my_aes.c */
-/* Wrapper to give simple interface for MySQL to AES standard encryption */
-
-#ifndef MY_AES_INCLUDED
-#define MY_AES_INCLUDED
-
-#include <my_global.h>
-
-#define AES_OK 0
-#define AES_BAD_DATA -1
-#define AES_BAD_IV -2
-#define AES_INVALID -3
-#define AES_OPENSSL_ERROR -4
-#define AES_BAD_KEYSIZE -5
-#define AES_KEY_CREATION_FAILED -10
-
-#define CRYPT_KEY_OK 0
-#define CRYPT_BUFFER_TO_SMALL -11
-#define CRYPT_KEY_UNKNOWN -48
-
-/* The block size for all supported algorithms */
-#define MY_AES_BLOCK_SIZE 16
-
-/* The max key length of all supported algorithms */
-#define MY_AES_MAX_KEY_LENGTH 32
-
-
-#include "rijndael.h"
-
-C_MODE_START
-
-int my_aes_get_size(int source_length);
-
-C_MODE_END
-
-#endif /* MY_AES_INCLUDED */
diff --git a/include/my_crypt.h b/include/my_crypt.h
index c6cddbd99e3..b760af75bfa 100644
--- a/include/my_crypt.h
+++ b/include/my_crypt.h
@@ -15,57 +15,73 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
-// TODO: Add Windows support
-
#ifndef MY_CRYPT_INCLUDED
#define MY_CRYPT_INCLUDED
-#include <my_aes.h>
+#include <my_global.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* return values from my_aes_encrypt/my_aes_decrypt functions */
+#define MY_AES_OK 0
+#define MY_AES_BAD_DATA -1
+#define MY_AES_OPENSSL_ERROR -2
+#define MY_AES_BAD_KEYSIZE -3
-C_MODE_START
+/* The block size for all supported algorithms */
+#define MY_AES_BLOCK_SIZE 16
+
+/* The max key length of all supported algorithms */
+#define MY_AES_MAX_KEY_LENGTH 32
#ifdef HAVE_EncryptAes128Ctr
int my_aes_encrypt_ctr(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
- const unsigned char* key, uint key_length,
- const unsigned char* iv, uint iv_length,
+ const uchar* key, uint key_length,
+ const uchar* iv, uint iv_length,
int no_padding);
int my_aes_decrypt_ctr(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
- const unsigned char* key, uint key_length,
- const unsigned char* iv, uint iv_length,
+ const uchar* key, uint key_length,
+ const uchar* iv, uint iv_length,
int no_padding);
#endif
int my_aes_encrypt_cbc(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
- const unsigned char* key, uint key_length,
- const unsigned char* iv, uint iv_length,
+ const uchar* key, uint key_length,
+ const uchar* iv, uint iv_length,
int no_padding);
int my_aes_decrypt_cbc(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
- const unsigned char* key, uint key_length,
- const unsigned char* iv, uint iv_length,
+ const uchar* key, uint key_length,
+ const uchar* iv, uint iv_length,
int no_padding);
int my_aes_encrypt_ecb(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
- const unsigned char* key, uint key_length,
- const unsigned char* iv, uint iv_length,
+ const uchar* key, uint key_length,
+ const uchar* iv, uint iv_length,
int no_padding);
int my_aes_decrypt_ecb(const uchar* source, uint source_length,
uchar* dest, uint* dest_length,
- const unsigned char* key, uint key_length,
- const unsigned char* iv, uint iv_length,
+ const uchar* key, uint key_length,
+ const uchar* iv, uint iv_length,
int no_padding);
int my_random_bytes(uchar* buf, int num);
-C_MODE_END
+int my_aes_get_size(int source_length);
+
+#ifdef __cplusplus
+}
+#endif
#endif /* MY_CRYPT_INCLUDED */
diff --git a/mysys_ssl/CMakeLists.txt b/mysys_ssl/CMakeLists.txt
index 5eead8d6aaf..8a8f81d70ae 100644
--- a/mysys_ssl/CMakeLists.txt
+++ b/mysys_ssl/CMakeLists.txt
@@ -33,7 +33,6 @@ IF(WITH_SSL STREQUAL "bundled" AND HAVE_VISIBILITY_HIDDEN)
ENDIF()
SET(MYSYS_SSL_SOURCES
- my_aes.cc
my_sha1.cc
my_sha2.cc
my_md5.cc
diff --git a/mysys_ssl/my_aes.cc b/mysys_ssl/my_aes.cc
deleted file mode 100644
index 069d8d74ab2..00000000000
--- a/mysys_ssl/my_aes.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
-
- 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 <m_string.h>
-#include <my_aes.h>
-#include <my_crypt.h>
-
-/**
- Initialize encryption methods
-*/
-
-/**
- Get size of buffer which will be large enough for encrypted data
-
- SYNOPSIS
- my_aes_get_size()
- @param source_length [in] Length of data to be encrypted
-
- @return
- Size of buffer required to store encrypted data
-*/
-
-int my_aes_get_size(int source_length)
-{
- return MY_AES_BLOCK_SIZE * (source_length / MY_AES_BLOCK_SIZE)
- + MY_AES_BLOCK_SIZE;
-}
diff --git a/mysys_ssl/my_crypt.cc b/mysys_ssl/my_crypt.cc
index 1709ae5e5eb..3bb8f860c37 100644
--- a/mysys_ssl/my_crypt.cc
+++ b/mysys_ssl/my_crypt.cc
@@ -78,7 +78,7 @@ static int do_crypt(CipherMode cipher, Dir dir,
TaoCrypt::AES ctx(dir, cipher);
if (unlikely(key_length != 16 && key_length != 24 && key_length != 32))
- return AES_BAD_KEYSIZE;
+ return MY_AES_BAD_KEYSIZE;
ctx.SetKey(key, key_length);
if (iv)
@@ -106,7 +106,7 @@ static int do_crypt(CipherMode cipher, Dir dir,
{
int n= dest[source_length - 1];
if (tail || n == 0 || n > MY_AES_BLOCK_SIZE)
- return AES_OPENSSL_ERROR;
+ return MY_AES_BAD_DATA;
*dest_length-= n;
}
}
@@ -116,10 +116,10 @@ static int do_crypt(CipherMode cipher, Dir dir,
struct MyCTX ctx;
if (unlikely(!cipher))
- return AES_BAD_KEYSIZE;
+ return MY_AES_BAD_KEYSIZE;
if (!EVP_CipherInit_ex(&ctx, cipher, NULL, key, iv, dir))
- return AES_OPENSSL_ERROR;
+ return MY_AES_OPENSSL_ERROR;
EVP_CIPHER_CTX_set_padding(&ctx, !no_padding);
@@ -130,9 +130,9 @@ static int do_crypt(CipherMode cipher, Dir dir,
/* use built-in OpenSSL padding, if possible */
if (!EVP_CipherUpdate(&ctx, dest, (int*)dest_length,
source, source_length - (no_padding ? tail : 0)))
- return AES_OPENSSL_ERROR;
+ return MY_AES_OPENSSL_ERROR;
if (!EVP_CipherFinal_ex(&ctx, dest + *dest_length, &fin))
- return AES_OPENSSL_ERROR;
+ return MY_AES_BAD_DATA;
*dest_length += fin;
#endif
@@ -146,7 +146,7 @@ static int do_crypt(CipherMode cipher, Dir dir,
*/
if (unlikely(source_length < MY_AES_BLOCK_SIZE))
- return AES_OPENSSL_ERROR;
+ return MY_AES_BAD_DATA;
const uchar *s= source + source_length - tail;
const uchar *e= source + source_length;
@@ -157,7 +157,7 @@ static int do_crypt(CipherMode cipher, Dir dir,
*dest_length= source_length;
}
- return AES_OK;
+ return MY_AES_OK;
}
C_MODE_START
@@ -240,7 +240,7 @@ int my_random_bytes(uchar* buf, int num)
{
TaoCrypt::RandomNumberGenerator rand;
rand.GenerateBlock((TaoCrypt::byte*) buf, num);
- return AES_OK;
+ return MY_AES_OK;
}
C_MODE_END
@@ -261,9 +261,26 @@ int my_random_bytes(uchar* buf, int num)
*/
RAND_METHOD* rand = RAND_SSLeay();
if (rand == NULL || rand->bytes(buf, num) != 1)
- return AES_OPENSSL_ERROR;
- return AES_OK;
+ return MY_AES_OPENSSL_ERROR;
+ return MY_AES_OK;
}
C_MODE_END
#endif /* HAVE_YASSL */
+
+/**
+ Get size of buffer which will be large enough for encrypted data
+
+ SYNOPSIS
+ my_aes_get_size()
+ @param source_length [in] Length of data to be encrypted
+
+ @return
+ Size of buffer required to store encrypted data
+*/
+
+int my_aes_get_size(int source_length)
+{
+ return MY_AES_BLOCK_SIZE * (source_length / MY_AES_BLOCK_SIZE)
+ + MY_AES_BLOCK_SIZE;
+}
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 544284b2c0b..4bf8dd5ae1b 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -54,7 +54,6 @@
#include <base64.h>
#include <my_md5.h>
#include "sha1.h"
-#include "my_aes.h"
#include <zlib.h>
C_MODE_START
#include "../mysys/my_static.h" // For soundex_map
@@ -402,9 +401,9 @@ String *Item_aes_crypt::val_str(String *str)
uchar rkey[AES_KEY_LENGTH / 8];
create_key(user_key, rkey);
- if (crypt((uchar*)sptr->ptr(), sptr->length(),
- (uchar*)str_value.ptr(), &aes_length,
- rkey, AES_KEY_LENGTH / 8, 0, 0, 0) == AES_OK)
+ if (!crypt((uchar*)sptr->ptr(), sptr->length(),
+ (uchar*)str_value.ptr(), &aes_length,
+ rkey, AES_KEY_LENGTH / 8, 0, 0, 0))
{
str_value.length((uint) aes_length);
return &str_value;
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index c002a9d7d46..941ba505c20 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -105,7 +105,6 @@
#include "sp_rcontext.h"
#include "sp_cache.h"
#include "sql_reload.h" // reload_acl_and_cache
-#include <my_aes.h>
#ifdef HAVE_POLL_H
#include <poll.h>
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 345f8f572b8..15252d70987 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -40,7 +40,7 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include <my_crypt.h>
-#include <my_aes.h>
+#include <my_crypt.h>
#include <math.h>
@@ -251,7 +251,7 @@ fil_crypt_get_key(byte *dst, uint* key_length,
rc = my_aes_encrypt_ecb(src, srclen, buf, &buflen,
(unsigned char*)keybuf, *key_length, NULL, 0, 1);
- if (rc != AES_OK) {
+ if (rc != MY_AES_OK) {
ib_logf(IB_LOG_LEVEL_FATAL,
"Unable to encrypt key-block "
" src: %p srclen: %d buf: %p buflen: %d."
@@ -697,7 +697,7 @@ fil_space_encrypt(ulint space, ulint offset, lsn_t lsn,
(unsigned char*)key, key_length,
(unsigned char*)iv, sizeof(iv), 1, key_version);
- if (! ((rc == AES_OK) && ((ulint) dstlen == srclen))) {
+ if (! ((rc == MY_AES_OK) && ((ulint) dstlen == srclen))) {
ib_logf(IB_LOG_LEVEL_FATAL,
"Unable to encrypt data-block "
" src: %p srclen: %ld buf: %p buflen: %d."
@@ -869,7 +869,7 @@ fil_space_decrypt(fil_space_crypt_t* crypt_data,
(unsigned char*)key, key_length,
(unsigned char*)iv, sizeof(iv), 1, key_version);
- if (! ((rc == AES_OK) && ((ulint) dstlen == srclen))) {
+ if (! ((rc == MY_AES_OK) && ((ulint) dstlen == srclen))) {
ib_logf(IB_LOG_LEVEL_FATAL,
"Unable to decrypt data-block "
" src: %p srclen: %ld buf: %p buflen: %d."
diff --git a/storage/innobase/include/log0crypt.h b/storage/innobase/include/log0crypt.h
index 02cbf994e8d..433b0b50395 100644
--- a/storage/innobase/include/log0crypt.h
+++ b/storage/innobase/include/log0crypt.h
@@ -11,7 +11,7 @@ Created 11/25/2013 Minli Zhu
#include "ut0byte.h"
#include "ut0lst.h"
#include "ut0rnd.h"
-#include "my_aes.h"
+#include "my_crypt.h"
#define PURPOSE_BYTE_LEN MY_AES_BLOCK_SIZE - 1
#define PURPOSE_BYTE_OFFSET 0
diff --git a/storage/innobase/log/log0crypt.cc b/storage/innobase/log/log0crypt.cc
index 596f07b95dc..273701fe60d 100644
--- a/storage/innobase/log/log0crypt.cc
+++ b/storage/innobase/log/log0crypt.cc
@@ -26,7 +26,7 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "m_string.h"
#include "log0crypt.h"
#include <my_crypt.h>
-#include <my_aes.h>
+#include <my_crypt.h>
#include "log0log.h"
#include "srv0start.h" // for srv_start_lsn
@@ -69,7 +69,7 @@ log_init_crypt_msg_and_nonce(void)
/*==============================*/
{
mach_write_to_1(redo_log_crypt_msg, redo_log_purpose_byte);
- if (my_random_bytes(redo_log_crypt_msg + 1, PURPOSE_BYTE_LEN) != AES_OK)
+ if (my_random_bytes(redo_log_crypt_msg + 1, PURPOSE_BYTE_LEN) != MY_AES_OK)
{
ib_logf(IB_LOG_LEVEL_ERROR,
"Redo log crypto: generate "
@@ -78,7 +78,7 @@ log_init_crypt_msg_and_nonce(void)
abort();
}
- if (my_random_bytes(aes_ctr_nonce, MY_AES_BLOCK_SIZE) != AES_OK)
+ if (my_random_bytes(aes_ctr_nonce, MY_AES_BLOCK_SIZE) != MY_AES_OK)
{
ib_logf(IB_LOG_LEVEL_ERROR,
"Redo log crypto: generate "
@@ -131,7 +131,7 @@ log_init_crypt_key(
(unsigned char*)&mysqld_key, sizeof(mysqld_key),
NULL, 0, 1);
- if (rc != AES_OK || dst_len != MY_AES_BLOCK_SIZE)
+ if (rc != MY_AES_OK || dst_len != MY_AES_BLOCK_SIZE)
{
ib_logf(IB_LOG_LEVEL_ERROR,
"Redo log crypto: getting redo log crypto key "
@@ -168,7 +168,7 @@ log_blocks_crypt(
const bool is_encrypt) /*!< in: encrypt or decrypt*/
{
byte *log_block = (byte*)block;
- Crypt_result rc = AES_OK;
+ Crypt_result rc = MY_AES_OK;
uint32 src_len, dst_len;
byte aes_ctr_counter[MY_AES_BLOCK_SIZE];
ulint log_block_no, log_block_start_lsn;
@@ -210,7 +210,7 @@ log_blocks_crypt(
aes_ctr_counter, MY_AES_BLOCK_SIZE, 1,
recv_sys->recv_log_crypt_ver);
- ut_a(rc == AES_OK);
+ ut_a(rc == MY_AES_OK);
ut_a(dst_len == src_len);
log_block += OS_FILE_LOG_BLOCK_SIZE;
dst_block += OS_FILE_LOG_BLOCK_SIZE;
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 12c05e16b6b..de4d4724161 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -1307,7 +1307,7 @@ log_group_encrypt_before_write(
const ulint size) /*!< in: size of log blocks */
{
- Crypt_result result = AES_OK;
+ Crypt_result result = MY_AES_OK;
ut_ad(size % OS_FILE_LOG_BLOCK_SIZE == 0);
byte* dst_frame = (byte*)malloc(size);
@@ -1315,14 +1315,14 @@ log_group_encrypt_before_write(
//encrypt log blocks content
result = log_blocks_encrypt(block, size, dst_frame);
- if (result == AES_OK)
+ if (result == MY_AES_OK)
{
ut_ad(block[0] == dst_frame[0]);
memcpy(block, dst_frame, size);
}
free(dst_frame);
- return (result == AES_OK);
+ return (result == MY_AES_OK);
}
/******************************************************//**
@@ -2357,13 +2357,13 @@ log_group_decrypt_after_read(
// decrypt log blocks content
result = log_blocks_decrypt(frame, size, dst_frame);
- if (result == AES_OK)
+ if (result == MY_AES_OK)
{
memcpy(frame, dst_frame, size);
}
free(dst_frame);
- return (result == AES_OK);
+ return (result == MY_AES_OK);
}
/******************************************************//**
diff --git a/storage/maria/ma_crypt.c b/storage/maria/ma_crypt.c
index 96f4d54e54a..df19973c7de 100644
--- a/storage/maria/ma_crypt.c
+++ b/storage/maria/ma_crypt.c
@@ -421,9 +421,9 @@ static int ma_encrypt(MARIA_CRYPT_DATA *crypt_data,
crypt_data->iv, CRYPT_SCHEME_1_IV_LEN,
counter, sizeof(counter), 1, *key_version);
- DBUG_ASSERT(rc == AES_OK);
+ DBUG_ASSERT(rc == MY_AES_OK);
DBUG_ASSERT(dstlen == size);
- if (! (rc == AES_OK && dstlen == size))
+ if (! (rc == MY_AES_OK && dstlen == size))
{
my_printf_error(HA_ERR_GENERIC,
"failed to encrypt! rc: %d, dstlen: %u size: %u\n",
@@ -453,9 +453,9 @@ static int ma_decrypt(MARIA_CRYPT_DATA *crypt_data,
crypt_data->iv, CRYPT_SCHEME_1_IV_LEN,
counter, sizeof(counter), 1, key_version);
- DBUG_ASSERT(rc == AES_OK);
+ DBUG_ASSERT(rc == MY_AES_OK);
DBUG_ASSERT(dstlen == size);
- if (! (rc == AES_OK && dstlen == size))
+ if (! (rc == MY_AES_OK && dstlen == size))
{
my_printf_error(HA_ERR_GENERIC,
"failed to encrypt! rc: %d, dstlen: %u size: %u\n",
diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc
index 9f94ba8145f..29e5b3823a4 100644
--- a/storage/xtradb/fil/fil0crypt.cc
+++ b/storage/xtradb/fil/fil0crypt.cc
@@ -40,7 +40,7 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include <my_crypt.h>
-#include <my_aes.h>
+#include <my_crypt.h>
#include <math.h>
@@ -251,7 +251,7 @@ fil_crypt_get_key(byte *dst, uint* key_length,
rc = my_aes_encrypt_ecb(src, srclen, buf, &buflen,
(unsigned char*)keybuf, *key_length, NULL, 0, 1);
- if (rc != AES_OK) {
+ if (rc != MY_AES_OK) {
ib_logf(IB_LOG_LEVEL_FATAL,
"Unable to encrypt key-block "
" src: %p srclen: %d buf: %p buflen: %d."
@@ -697,7 +697,7 @@ fil_space_encrypt(ulint space, ulint offset, lsn_t lsn,
(unsigned char*)key, key_length,
(unsigned char*)iv, sizeof(iv), 1, key_version);
- if (! ((rc == AES_OK) && ((ulint) dstlen == srclen))) {
+ if (! ((rc == MY_AES_OK) && ((ulint) dstlen == srclen))) {
ib_logf(IB_LOG_LEVEL_FATAL,
"Unable to encrypt data-block "
" src: %p srclen: %ld buf: %p buflen: %d."
@@ -869,7 +869,7 @@ fil_space_decrypt(fil_space_crypt_t* crypt_data,
(unsigned char*)key, key_length,
(unsigned char*)iv, sizeof(iv), 1, key_version);
- if (! ((rc == AES_OK) && ((ulint) dstlen == srclen))) {
+ if (! ((rc == MY_AES_OK) && ((ulint) dstlen == srclen))) {
ib_logf(IB_LOG_LEVEL_FATAL,
"Unable to decrypt data-block "
" src: %p srclen: %ld buf: %p buflen: %d."
diff --git a/storage/xtradb/include/log0crypt.h b/storage/xtradb/include/log0crypt.h
index 02cbf994e8d..433b0b50395 100644
--- a/storage/xtradb/include/log0crypt.h
+++ b/storage/xtradb/include/log0crypt.h
@@ -11,7 +11,7 @@ Created 11/25/2013 Minli Zhu
#include "ut0byte.h"
#include "ut0lst.h"
#include "ut0rnd.h"
-#include "my_aes.h"
+#include "my_crypt.h"
#define PURPOSE_BYTE_LEN MY_AES_BLOCK_SIZE - 1
#define PURPOSE_BYTE_OFFSET 0
diff --git a/storage/xtradb/log/log0crypt.cc b/storage/xtradb/log/log0crypt.cc
index 804bad34392..8325c291a06 100644
--- a/storage/xtradb/log/log0crypt.cc
+++ b/storage/xtradb/log/log0crypt.cc
@@ -26,7 +26,7 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "m_string.h"
#include "log0crypt.h"
#include <my_crypt.h>
-#include <my_aes.h>
+#include <my_crypt.h>
#include "log0log.h"
#include "srv0start.h" // for srv_start_lsn
@@ -69,7 +69,7 @@ log_init_crypt_msg_and_nonce(void)
/*==============================*/
{
mach_write_to_1(redo_log_crypt_msg, redo_log_purpose_byte);
- if (my_random_bytes(redo_log_crypt_msg + 1, PURPOSE_BYTE_LEN) != AES_OK)
+ if (my_random_bytes(redo_log_crypt_msg + 1, PURPOSE_BYTE_LEN) != MY_AES_OK)
{
ib_logf(IB_LOG_LEVEL_ERROR,
"Redo log crypto: generate "
@@ -78,7 +78,7 @@ log_init_crypt_msg_and_nonce(void)
abort();
}
- if (my_random_bytes(aes_ctr_nonce, MY_AES_BLOCK_SIZE) != AES_OK)
+ if (my_random_bytes(aes_ctr_nonce, MY_AES_BLOCK_SIZE) != MY_AES_OK)
{
ib_logf(IB_LOG_LEVEL_ERROR,
"Redo log crypto: generate "
@@ -131,7 +131,7 @@ log_init_crypt_key(
(unsigned char*)&mysqld_key, sizeof(mysqld_key),
NULL, 0, 1);
- if (rc != AES_OK || dst_len != MY_AES_BLOCK_SIZE)
+ if (rc != MY_AES_OK || dst_len != MY_AES_BLOCK_SIZE)
{
ib_logf(IB_LOG_LEVEL_ERROR,
"Redo log crypto: getting redo log crypto key "
@@ -168,7 +168,7 @@ log_blocks_crypt(
const bool is_encrypt) /*!< in: encrypt or decrypt*/
{
byte *log_block = (byte*)block;
- Crypt_result rc = AES_OK;
+ Crypt_result rc = MY_AES_OK;
uint32 src_len, dst_len;
byte aes_ctr_counter[MY_AES_BLOCK_SIZE];
ulint log_block_no, log_block_start_lsn;
@@ -210,7 +210,7 @@ log_blocks_crypt(
aes_ctr_counter, MY_AES_BLOCK_SIZE, 1,
log_sys->redo_log_crypt_ver);
- ut_a(rc == AES_OK);
+ ut_a(rc == MY_AES_OK);
ut_a(dst_len == src_len);
log_block += OS_FILE_LOG_BLOCK_SIZE;
dst_block += OS_FILE_LOG_BLOCK_SIZE;
diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc
index 37cf18c1a0d..da2161a4d15 100644
--- a/storage/xtradb/log/log0log.cc
+++ b/storage/xtradb/log/log0log.cc
@@ -1415,7 +1415,7 @@ log_group_encrypt_before_write(
const ulint size) /*!< in: size of log blocks */
{
- Crypt_result result = AES_OK;
+ Crypt_result result = MY_AES_OK;
ut_ad(size % OS_FILE_LOG_BLOCK_SIZE == 0);
byte* dst_frame = (byte*)malloc(size);
@@ -1423,14 +1423,14 @@ log_group_encrypt_before_write(
//encrypt log blocks content
result = log_blocks_encrypt(block, size, dst_frame);
- if (result == AES_OK)
+ if (result == MY_AES_OK)
{
ut_ad(block[0] == dst_frame[0]);
memcpy(block, dst_frame, size);
}
free(dst_frame);
- return (result == AES_OK);
+ return (result == MY_AES_OK);
}
/******************************************************//**
@@ -2572,13 +2572,13 @@ log_group_decrypt_after_read(
// decrypt log blocks content
result = log_blocks_decrypt(frame, size, dst_frame);
- if (result == AES_OK)
+ if (result == MY_AES_OK)
{
memcpy(frame, dst_frame, size);
}
free(dst_frame);
- return (result == AES_OK);
+ return (result == MY_AES_OK);
}
/******************************************************//**