Revert "Limit output buffer size during decrypt fallback"
Revert submission 28914157 Reason for revert: b/372348308 Reverted changes: /q/submissionid:28914157 Change-Id: Ib77156ffe6abed0f8feee5d9f60f24a90e749ff8
This commit is contained in:
@@ -161,6 +161,7 @@ void AdvanceDestBuffer(OEMCrypto_DestBufferDesc* dest_buffer, size_t bytes) {
|
|||||||
switch (dest_buffer->type) {
|
switch (dest_buffer->type) {
|
||||||
case OEMCrypto_BufferType_Clear:
|
case OEMCrypto_BufferType_Clear:
|
||||||
dest_buffer->buffer.clear.clear_buffer += bytes;
|
dest_buffer->buffer.clear.clear_buffer += bytes;
|
||||||
|
dest_buffer->buffer.clear.clear_buffer_length -= bytes;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case OEMCrypto_BufferType_Secure:
|
case OEMCrypto_BufferType_Secure:
|
||||||
@@ -3253,11 +3254,6 @@ OEMCryptoResult CryptoSession::DecryptSample(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fake_sample.buffers.input_data_length = length;
|
fake_sample.buffers.input_data_length = length;
|
||||||
if (fake_sample.buffers.output_descriptor.type ==
|
|
||||||
OEMCrypto_BufferType_Clear) {
|
|
||||||
fake_sample.buffers.output_descriptor.buffer.clear
|
|
||||||
.clear_buffer_length = length;
|
|
||||||
}
|
|
||||||
fake_sample.subsamples = &clear_subsample;
|
fake_sample.subsamples = &clear_subsample;
|
||||||
fake_sample.subsamples_length = 1;
|
fake_sample.subsamples_length = 1;
|
||||||
|
|
||||||
@@ -3285,11 +3281,6 @@ OEMCryptoResult CryptoSession::DecryptSample(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fake_sample.buffers.input_data_length = length;
|
fake_sample.buffers.input_data_length = length;
|
||||||
if (fake_sample.buffers.output_descriptor.type ==
|
|
||||||
OEMCrypto_BufferType_Clear) {
|
|
||||||
fake_sample.buffers.output_descriptor.buffer.clear
|
|
||||||
.clear_buffer_length = length;
|
|
||||||
}
|
|
||||||
fake_sample.subsamples = &encrypted_subsample;
|
fake_sample.subsamples = &encrypted_subsample;
|
||||||
fake_sample.subsamples_length = 1;
|
fake_sample.subsamples_length = 1;
|
||||||
|
|
||||||
@@ -3382,10 +3373,6 @@ OEMCryptoResult CryptoSession::LegacyCopyBufferInChunks(
|
|||||||
// Calculate the size of the next chunk.
|
// Calculate the size of the next chunk.
|
||||||
const size_t chunk_size = std::min(remaining_input_data, max_chunk_size);
|
const size_t chunk_size = std::min(remaining_input_data, max_chunk_size);
|
||||||
|
|
||||||
if (output_descriptor.type == OEMCrypto_BufferType_Clear) {
|
|
||||||
output_descriptor.buffer.clear.clear_buffer_length = chunk_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Re-add "last subsample" flag if this is the last subsample.
|
// Re-add "last subsample" flag if this is the last subsample.
|
||||||
if (chunk_size == remaining_input_data) {
|
if (chunk_size == remaining_input_data) {
|
||||||
subsample_flags |= OEMCrypto_LastSubsample;
|
subsample_flags |= OEMCrypto_LastSubsample;
|
||||||
@@ -3433,11 +3420,6 @@ OEMCryptoResult CryptoSession::LegacyDecryptInChunks(
|
|||||||
// Calculate the size of the next chunk.
|
// Calculate the size of the next chunk.
|
||||||
const size_t chunk_size = std::min(remaining_input_data, max_chunk_size);
|
const size_t chunk_size = std::min(remaining_input_data, max_chunk_size);
|
||||||
fake_sample.buffers.input_data_length = chunk_size;
|
fake_sample.buffers.input_data_length = chunk_size;
|
||||||
if (fake_sample.buffers.output_descriptor.type ==
|
|
||||||
OEMCrypto_BufferType_Clear) {
|
|
||||||
fake_sample.buffers.output_descriptor.buffer.clear.clear_buffer_length =
|
|
||||||
chunk_size;
|
|
||||||
}
|
|
||||||
if (is_protected) {
|
if (is_protected) {
|
||||||
fake_subsample.num_bytes_encrypted = chunk_size;
|
fake_subsample.num_bytes_encrypted = chunk_size;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ void advance_dest_buffer(OEMCrypto_DestBufferDesc* dest_buffer, size_t bytes) {
|
|||||||
switch (dest_buffer->type) {
|
switch (dest_buffer->type) {
|
||||||
case OEMCrypto_BufferType_Clear:
|
case OEMCrypto_BufferType_Clear:
|
||||||
dest_buffer->buffer.clear.clear_buffer += bytes;
|
dest_buffer->buffer.clear.clear_buffer += bytes;
|
||||||
|
dest_buffer->buffer.clear.clear_buffer_length -= bytes;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OEMCrypto_BufferType_Secure:
|
case OEMCrypto_BufferType_Secure:
|
||||||
@@ -98,11 +99,6 @@ OEMCryptoResult DecryptFallbackChain::DecryptSample(
|
|||||||
const size_t length =
|
const size_t length =
|
||||||
subsample.num_bytes_clear + subsample.num_bytes_encrypted;
|
subsample.num_bytes_clear + subsample.num_bytes_encrypted;
|
||||||
fake_sample.buffers.input_data_length = length;
|
fake_sample.buffers.input_data_length = length;
|
||||||
if (fake_sample.buffers.output_descriptor.type ==
|
|
||||||
OEMCrypto_BufferType_Clear) {
|
|
||||||
fake_sample.buffers.output_descriptor.buffer.clear.clear_buffer_length =
|
|
||||||
length;
|
|
||||||
}
|
|
||||||
fake_sample.subsamples = &subsample;
|
fake_sample.subsamples = &subsample;
|
||||||
fake_sample.subsamples_length = 1;
|
fake_sample.subsamples_length = 1;
|
||||||
|
|
||||||
@@ -148,11 +144,6 @@ OEMCryptoResult DecryptFallbackChain::DecryptSubsample(
|
|||||||
|
|
||||||
if (subsample.num_bytes_clear > 0) {
|
if (subsample.num_bytes_clear > 0) {
|
||||||
fake_sample.buffers.input_data_length = subsample.num_bytes_clear;
|
fake_sample.buffers.input_data_length = subsample.num_bytes_clear;
|
||||||
if (fake_sample.buffers.output_descriptor.type ==
|
|
||||||
OEMCrypto_BufferType_Clear) {
|
|
||||||
fake_sample.buffers.output_descriptor.buffer.clear.clear_buffer_length =
|
|
||||||
subsample.num_bytes_clear;
|
|
||||||
}
|
|
||||||
fake_subsample.num_bytes_clear = subsample.num_bytes_clear;
|
fake_subsample.num_bytes_clear = subsample.num_bytes_clear;
|
||||||
fake_subsample.num_bytes_encrypted = 0;
|
fake_subsample.num_bytes_encrypted = 0;
|
||||||
fake_subsample.block_offset = 0;
|
fake_subsample.block_offset = 0;
|
||||||
@@ -176,11 +167,6 @@ OEMCryptoResult DecryptFallbackChain::DecryptSubsample(
|
|||||||
|
|
||||||
if (subsample.num_bytes_encrypted > 0) {
|
if (subsample.num_bytes_encrypted > 0) {
|
||||||
fake_sample.buffers.input_data_length = subsample.num_bytes_encrypted;
|
fake_sample.buffers.input_data_length = subsample.num_bytes_encrypted;
|
||||||
if (fake_sample.buffers.output_descriptor.type ==
|
|
||||||
OEMCrypto_BufferType_Clear) {
|
|
||||||
fake_sample.buffers.output_descriptor.buffer.clear.clear_buffer_length =
|
|
||||||
subsample.num_bytes_encrypted;
|
|
||||||
}
|
|
||||||
fake_subsample.num_bytes_clear = 0;
|
fake_subsample.num_bytes_clear = 0;
|
||||||
fake_subsample.num_bytes_encrypted = subsample.num_bytes_encrypted;
|
fake_subsample.num_bytes_encrypted = subsample.num_bytes_encrypted;
|
||||||
fake_subsample.block_offset = subsample.block_offset;
|
fake_subsample.block_offset = subsample.block_offset;
|
||||||
|
|||||||
Reference in New Issue
Block a user