MySQL 26.7.0
Source Code Documentation
log0encryption.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1995, 2026, 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 designed to work with certain software (including
10but not limited to OpenSSL) that is licensed under separate terms,
11as designated in a particular file or component or in included license
12documentation. The authors of MySQL hereby grant you an additional
13permission to link the program and your derivative works with the
14separately licensed software that they have either included with
15the program or referenced in the documentation.
16
17This program is distributed in the hope that it will be useful, but WITHOUT
18ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19FOR A PARTICULAR PURPOSE. See the GNU General Public License, version 2.0,
20for more details.
21
22You should have received a copy of the GNU General Public License along with
23this program; if not, write to the Free Software Foundation, Inc.,
2451 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
26*****************************************************************************/
27
28/**************************************************/ /**
29 @file include/log0encryption.h
30
31 Redo log - encryption.
32
33 *******************************************************/
34
35#ifndef log0encryption_h
36#define log0encryption_h
37
38#include "log0handler_interface.h" /* ib::redo::Handler_interface::Metadata_value */
39#include "log0sys.h" /* log_t */
40#include "os0enc.h" /* Encryption_metadata */
41#ifndef UNIV_HOTBACKUP
42
43#include "log0log.h" /* log_t */
44#include "os0enc.h" /* Encryption_metadata */
45#include "univ.i" /* byte */
46
47/**************************************************/ /**
48
49 @name Log - encryption management.
50
51 *******************************************************/
52
53/** @{ */
54
55/** Writes encryption information to log header.
56@param[in] encryption_metadata encryption metadata (algorithm, key, iv)
57@param[in] encrypt_key encrypt with master key
58@param[in,out] buf log file encryption header */
59[[nodiscard]] bool log_file_header_fill_encryption(
60 const Encryption_metadata &encryption_metadata, bool encrypt_key,
61 byte *buf);
62
63/** Reads the log encryption header to get the redo log encryption information.
64Read is done using the file which contains the current checkpoint_lsn.
65@param[in] log redo log
66@param[out] block block to read encryption information into
67@return DB_SUCCESS or DB_ERROR */
68[[nodiscard]] dberr_t log_encryption_read(
70
71/** Read the log encryption information from Redo Log Handler and update
72log.m_encryption_metadata and log.m_encryption_buf.
73@param[out] log redo log
74@return DB_SUCCESS or DB_ERROR */
75[[nodiscard]] dberr_t log_read_encryption_info(log_t &log);
76
77/** Update in-mem encryption information with the new information and also
78write this new information to encryption header.
79@param[in,out] log redo log
80@param[in] block block containing new encryption information
81@return DB_SUCCESS or DB_ERROR */
84
85/** Generate new encryption information for REDO log.
86@return DB_SUCCESS or DB_ERROR */
88
89/** @return true iff redo log is encrypted (checks in-memory metadata in log_t).
90 */
91[[nodiscard]] bool log_can_encrypt(const log_t &log);
92
93/** @} */
94
95#endif /* !UNIV_HOTBACKUP */
96
97#endif /* !log0encryption_h */
std::array< unsigned char, METADATA_BLOCK_SIZE > Metadata_value
Definition: log0handler_interface.h:785
dberr_t
Definition: db0err.h:39
dberr_t log_encryption_generate_metadata()
Generate new encryption information for REDO log.
Definition: log0encryption.cc:176
dberr_t log_encryption_update_and_write_header(log_t &log, const ib::redo::Handler_interface::Metadata_value block)
Update in-mem encryption information with the new information and also write this new information to ...
Definition: log0encryption.cc:162
dberr_t log_read_encryption_info(log_t &log)
Read the log encryption information from Redo Log Handler and update log.m_encryption_metadata and lo...
Definition: log0encryption.cc:92
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:136
dberr_t log_encryption_read(log_t &log, ib::redo::Handler_interface::Metadata_value &block)
Reads the log encryption header to get the redo log encryption information.
Definition: log0encryption.cc:73
bool log_can_encrypt(const log_t &log)
Definition: log0encryption.cc:158
Redo log - the main header.
Redo log - the log_sys.
Definition: buf0block_hint.cc:30
Page encryption infrastructure.
Encryption metadata.
Definition: os0enc.h:445
Redo log - single data structure with state of the redo log system.
Definition: log0sys.h:77
Version control for database, common definitions, and include files.