MySQL 8.3.0
Source Code Documentation
log0encryption.cc File Reference
#include <cstring>
#include "log0chkp.h"
#include "log0encryption.h"
#include "log0files_governor.h"
#include "log0files_io.h"
#include "log0sys.h"
#include "log0types.h"
#include "log0write.h"
#include "os0enc.h"
#include "srv0srv.h"
#include "ut0mutex.h"

Functions

Log - encryption.
static Log_files_dict::Const_iterator log_encryption_file (const log_t &log)
 Finds redo log file which has the current log encryption header. More...
 
dberr_t log_encryption_read (log_t &log)
 Reads the log encryption header to get the redo log encryption information. More...
 
dberr_t log_encryption_read (log_t &log, const Log_file &file)
 Reads the log encryption header to get the redo log encryption information. More...
 
bool log_file_header_fill_encryption (const Encryption_metadata &encryption_metadata, bool encrypt_key, byte *buf)
 Writes encryption information to log header. More...
 
static dberr_t log_encryption_write_low (log_t &log)
 Writes the encryption information into the log encryption header in the log file containing current checkpoint LSN (log.last_checkpoint_lsn). More...
 
bool log_can_encrypt (const log_t &log)
 
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 to the log encryption header in the log file containing the current checkpoint lsn (log.last_checkpoint_lsn)). More...
 
dberr_t log_encryption_generate_metadata (log_t &log)
 Enables the redo log encryption and generates new encryption metadata. More...
 

Function Documentation

◆ log_can_encrypt()

bool log_can_encrypt ( const log_t log)
Returns
true iff redo log is encrypted (checks in-memory metadata in log_t).

◆ log_encryption_file()

static Log_files_dict::Const_iterator log_encryption_file ( const log_t log)
static

Finds redo log file which has the current log encryption header.

Asserts that the file has been found.

Parameters
[in]logredo log
Returns
iterator to the file containing current log encryption header

◆ log_encryption_generate_metadata()

dberr_t log_encryption_generate_metadata ( log_t log)

Enables the redo log encryption and generates new encryption metadata.

Writes the generated metadata to the log encryption header in the log file containing the current checkpoint lsn (log.last_checkpoint_lsn).

Parameters
[in,out]logredo log
Returns
DB_SUCCESS or DB_ERROR

◆ log_encryption_on_master_key_changed()

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 to the log encryption header in the log file containing the current checkpoint lsn (log.last_checkpoint_lsn)).

Remarks
This is called after the new master key has been generated.
Returns
DB_SUCCESS or DB_ERROR

◆ log_encryption_read() [1/2]

dberr_t log_encryption_read ( log_t log)

Reads the log encryption header to get the redo log encryption information.

Read is done using the file which contains the current checkpoint_lsn. Updates: log.m_encryption_metadata and log.m_encryption_buf.

Parameters
[in,out]logredo log
Returns
DB_SUCCESS or DB_ERROR

◆ log_encryption_read() [2/2]

dberr_t log_encryption_read ( log_t log,
const Log_file file 
)

Reads the log encryption header to get the redo log encryption information.

Read is done using the provided file. Updates: log.m_encryption_metadata and log.m_encryption_buf.

Parameters
[in,out]logredo log
[in]fileredo file to read from
Returns
DB_SUCCESS or DB_ERROR

◆ log_encryption_write_low()

static dberr_t log_encryption_write_low ( log_t log)
static

Writes the encryption information into the log encryption header in the log file containing current checkpoint LSN (log.last_checkpoint_lsn).

Updates: log.m_encryption_buf.

Parameters
[in,out]logredo log
Returns
DB_SUCCESS or DB_ERROR

◆ log_file_header_fill_encryption()

bool log_file_header_fill_encryption ( const Encryption_metadata encryption_metadata,
bool  encrypt_key,
byte buf 
)

Writes encryption information to log header.

Parameters
[in]encryption_metadataencryption metadata (algorithm, key, iv)
[in]encrypt_keyencrypt with master key
[in,out]buflog file encryption header