mirror of
https://github.com/MariaDB/server.git
synced 2026-05-16 20:07:13 +02:00
MDEV-12114: install_db shows corruption for rest encryption and innodb_checksum_algorithm=strict_none
Problem was that checksum check resulted false positives that page is both not encrypted and encryted when checksum_algorithm was strict_none. Encrypton checksum will use only crc32 regardless of setting. buf_zip_decompress: If compression fails report a error message containing the space name if available (not available during import). And note if space could be encrypted. buf_page_get_gen: Do not assert if decompression fails, instead unfix the page and return NULL to upper layer. fil_crypt_calculate_checksum: Use only crc32 method. fil_space_verify_crypt_checksum: Here we need to check crc32, innodb and none method for old datafiles. fil_space_release_for_io: Allow null space. encryption.innodb-compressed-blob is now run with crc32 and none combinations. Note that with none and strict_none method there is not really a way to detect page corruptions and page corruptions after decrypting the page with incorrect key. New test innodb-checksum-algorithm to test different checksum algorithms with encrypted, row compressed and page compressed tables.
This commit is contained in:
parent
1af8bf39ca
commit
6b6987154a
11 changed files with 1577 additions and 117 deletions
|
|
@ -887,7 +887,7 @@ fil_space_decrypt(
|
|||
Calculate post encryption checksum
|
||||
@param[in] zip_size zip_size or 0
|
||||
@param[in] dst_frame Block where checksum is calculated
|
||||
@return page checksum or BUF_NO_CHECKSUM_MAGIC
|
||||
@return page checksum
|
||||
not needed. */
|
||||
UNIV_INTERN
|
||||
ulint
|
||||
|
|
@ -896,30 +896,13 @@ fil_crypt_calculate_checksum(
|
|||
const byte* dst_frame)
|
||||
{
|
||||
ib_uint32_t checksum = 0;
|
||||
srv_checksum_algorithm_t algorithm =
|
||||
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
|
||||
|
||||
/* For encrypted tables we use only crc32 and strict_crc32 */
|
||||
if (zip_size == 0) {
|
||||
switch (algorithm) {
|
||||
case SRV_CHECKSUM_ALGORITHM_CRC32:
|
||||
case SRV_CHECKSUM_ALGORITHM_STRICT_CRC32:
|
||||
checksum = buf_calc_page_crc32(dst_frame);
|
||||
break;
|
||||
case SRV_CHECKSUM_ALGORITHM_INNODB:
|
||||
case SRV_CHECKSUM_ALGORITHM_STRICT_INNODB:
|
||||
checksum = (ib_uint32_t) buf_calc_page_new_checksum(
|
||||
dst_frame);
|
||||
break;
|
||||
case SRV_CHECKSUM_ALGORITHM_NONE:
|
||||
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
|
||||
checksum = BUF_NO_CHECKSUM_MAGIC;
|
||||
break;
|
||||
/* no default so the compiler will emit a warning
|
||||
* if new enum is added and not handled here */
|
||||
}
|
||||
checksum = buf_calc_page_crc32(dst_frame);
|
||||
} else {
|
||||
checksum = page_zip_calc_checksum(dst_frame, zip_size,
|
||||
algorithm);
|
||||
SRV_CHECKSUM_ALGORITHM_CRC32);
|
||||
}
|
||||
|
||||
return checksum;
|
||||
|
|
@ -953,14 +936,6 @@ fil_space_verify_crypt_checksum(
|
|||
return(false);
|
||||
}
|
||||
|
||||
srv_checksum_algorithm_t algorithm =
|
||||
static_cast<srv_checksum_algorithm_t>(srv_checksum_algorithm);
|
||||
|
||||
/* If no checksum is used, can't continue checking. */
|
||||
if (algorithm == SRV_CHECKSUM_ALGORITHM_NONE) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
/* Read stored post encryption checksum. */
|
||||
ib_uint32_t checksum = mach_read_from_4(
|
||||
page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + 4);
|
||||
|
|
@ -1044,7 +1019,6 @@ fil_space_verify_crypt_checksum(
|
|||
checksum2 = mach_read_from_4(
|
||||
page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM);
|
||||
valid = (buf_page_is_checksum_valid_crc32(page,checksum1,checksum2)
|
||||
|| buf_page_is_checksum_valid_none(page,checksum1,checksum2)
|
||||
|| buf_page_is_checksum_valid_innodb(page,checksum1, checksum2));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue