Basic encryption feature for libvpx.
New decoder control paramter VP8_SET_DECRYPT_KEY to set the decryption key. Change-Id: I6fc1f44d41f74f3b3f702778af1a6f8f5cc9439f
This commit is contained in:
@@ -26,6 +26,20 @@ extern "C" {
|
||||
|
||||
namespace {
|
||||
const int num_tests = 10;
|
||||
|
||||
void encrypt_buffer(uint8_t *buffer, int size, const uint8_t *key) {
|
||||
for (int i = 0; i < size; ++i) {
|
||||
buffer[i] ^= key[i % 32];
|
||||
}
|
||||
}
|
||||
|
||||
const uint8_t secret_key[32] = {
|
||||
234, 32, 2, 3, 4, 230, 6, 11,
|
||||
0, 132, 22, 23, 45, 21, 124, 255,
|
||||
0, 43, 52, 3, 23, 63, 99, 7,
|
||||
120, 8, 252, 84, 4, 83, 6, 13
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
@@ -71,7 +85,12 @@ TEST(VP8, TestBitIO) {
|
||||
vp8_stop_encode(&bw);
|
||||
|
||||
BOOL_DECODER br;
|
||||
vp8dx_start_decode(&br, bw_buffer, buffer_size);
|
||||
|
||||
#if CONFIG_DECRYPT
|
||||
encrypt_buffer(bw_buffer, buffer_size, secret_key);
|
||||
#endif
|
||||
|
||||
vp8dx_start_decode(&br, bw_buffer, buffer_size, bw_buffer, secret_key);
|
||||
bit_rnd.Reset(random_seed);
|
||||
for (int i = 0; i < bits_to_test; ++i) {
|
||||
if (bit_method == 2) {
|
||||
|
Reference in New Issue
Block a user