media/cdm: drop deps on SymmetricKey, 3/n
This change drops dependencies on crypto::SymmetricKey in the cdm decryptor fuzzers, and removes the decrypt function variants that accept SymmetricKeys. A subsequent CL will remove SymmetricKey use from AesDecryptor, which will require a larger cleanup. Bug: 372283556 Change-Id: If5878cd82590b5bf03f6916a4f30d9ad19e6299e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6091303 Commit-Queue: Elly FJ <ellyjones@chromium.org> Reviewed-by: Xiaohan Wang <xhwang@chromium.org> Cr-Commit-Position: refs/heads/main@{#1401557}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
44e58ff6c4
commit
4ee5103da7
@ -159,10 +159,10 @@ static scoped_refptr<DecoderBuffer> DecryptData(
|
||||
CHECK(input.decrypt_config());
|
||||
|
||||
if (input.decrypt_config()->encryption_scheme() == EncryptionScheme::kCenc)
|
||||
return DecryptCencBuffer(input, key);
|
||||
return DecryptCencBuffer(input, base::as_byte_span(key.key()));
|
||||
|
||||
if (input.decrypt_config()->encryption_scheme() == EncryptionScheme::kCbcs)
|
||||
return DecryptCbcsBuffer(input, key);
|
||||
return DecryptCbcsBuffer(input, base::as_byte_span(key.key()));
|
||||
|
||||
DVLOG(1) << "Only 'cenc' and 'cbcs' modes supported.";
|
||||
return nullptr;
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "base/logging.h"
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "base/numerics/checked_math.h"
|
||||
#include "crypto/symmetric_key.h"
|
||||
#include "media/base/decoder_buffer.h"
|
||||
#include "media/base/decrypt_config.h"
|
||||
#include "media/base/encryption_pattern.h"
|
||||
@ -123,12 +122,6 @@ bool DecryptWithPattern(base::span<const uint8_t> key,
|
||||
|
||||
} // namespace
|
||||
|
||||
scoped_refptr<DecoderBuffer> DecryptCbcsBuffer(
|
||||
const DecoderBuffer& input,
|
||||
const crypto::SymmetricKey& key) {
|
||||
return DecryptCbcsBuffer(input, base::as_byte_span(key.key()));
|
||||
}
|
||||
|
||||
scoped_refptr<DecoderBuffer> DecryptCbcsBuffer(const DecoderBuffer& input,
|
||||
base::span<const uint8_t> key) {
|
||||
const size_t sample_size = input.size();
|
||||
|
@ -9,10 +9,6 @@
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "media/base/media_export.h"
|
||||
|
||||
namespace crypto {
|
||||
class SymmetricKey;
|
||||
}
|
||||
|
||||
namespace media {
|
||||
class DecoderBuffer;
|
||||
|
||||
@ -47,9 +43,6 @@ class DecoderBuffer;
|
||||
|
||||
// Decrypts the encrypted buffer |input| using |key| and values found in
|
||||
// |input|->DecryptConfig. The key size must be 128 bits.
|
||||
MEDIA_EXPORT scoped_refptr<DecoderBuffer> DecryptCbcsBuffer(
|
||||
const DecoderBuffer& input,
|
||||
const crypto::SymmetricKey& key);
|
||||
MEDIA_EXPORT scoped_refptr<DecoderBuffer> DecryptCbcsBuffer(
|
||||
const DecoderBuffer& input,
|
||||
base::span<const uint8_t> key);
|
||||
|
@ -50,11 +50,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data_ptr, size_t size) {
|
||||
const uint8_t encryption_pattern = data[1];
|
||||
data = data.subspan<2>();
|
||||
|
||||
static std::unique_ptr<crypto::SymmetricKey> key =
|
||||
crypto::SymmetricKey::Import(
|
||||
crypto::SymmetricKey::AES,
|
||||
std::string(std::begin(kKey), std::end(kKey)));
|
||||
|
||||
// |clear_bytes| is used to determine how much of the buffer is "clear".
|
||||
// Since the code checks SubsampleEntries, use |clear_bytes| as the actual
|
||||
// number of bytes clear, and the rest as encrypted. To avoid size_t problems,
|
||||
@ -75,9 +70,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data_ptr, size_t size) {
|
||||
|
||||
// Key_ID is never used.
|
||||
encrypted_buffer->set_decrypt_config(media::DecryptConfig::CreateCbcsConfig(
|
||||
"key_id", std::string(std::begin(kIv), std::end(kIv)), subsamples,
|
||||
pattern));
|
||||
"key_id", std::string(base::as_string_view(kIv)), subsamples, pattern));
|
||||
|
||||
media::DecryptCbcsBuffer(*encrypted_buffer, *key);
|
||||
media::DecryptCbcsBuffer(*encrypted_buffer, kKey);
|
||||
return 0;
|
||||
}
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "base/containers/span.h"
|
||||
#include "base/logging.h"
|
||||
#include "crypto/aes_ctr.h"
|
||||
#include "crypto/symmetric_key.h"
|
||||
#include "media/base/decoder_buffer.h"
|
||||
#include "media/base/decrypt_config.h"
|
||||
#include "media/base/subsample_entry.h"
|
||||
@ -69,12 +68,6 @@ void CopyExtraSettings(const DecoderBuffer& input, DecoderBuffer* output) {
|
||||
|
||||
} // namespace
|
||||
|
||||
scoped_refptr<DecoderBuffer> DecryptCencBuffer(
|
||||
const DecoderBuffer& input,
|
||||
const crypto::SymmetricKey& wrapped_key) {
|
||||
return DecryptCencBuffer(input, base::as_byte_span(wrapped_key.key()));
|
||||
}
|
||||
|
||||
scoped_refptr<DecoderBuffer> DecryptCencBuffer(const DecoderBuffer& input,
|
||||
base::span<const uint8_t> key) {
|
||||
base::span<const uint8_t> sample = input;
|
||||
|
@ -9,10 +9,6 @@
|
||||
#include "base/memory/scoped_refptr.h"
|
||||
#include "media/base/media_export.h"
|
||||
|
||||
namespace crypto {
|
||||
class SymmetricKey;
|
||||
}
|
||||
|
||||
namespace media {
|
||||
class DecoderBuffer;
|
||||
|
||||
@ -38,9 +34,6 @@ class DecoderBuffer;
|
||||
|
||||
// Decrypts the encrypted buffer |input| using |key| and values found in
|
||||
// |input|->DecryptConfig. The key size must be 128 bits.
|
||||
MEDIA_EXPORT scoped_refptr<DecoderBuffer> DecryptCencBuffer(
|
||||
const DecoderBuffer& input,
|
||||
const crypto::SymmetricKey& key);
|
||||
MEDIA_EXPORT scoped_refptr<DecoderBuffer> DecryptCencBuffer(
|
||||
const DecoderBuffer& input,
|
||||
base::span<const uint8_t> key);
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "base/logging.h"
|
||||
#include "crypto/symmetric_key.h"
|
||||
#include "media/base/decoder_buffer.h"
|
||||
#include "media/base/subsample_entry.h"
|
||||
|
||||
@ -48,11 +47,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data_ptr, size_t size) {
|
||||
const uint8_t clear_bytes = data[0];
|
||||
data = data.subspan<1>();
|
||||
|
||||
static std::unique_ptr<crypto::SymmetricKey> key =
|
||||
crypto::SymmetricKey::Import(
|
||||
crypto::SymmetricKey::AES,
|
||||
std::string(std::begin(kKey), std::end(kKey)));
|
||||
|
||||
// |clear_bytes| is used to determine how much of the buffer is "clear".
|
||||
// Since the code checks SubsampleEntries, use |clear_bytes| as the actual
|
||||
// number of bytes clear, and the rest as encrypted. To avoid size_t problems,
|
||||
@ -70,6 +64,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data_ptr, size_t size) {
|
||||
encrypted_buffer->set_decrypt_config(media::DecryptConfig::CreateCencConfig(
|
||||
"key_id", std::string(base::as_string_view(kIv)), subsamples));
|
||||
|
||||
media::DecryptCencBuffer(*encrypted_buffer, *key);
|
||||
media::DecryptCencBuffer(*encrypted_buffer, kKey);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user