Renaming of Usage Table related variables and types.

[ Merge of http://go/wvgerrit/164077 ]

This CL makes major changes to the names of variables and types that
are related to the usage table, header, entries, entry indexes, and
other related data.

The renaming followed these rules:
1)  "Usage table header" will exclusively refer to the header blob
    that is OEMCrypto specific.  The CDM class "UsageTableHeader"
    is the CDM-layer's abstraction around the "usage table" concept.
    The name has been updated to reflect that.
2)  The "Cdm" prefix is only used for the CDM-specific data types for
    the usage table and entry info.  It has been removed from
    OEMCrypto-specific types.
    - UsageTableHeader -> CdmUsageTable
    - CdmUsageTableHeader -> UsageTableHeader
    - CdmUsageEntry -> UsageEntry
3)  The "usage_" prefix has been removed from variables when the usage
    table or usage entries are the subject of the function or class.
4)  UsageEntryIndex is the type for entry indexes, instead of directly
    using uint32_t.  This matches how we wrap other types in
    "wv_cdm_types.h"
5)  Changed entry "number" to entry "index".
6)  Vectors of elements have been renamed to be either pluralized or
    have a suffix "_list".
7)  "Usage info" was occasionally being used to refer to the usage
    table or entries generally, rather than specifically secure-stop.
    - CryptoSession::HasUsageInfoSupport() -> HasUsageTableSupport()

The most major change is that the files "usage_table_header*" have
been renamed to be "cdm_usage_table*".

Bug: 242914226
Test: run_x86_64_tests and request_license_test
Change-Id: Iee98446b71f4f2934d3c9e0fb949eb05b84d1f8c
This commit is contained in:
Alex Dale
2022-12-20 15:21:10 -08:00
parent 0080d04579
commit 1603ba127f
24 changed files with 1321 additions and 1382 deletions

View File

@@ -26,7 +26,7 @@ namespace wvcdm {
class CryptoKey;
class CryptoSessionFactory;
class OtaKeyboxProvisioner;
class UsageTableHeader;
class CdmUsageTable;
namespace okp {
class SystemFallbackPolicy;
@@ -273,13 +273,13 @@ class CryptoSession {
// Used to manipulate the CDM managed usage table header & entries,
// delegating calls to OEMCrypto.
// Determines whether the OEMCrypto library supports usage info.
// Determines whether the OEMCrypto library supports usage table.
// As of V16, the only valid type of support is usage table header +
// usage entries.
// The first method will use a cached value if present.
virtual bool HasUsageInfoSupport(bool* has_support);
virtual bool HasUsageInfoSupport(RequestedSecurityLevel security_level,
bool* has_support);
virtual bool HasUsageTableSupport(bool* has_support);
virtual bool HasUsageTableSupport(RequestedSecurityLevel security_level,
bool* has_support);
// Usage report.
virtual CdmResponseType DeactivateUsageInformation(
@@ -290,30 +290,28 @@ class CryptoSession {
int64_t* seconds_since_started, int64_t* seconds_since_last_played);
// Usage table header.
virtual UsageTableHeader* GetUsageTableHeader() {
return usage_table_header_;
}
virtual CdmUsageTable* GetUsageTable() { return usage_table_; }
// The following crypto methods do not require an open session to
// complete the operations.
virtual CdmResponseType CreateUsageTableHeader(
RequestedSecurityLevel requested_security_level,
CdmUsageTableHeader* usage_table_header);
UsageTableHeader* usage_table_header);
virtual CdmResponseType LoadUsageTableHeader(
RequestedSecurityLevel requested_security_level,
const CdmUsageTableHeader& usage_table_header);
const UsageTableHeader& usage_table_header);
virtual CdmResponseType ShrinkUsageTableHeader(
RequestedSecurityLevel requested_security_level, uint32_t new_entry_count,
CdmUsageTableHeader* usage_table_header);
UsageTableHeader* usage_table_header);
// Usage entry.
virtual CdmResponseType CreateUsageEntry(uint32_t* entry_number);
virtual CdmResponseType LoadUsageEntry(uint32_t entry_number,
const CdmUsageEntry& usage_entry);
virtual CdmResponseType UpdateUsageEntry(
CdmUsageTableHeader* usage_table_header, CdmUsageEntry* usage_entry);
virtual CdmResponseType CreateUsageEntry(UsageEntryIndex* entry_index);
virtual CdmResponseType LoadUsageEntry(UsageEntryIndex entry_index,
const UsageEntry& usage_entry);
virtual CdmResponseType UpdateUsageEntry(UsageTableHeader* usage_table_header,
UsageEntry* usage_entry);
// Adjust usage entries in usage table header.
virtual CdmResponseType MoveUsageEntry(uint32_t new_entry_number);
virtual CdmResponseType MoveUsageEntry(UsageEntryIndex new_entry_index);
virtual bool GetAnalogOutputCapabilities(bool* can_support_output,
bool* can_disable_output,
@@ -384,11 +382,11 @@ class CryptoSession {
void Init();
// Will set up the UsageTableHeader for this session. This may require
// creating a new UsageTableHeader if the global instance has not
// Will set up the CdmUsageTable for this session. This may require
// creating a new CdmUsageTable if the global instance has not
// been initialized.
// Note: This function will lock the global static field lock in write mode.
bool SetUpUsageTableHeader(RequestedSecurityLevel requested_security_level);
bool SetUpUsageTable(RequestedSecurityLevel requested_security_level);
CdmResponseType GenerateRsaSignature(const std::string& message,
std::string* signature);
@@ -399,10 +397,10 @@ class CryptoSession {
CdmResponseType SelectKey(const std::string& key_id,
CdmCipherMode cipher_mode);
// Retrieves the OEMCrypto usage info support for the specified
// Retrieves the OEMCrypto usage table support for the specified
// |requested_security_level|.
// Caller should acquire the OEMCrypto read lock before calling.
bool HasUsageInfoSupportInternal(
bool HasUsageTableSupportInternal(
RequestedSecurityLevel requested_security_level, bool* has_support);
// These methods fall back into each other in the order given, depending on
@@ -526,12 +524,12 @@ class CryptoSession {
RequestedSecurityLevel requested_security_level_;
// Open session-cached result of OEMCrypto_SupportsUsageTable().
CachedBooleanProperty has_usage_info_support_ = kBooleanUnset;
UsageTableHeader* usage_table_header_ = nullptr;
CachedBooleanProperty has_usage_table_support_ = kBooleanUnset;
CdmUsageTable* usage_table_ = nullptr;
// These fields are protected by |usage_table_mutex_| and not
// |static_field_mutex_|.
static std::unique_ptr<UsageTableHeader> usage_table_header_l1_;
static std::unique_ptr<UsageTableHeader> usage_table_header_l3_;
static std::unique_ptr<CdmUsageTable> usage_table_l1_;
static std::unique_ptr<CdmUsageTable> usage_table_l3_;
std::string request_id_;
static std::atomic<uint64_t> request_id_index_source_;