2015-08-07 15:21:20 +03:00
|
|
|
/*****************************************************************************
|
|
|
|
|
|
|
|
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
|
2017-02-10 20:26:02 +02:00
|
|
|
Copyright (C) 2014, 2017, MariaDB Corporation. All Rights Reserved.
|
2015-08-07 15:21:20 +03:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
*****************************************************************************/
|
2014-12-22 16:53:17 +02:00
|
|
|
/**************************************************//**
|
|
|
|
@file include/log0crypt.h
|
|
|
|
Innodb log encrypt/decrypt
|
|
|
|
|
|
|
|
Created 11/25/2013 Minli Zhu
|
2015-08-07 15:21:20 +03:00
|
|
|
Modified Jan Lindström jan.lindstrom@mariadb.com
|
2017-02-10 12:11:42 +02:00
|
|
|
MDEV-11782: Rewritten for MariaDB 10.2 by Marko Mäkelä, MariaDB Corporation.
|
2014-12-22 16:53:17 +02:00
|
|
|
*******************************************************/
|
|
|
|
#ifndef log0crypt_h
|
|
|
|
#define log0crypt_h
|
|
|
|
|
2017-02-10 12:11:42 +02:00
|
|
|
#include "log0log.h"
|
2014-12-22 16:53:17 +02:00
|
|
|
|
2017-02-10 12:11:42 +02:00
|
|
|
/** innodb_encrypt_log: whether to encrypt the redo log */
|
2014-12-22 16:53:17 +02:00
|
|
|
extern my_bool srv_encrypt_log;
|
|
|
|
|
2017-02-10 12:11:42 +02:00
|
|
|
/** Initialize the redo log encryption key.
|
|
|
|
@return whether the operation succeeded */
|
2014-12-22 16:53:17 +02:00
|
|
|
UNIV_INTERN
|
2017-02-10 12:11:42 +02:00
|
|
|
bool
|
|
|
|
log_crypt_init();
|
2014-12-22 16:53:17 +02:00
|
|
|
|
|
|
|
/*********************************************************************//**
|
|
|
|
Writes the crypto (version, msg and iv) info, which has been used for
|
|
|
|
log blocks with lsn <= this checkpoint's lsn, to a log header's
|
|
|
|
checkpoint buf. */
|
|
|
|
UNIV_INTERN
|
|
|
|
void
|
|
|
|
log_crypt_write_checkpoint_buf(
|
|
|
|
/*===========================*/
|
|
|
|
byte* buf); /*!< in/out: checkpoint buffer */
|
|
|
|
|
2017-02-10 20:26:02 +02:00
|
|
|
/** Read the MariaDB 10.1 checkpoint crypto (version, msg and iv) info.
|
|
|
|
@param[in] buf checkpoint buffer
|
|
|
|
@return whether the operation was successful */
|
|
|
|
UNIV_INTERN
|
|
|
|
bool
|
|
|
|
log_crypt_101_read_checkpoint(const byte* buf);
|
|
|
|
|
|
|
|
/** Decrypt a MariaDB 10.1 redo log block.
|
|
|
|
@param[in,out] buf log block
|
|
|
|
@return whether the decryption was successful */
|
2017-02-10 12:11:42 +02:00
|
|
|
UNIV_INTERN
|
2017-02-10 20:26:02 +02:00
|
|
|
bool
|
|
|
|
log_crypt_101_read_block(byte* buf);
|
|
|
|
|
2017-02-10 12:11:42 +02:00
|
|
|
/** Read the checkpoint crypto (version, msg and iv) info.
|
|
|
|
@param[in] buf checkpoint buffer
|
|
|
|
@return whether the operation was successful */
|
2015-05-07 19:13:22 +03:00
|
|
|
UNIV_INTERN
|
2015-06-18 19:58:57 +03:00
|
|
|
bool
|
2017-02-10 12:11:42 +02:00
|
|
|
log_crypt_read_checkpoint_buf(const byte* buf);
|
2015-08-07 15:21:20 +03:00
|
|
|
|
2017-02-10 12:11:42 +02:00
|
|
|
/** Encrypt or decrypt log blocks.
|
|
|
|
@param[in,out] buf log blocks to encrypt or decrypt
|
|
|
|
@param[in] size size of the buffer, in bytes
|
|
|
|
@param[in] decrypt whether to decrypt instead of encrypting */
|
2015-08-07 15:21:20 +03:00
|
|
|
UNIV_INTERN
|
2016-03-30 16:08:05 +03:00
|
|
|
void
|
2017-02-10 12:11:42 +02:00
|
|
|
log_crypt(byte* buf, ulint size, bool decrypt = false);
|
2016-03-30 16:08:05 +03:00
|
|
|
|
2014-12-22 16:53:17 +02:00
|
|
|
#endif // log0crypt.h
|