Skip to content

Commit 69a4b4e

Browse files
committed
- Comment updates for clarity.
1 parent d21fa58 commit 69a4b4e

2 files changed

Lines changed: 7 additions & 9 deletions

File tree

src/server/encryption_sequencer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ bool DataBatchEncryptionSequencer::ConvertAndEncrypt(const std::vector<uint8_t>&
166166
compression_ == CompressionCodec::SNAPPY);
167167

168168
// Format: Only PLAIN is currently supported
169-
// RLE_DICTIONARY is permanently unsupported for per-value encryption since the values are not present in the
169+
// RLE_DICTIONARY is not supported for per-value encryption since the values are not present in the
170170
// `plaintext` data, only references to them.
171171
const bool is_format_supported = (format_ == Format::PLAIN && format_ != Format::RLE_DICTIONARY);
172172

173173
// Page type: All are supported (DATA_PAGE_V1, DATA_PAGE_V2, DICTIONARY_PAGE)
174174
const bool is_page_supported = true;
175175

176176
// Datatype: All datatypes are supported except BOOLEAN.
177-
// BOOLEAN is permanently unsupported for per-value encryption and always defaults to per-block encryption.
177+
// BOOLEAN is not supported for per-value encryption and always defaults to per-block encryption.
178178
const bool is_datatype_supported = (datatype_ != Type::BOOLEAN);
179179

180180
if (is_compression_supported && is_format_supported && is_page_supported && is_datatype_supported) {

src/server/encryption_sequencer_test.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -419,8 +419,7 @@ TEST(EncryptionSequencer, ResultStorage) {
419419

420420
// Test BOOLEAN type uses per-block encryption (not per-value)
421421
TEST(EncryptionSequencer, BooleanTypeUsesPerBlockEncryption) {
422-
// BOOLEAN is permanently unsupported for per-value operations
423-
// and always defaults to per-block encryption
422+
// BOOLEAN is not supported for per-value encryption and always defaults to per-block encryption
424423
std::vector<uint8_t> boolean_data = {0xB4, 0xFF, 0x00}; // some boolean bit-packed data
425424

426425
DataBatchEncryptionSequencer sequencer(
@@ -440,8 +439,8 @@ TEST(EncryptionSequencer, BooleanTypeUsesPerBlockEncryption) {
440439
bool result = sequencer.ConvertAndEncrypt(boolean_data);
441440
ASSERT_TRUE(result) << "BOOLEAN encryption failed: " << sequencer.error_stage_ << " - " << sequencer.error_message_;
442441

443-
// Verify it used per-block encryption mode
444-
ASSERT_TRUE(sequencer.encryption_metadata_.count("encrypt_mode_dict_page") > 0);
442+
// Verify per-block encryption mode as used.
443+
ASSERT_TRUE(sequencer.encryption_metadata_.count("encrypt_mode_dict_page") == 1);
445444
EXPECT_EQ(sequencer.encryption_metadata_.at("encrypt_mode_dict_page"), "per_block");
446445

447446
// Verify round-trip works
@@ -452,8 +451,7 @@ TEST(EncryptionSequencer, BooleanTypeUsesPerBlockEncryption) {
452451

453452
// Test RLE_DICTIONARY format uses per-block encryption (not per-value)
454453
TEST(EncryptionSequencer, RleDictionaryFormatUsesPerBlockEncryption) {
455-
// RLE_DICTIONARY is permanently unsupported for per-value operations
456-
// since the values are not present in the data, only references to them
454+
// RLE_DICTIONARY is not supported for per-value encryption since the values are not present in the data, only references to them
457455
std::vector<uint8_t> rle_dict_data = {0x02, 0x00, 0x00, 0x00, 0x01}; // some RLE dictionary encoded data
458456

459457
DataBatchEncryptionSequencer sequencer(
@@ -474,7 +472,7 @@ TEST(EncryptionSequencer, RleDictionaryFormatUsesPerBlockEncryption) {
474472
ASSERT_TRUE(result) << "RLE_DICTIONARY encryption failed: " << sequencer.error_stage_ << " - " << sequencer.error_message_;
475473

476474
// Verify it used per-block encryption mode
477-
ASSERT_TRUE(sequencer.encryption_metadata_.count("encrypt_mode_dict_page") > 0);
475+
ASSERT_TRUE(sequencer.encryption_metadata_.count("encrypt_mode_dict_page") == 1);
478476
EXPECT_EQ(sequencer.encryption_metadata_.at("encrypt_mode_dict_page"), "per_block");
479477

480478
// Verify round-trip works

0 commit comments

Comments
 (0)