Benchmarking and Unmasking
In this code drop we introduce the benchmarking tests that allow us to
compare the performance of different implementations. Like the other
tests, any implementation can link with them to create their own
binary.
There are two types of benchmarks:
1 - Throughput, which measures the speed that a function can process
information (bits per second). These are used for AEAD decrypt
and license white-box decrypt functions.
2 - Samples, which measures the min, 25% percentile, median, 75%
percentile, and max observed values. These is used for all other
functions as a way to measure the execute duration of a call.
The other change in this code drop is the update to the unmasking
function to only unmask a subset of the bytes in the masked buffer.
This was added to better align with the decoder behaviour in the CDM.
This commit is contained in:
@@ -370,23 +370,35 @@ WB_Result WB_License_MaskedDecrypt(const WB_License_Whitebox* whitebox,
|
||||
uint8_t* masked_output_data,
|
||||
size_t* masked_output_data_size);
|
||||
|
||||
// Unmasks the data in |buffer| using |secret_string|. |buffer| is operated on
|
||||
// in-place.
|
||||
// Unmasks a subset of the data in |masked_data| using |secret_string| and
|
||||
// writes it to |unmasked_data|.
|
||||
//
|
||||
// The subset is denoted as |offset| (inclusive) to |offset + size| (exclusive).
|
||||
// It is assumed that |offset| and |offset + size - 1| are both valid indexes
|
||||
// into |masked_data|.
|
||||
//
|
||||
// It is assumed that indexes between 0 and |size - 1| (inclusive) are all valid
|
||||
// indexes into |unmasked_data|.
|
||||
//
|
||||
// Args:
|
||||
// secret_string (in) : The "key" used to unmask the data in |buffer|.
|
||||
// masked_data (in) : The masked data to read from.
|
||||
//
|
||||
// offset (in) : The index into |masked_data| from where to start reading data.
|
||||
//
|
||||
// size (in) : The number of bytes from |masked_data| to unmask and copy into
|
||||
// |unmasked_data|.
|
||||
//
|
||||
// secret_string (in) : The auxiliary data for unmasking |masked_data|.
|
||||
//
|
||||
// secret_string_size (in) : The number of bytes in |secret_string|.
|
||||
//
|
||||
// buffer (in/out) : As input, this is the masked data. As output, this is the
|
||||
// unmasked data. The number of bytes in the masked data will be equal to the
|
||||
// number of bytes in the unmasked data.
|
||||
//
|
||||
// buffer_size (in) : The number of bytes in |buffer|.
|
||||
void WB_License_Unmask(const uint8_t* secret_string,
|
||||
// unmasked_data (out) : The output buffer to write the unmasked data to.
|
||||
void WB_License_Unmask(const uint8_t* masked_data,
|
||||
size_t offset,
|
||||
size_t size,
|
||||
const uint8_t* secret_string,
|
||||
size_t secret_string_size,
|
||||
uint8_t* buffer,
|
||||
size_t buffer_size);
|
||||
uint8_t* unmasked_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user