Changes included in this CL: 166806: Update OEMCrypto_GetDeviceInformation() | https://widevine-internal-review.googlesource.com/c/cdm/+/166806 166808: Update Android L3 after OEMCrypto_GetDeviceInformation() signature changes | https://widevine-internal-review.googlesource.com/c/cdm/+/166808 166809: Decode device info and write it to CSR payload | https://widevine-internal-review.googlesource.com/c/cdm/+/166809 167158: Fix Android include path and copy_files | https://widevine-internal-review.googlesource.com/c/cdm/+/167158 167159: Fix common typos and use inclusive language suggested by Android linter | https://widevine-internal-review.googlesource.com/c/cdm/+/167159 165618: Explicitly state python3 where needed. | https://widevine-internal-review.googlesource.com/c/cdm/+/165618 166757: Update Android.bp for Android | https://widevine-internal-review.googlesource.com/c/cdm/+/166757 164993: Refactor basic oemcrypto unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/164993 164978: Update OEMCrypto Unit Test Docs | https://widevine-internal-review.googlesource.com/c/cdm/+/164978 166941: Update make files for OEMCrypto | https://widevine-internal-review.googlesource.com/c/cdm/+/166941 165279: Refactor license unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/165279 165318: Refactor provisioning unit tests | https://widevine-internal-review.googlesource.com/c/cdm/+/165318 164800: Add extra check for renew on license load unit test | https://widevine-internal-review.googlesource.com/c/cdm/+/164800 165860: Remove duplicate definition of MaybeHex() | https://widevine-internal-review.googlesource.com/c/cdm/+/165860 164889: Updated CoreCommonRequestFromMessage and fix test | https://widevine-internal-review.googlesource.com/c/cdm/+/164889 164967: Add OPK pre-hook and post-hook error codes | https://widevine-internal-review.googlesource.com/c/cdm/+/164967 165140: Add hidden device_id_length to v18 provisioning message | https://widevine-internal-review.googlesource.com/c/cdm/+/165140 165204: Fix memory leak in oemcrypto test | https://widevine-internal-review.googlesource.com/c/cdm/+/165204 165958: Fix oemcrypto_generic_verify_fuzz mutator signature offset | https://widevine-internal-review.googlesource.com/c/cdm/+/165958 166037: Support SHA-256 in OEMCrypto Session Util | https://widevine-internal-review.googlesource.com/c/cdm/+/166037 Test: Run GtsMediaTests on Pixel 7 Bug: 270612144 Change-Id: Iff0820a2de7d043a820470a130af65b0dcadb759
63 lines
2.6 KiB
C++
63 lines
2.6 KiB
C++
// Copyright 2022 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine
|
|
// License Agreement.
|
|
//
|
|
// Test data for OEMCrypto unit tests.
|
|
//
|
|
#ifndef CDM_OEMCRYPTO_RESOURCE_TEST_
|
|
#define CDM_OEMCRYPTO_RESOURCE_TEST_
|
|
|
|
#include <gtest/gtest.h>
|
|
|
|
#include "OEMCryptoCENC.h"
|
|
#include "oemcrypto_types.h"
|
|
|
|
namespace wvoec {
|
|
constexpr size_t kBufferOverrunPadding = 16;
|
|
|
|
// Resource tiers:
|
|
constexpr size_t KiB = 1024;
|
|
constexpr size_t MiB = 1024 * 1024;
|
|
// Huge input buffer length used for OEMCryptoMemory* tests.
|
|
constexpr size_t kHugeInputBufferLength = 100 * MiB;
|
|
constexpr bool kCheckStatus = true;
|
|
constexpr bool kUpdateCoreMessageSubstringValues = true;
|
|
constexpr bool kDecryptCENCSecureBuffer = true;
|
|
constexpr size_t kHugeRandomNumber = 541236;
|
|
// With OEMCrypto v15 and above, we have different resource requirements
|
|
// depending on the resource rating reported by OEMCrypto. This function looks
|
|
// up the required value for the specified resource for the target OEMCrypto
|
|
// library.
|
|
template <typename T, size_t N>
|
|
T GetResourceValue(T (&resource_values)[N]) {
|
|
if (global_features.resource_rating < 1) return resource_values[0];
|
|
if (global_features.resource_rating > N) return resource_values[N - 1];
|
|
return resource_values[global_features.resource_rating - 1];
|
|
}
|
|
|
|
// After API 16, we require 300 entries in the usage table. Before API 16, we
|
|
// required 200.
|
|
inline size_t RequiredUsageSize() {
|
|
return global_features.api_version < 16 ? 200 : 300;
|
|
}
|
|
|
|
// These are the maximum sizes we test. That means it is the minimum size that
|
|
// OEMCrypto must support.
|
|
// clang-format off
|
|
const size_t kMaxSampleSize[] = { 1*MiB, 2*MiB, 4*MiB, 16*MiB};
|
|
const size_t kMaxNumberSubsamples[] = { 10, 16, 32, 64};
|
|
const size_t kMaxSubsampleSize[] = { 100*KiB, 500*KiB, 1*MiB, 4*MiB};
|
|
const size_t kMaxGenericBuffer[] = { 10*KiB, 100*KiB, 500*KiB, 1*MiB};
|
|
const size_t kMaxConcurrentSession[] = { 10, 20, 30, 40};
|
|
const size_t kMaxKeysPerSession[] = { 4, 20, 20, 30};
|
|
const size_t kMaxTotalKeys[] = { 16, 40, 80, 90};
|
|
const size_t kLargeMessageSize[] = { 8*KiB, 8*KiB, 16*KiB, 32*KiB};
|
|
const size_t kMaxTotalDRMPrivateKeys[] = { 2, 4, 6, 8};
|
|
// Note: Frame rate and simultaneous playback are specified by resource rating,
|
|
// but are tested at the system level, so there are no unit tests for frame
|
|
// rate. Similarly, number of subsamples for AV1
|
|
// const size_t kAV1NumberSubsamples[] = { 72, 144, 288, 576};
|
|
// clang-format on
|
|
} // namespace wvoec
|
|
#endif // CDM_OEMCRYPTO_RESOURCE_TEST_
|