MySQL 9.1.0
Source Code Documentation
log0encryption.h
Go to the documentation of this file.
1/*****************************************************************************
2
3Copyright (c) 1995, 2024, 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#ifndef UNIV_HOTBACKUP
39
40/* byte */
41#include "univ.i"
42
43/**************************************************/ /**
44
45 @name Log - encryption management.
46
47 *******************************************************/
48
49/** @{ */
50
51/** Writes encryption information to log header.
52@param[in] encryption_metadata encryption metadata (algorithm, key, iv)
53@param[in] encrypt_key encrypt with master key
54@param[in,out] buf log file encryption header */
56 const Encryption_metadata &encryption_metadata, bool encrypt_key,
57 byte *buf);
58
59/** Reads the log encryption header to get the redo log encryption information.
60Read is done using the file which contains the current checkpoint_lsn.
61Updates: log.m_encryption_metadata and log.m_encryption_buf.
62@param[in,out] log redo log
63@return DB_SUCCESS or DB_ERROR */
65
66/** Reads the log encryption header to get the redo log encryption information.
67Read is done using the provided file.
68Updates: log.m_encryption_metadata and log.m_encryption_buf.
69@param[in,out] log redo log
70@param[in] file redo file to read from
71@return DB_SUCCESS or DB_ERROR */
73
74/** Enables the redo log encryption and generates new encryption metadata.
75Writes the generated metadata to the log encryption header in the log file
76containing the current checkpoint lsn (log.last_checkpoint_lsn).
77@param[in,out] log redo log
78@return DB_SUCCESS or DB_ERROR */
80
81/** Re-encrypts the redo log's encryption metadata using the current master key
82and writes it encrypted to the log encryption header in the log file containing
83the current checkpoint lsn (log.last_checkpoint_lsn)).
84@remarks This is called after the new master key has been generated.
85@return DB_SUCCESS or DB_ERROR */
87
88/** @return true iff redo log is encrypted (checks in-memory metadata in log_t).
89 */
90bool log_can_encrypt(const log_t &log);
91
92/** @} */
93
94#endif /* !UNIV_HOTBACKUP */
95
96#endif /* !log0encryption_h */
dberr_t
Definition: db0err.h:39
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:196
dberr_t log_encryption_read(log_t &log)
Reads the log encryption header to get the redo log encryption information.
Definition: log0encryption.cc:85
dberr_t log_encryption_generate_metadata(log_t &log)
Enables the redo log encryption and generates new encryption metadata.
Definition: log0encryption.cc:208
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:141
bool log_can_encrypt(const log_t &log)
Definition: log0encryption.cc:192
Definition: buf0block_hint.cc:30
Definition: os0file.h:89
Encryption metadata.
Definition: os0enc.h:445
Meta information about single log file.
Definition: log0types.h:454
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.