| Index: media/crypto/aes_decryptor_unittest.cc
|
| diff --git a/media/crypto/aes_decryptor_unittest.cc b/media/crypto/aes_decryptor_unittest.cc
|
| index 1b9d52e51b24be3322e45c14441b07f60adf2a8c..0b4deee97b5d6d0cc24276c44688b25dde55e5a6 100644
|
| --- a/media/crypto/aes_decryptor_unittest.cc
|
| +++ b/media/crypto/aes_decryptor_unittest.cc
|
| @@ -7,7 +7,6 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/bind.h"
|
| -#include "base/sys_byteorder.h"
|
| #include "media/base/decoder_buffer.h"
|
| #include "media/base/decrypt_config.h"
|
| #include "media/base/mock_filters.h"
|
| @@ -92,8 +91,8 @@ const WebmEncryptedData kWebmEncryptedFrames[] = {
|
| 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40
|
| }, 16,
|
| // encrypted_data
|
| - { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| - 0x01, 0x9c, 0x71, 0x26, 0x57, 0x3e, 0x25, 0x37,
|
| + { 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
| + 0x00, 0x9c, 0x71, 0x26, 0x57, 0x3e, 0x25, 0x37,
|
| 0xf7, 0x31, 0x81, 0x19, 0x64, 0xce, 0xbc
|
| }, 23
|
| },
|
| @@ -164,13 +163,11 @@ static const SubsampleEntry kSubsampleEntries[] = {
|
| // Returns a 16 byte CTR counter block. The CTR counter block format is a
|
| // CTR IV appended with a CTR block counter. |iv| is a CTR IV. |iv_size| is
|
| // the size of |iv| in bytes.
|
| -static std::string GenerateCounterBlock(const uint8* iv, int iv_size) {
|
| - const int kDecryptionKeySize = 16;
|
| - CHECK_GT(iv_size, 0);
|
| - CHECK_LE(iv_size, kDecryptionKeySize);
|
| +static std::string GenerateCounterBlock(const uint8* iv, size_t iv_size) {
|
| + CHECK_LE(iv_size, static_cast<size_t>(DecryptConfig::kDecryptionKeySize));
|
|
|
| - std::string counter_block(reinterpret_cast<const char*>(iv), iv_size);
|
| - counter_block.append(kDecryptionKeySize - iv_size, 0);
|
| + std::string counter_block(DecryptConfig::kDecryptionKeySize, 0);
|
| + memcpy(&counter_block[0], reinterpret_cast<const char*>(iv), iv_size);
|
| return counter_block;
|
| }
|
|
|
| @@ -197,12 +194,8 @@ static scoped_refptr<DecoderBuffer> CreateWebMEncryptedBuffer(
|
| std::string counter_block_str;
|
|
|
| if (signal_byte & kWebMFlagEncryptedFrame) {
|
| - uint64 network_iv;
|
| - memcpy(&network_iv, data + data_offset, sizeof(network_iv));
|
| - const uint64 iv = base::NetToHost64(network_iv);
|
| - counter_block_str =
|
| - GenerateCounterBlock(reinterpret_cast<const uint8*>(&iv), sizeof(iv));
|
| - data_offset += sizeof(iv);
|
| + counter_block_str = GenerateCounterBlock(data + data_offset, kWebMIvSize);
|
| + data_offset += kWebMIvSize;
|
| }
|
|
|
| encrypted_buffer->SetDecryptConfig(
|
|
|