MySQL 8.0.31
Source Code Documentation
log0encryption.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1995, 2022, Oracle and/or its affiliates.
4
5This program is free software; you can redistribute it and/or modify it under
6the terms of the GNU General Public License, version 2.0, as published by the
7Free Software Foundation.
8
9This program is also distributed with certain software (including but not
10limited to OpenSSL) that is licensed under separate terms, as designated in a
11particular file or component or in included license documentation. The authors
12of MySQL hereby grant you an additional permission to link the program and
13your derivative works with the separately licensed software that they have
14included with MySQL.
15
16This program is distributed in the hope that it will be useful, but WITHOUT
17ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
19for more details.
20
21You should have received a copy of the GNU General Public License along with
22this program; if not, write to the Free Software Foundation, Inc.,
2351 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24
25*****************************************************************************/
26
27/**************************************************/ /**
28 @file include/log0encryption.h
29
30 Redo log - encryption.
31
32 *******************************************************/
33
34#ifndef log0encryption_h
35#define log0encryption_h
36
37#ifndef UNIV_HOTBACKUP
38
39/* byte */
40#include "univ.i"
41
42/**************************************************/ /**
43
44 @name Log - encryption management.
45
46 *******************************************************/
47
48/** @{ */
49
50/** Writes encryption information to log header.
51@param[in] encryption_metadata encryption metadata (algorithm, key, iv)
52@param[in] encrypt_key encrypt with master key
53@param[in,out] buf log file encryption header */
55 const Encryption_metadata &encryption_metadata, bool encrypt_key,
56 byte *buf);
57
58/** Reads the log encryption header to get the redo log encryption information.
59Read is done using the file which contains the current checkpoint_lsn.
60Updates: log.m_encryption_metadata and log.m_encryption_buf.
61@param[in,out] log redo log
62@return DB_SUCCESS or DB_ERROR */
64
65/** Reads the log encryption header to get the redo log encryption information.
66Read is done using the provided file.
67Updates: log.m_encryption_metadata and log.m_encryption_buf.
68@param[in,out] log redo log
69@param[in] file redo file to read from
70@return DB_SUCCESS or DB_ERROR */
72
73/** Enables the redo log encryption and generates new encryption metadata.
74Writes the generated metadata to the log encryption header in the log file
75containing the current checkpoint lsn (log.last_checkpoint_lsn).
76@param[in,out] log redo log
77@return DB_SUCCESS or DB_ERROR */
79
80/** Re-encrypts the redo log's encryption metadata using the current master key
81and writes it encrypted to the log encryption header in the log file containing
82the current checkpoint lsn (log.last_checkpoint_lsn)).
83@remarks This is called after the new master key has been generated.
84@return DB_SUCCESS or DB_ERROR */
86
87/** @return true iff redo log is encrypted (checks in-memory metadata in log_t).
88 */
89bool log_can_encrypt(const log_t &log);
90
91/** @} */
92
93#endif /* !UNIV_HOTBACKUP */
94
95#endif /* !log0encryption_h */
dberr_t
Definition: db0err.h:38
dberr_t log_encryption_on_master_key_changed(log_t &log)
Re-encrypts the redo log's encryption metadata using the current master key and writes it encrypted t...
Definition: log0encryption.cc:199
dberr_t log_encryption_read(log_t &log)
Reads the log encryption header to get the redo log encryption information.
Definition: log0encryption.cc:87
dberr_t log_encryption_generate_metadata(log_t &log)
Enables the redo log encryption and generates new encryption metadata.
Definition: log0encryption.cc:211
bool log_file_header_fill_encryption(const Encryption_metadata &encryption_metadata, bool encrypt_key, byte *buf)
Writes encryption information to log header.
Definition: log0encryption.cc:144
bool log_can_encrypt(const log_t &log)
Definition: log0encryption.cc:195
Definition: buf0block_hint.cc:29
Definition: os0file.h:85
Encryption metadata.
Definition: os0enc.h:452
Meta information about single log file.
Definition: log0types.h:459
Redo log - single data structure with state of the redo log system.
Definition: log0sys.h:74
Version control for database, common definitions, and include files.