File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -147,9 +147,6 @@ bool DataBatchEncryptionSequencer::DecodeAndEncrypt(tcb::span<const uint8_t> pla
147147 // Encrypt the typed values buffer and level bytes, then join them into a single encrypted byte vector.
148148 auto encrypted_value_bytes = encryptor_->EncryptValueList (typed_buffer);
149149 auto encrypted_level_bytes = encryptor_->EncryptBlock (level_bytes);
150-
151- // Encrypted payloads mostly have a low-compression ratio, so the gains in size from compression are minimal or negative.
152- // Therefore, the final joined encrypted bytes are returned as-is without compression.
153150 encrypted_result_ = JoinWithLengthPrefix (encrypted_level_bytes, encrypted_value_bytes);
154151
155152 // Set the encryption type to per-value
@@ -232,9 +229,7 @@ bool DataBatchEncryptionSequencer::DecryptAndEncode(tcb::span<const uint8_t> cip
232229 if (encryption_mode == ENCRYPTION_MODE_PER_VALUE ) {
233230
234231 // Split the joined encrypted bytes, then decrypt the level and value bytes separately.
235- // The ciphertext payload is already the joined bytes without compression.
236232 auto [encrypted_level_bytes, encrypted_value_bytes] = SplitWithLengthPrefix (ciphertext);
237-
238233 auto level_bytes = encryptor_->DecryptBlock (encrypted_level_bytes);
239234 auto typed_buffer = encryptor_->DecryptValueList (encrypted_value_bytes);
240235
Original file line number Diff line number Diff line change @@ -155,14 +155,16 @@ ByteBuffer<Codec>::ByteBuffer(
155155 Codec codec)
156156 : elements_span_(elements_span),
157157 elements_span_size_ (elements_span.size()),
158+ // `num_elements_` is the expected number of elements in the buffer declared upfront.
159+ // - if the actual payload count mismatches, exceptions are thrown.
158160 num_elements_(num_elements),
159161 codec_(std::move(codec)),
160162 // `element_iterator_current_ptr_` is initialized to the start of the span.
161- // - it points to the start of the span + the prefix size if there is one.
163+ // - it is calculated to point to the start of the span + the prefix size if there is one.
162164 element_iterator_current_ptr_(
163165 elements_span.data() + std::min(prefix_size, elements_span_size_)),
164166 // `element_iterator_end_ptr_` is initialized to the end of the span.
165- // - it points to the start of the span + the size.
167+ // - it is calculated to point to the start of the span + the size.
166168 element_iterator_end_ptr_(elements_span.data() + elements_span_size_),
167169 element_iterator_count_(0 ),
168170 prefix_size_(prefix_size),
You can’t perform that action at this time.
0 commit comments