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:
@@ -27,7 +27,7 @@ namespace wvcdm {
|
||||
class CdmClientPropertySet;
|
||||
class ServiceCertificate;
|
||||
class WvCdmEventListener;
|
||||
class UsageTableHeader;
|
||||
class CdmUsageTable;
|
||||
|
||||
class CdmSession {
|
||||
public:
|
||||
@@ -129,7 +129,7 @@ class CdmSession {
|
||||
// ReleaseKey() - Accept response and release key.
|
||||
virtual CdmResponseType ReleaseKey(const CdmKeyResponse& key_response);
|
||||
|
||||
virtual CdmResponseType DeleteUsageEntry(uint32_t usage_entry_number);
|
||||
virtual CdmResponseType DeleteUsageEntry(UsageEntryIndex entry_index);
|
||||
|
||||
virtual bool IsKeyLoaded(const KeyId& key_id);
|
||||
virtual int64_t GetDurationRemaining();
|
||||
@@ -164,9 +164,7 @@ class CdmSession {
|
||||
license_parser_->provider_session_token().size() > 0);
|
||||
}
|
||||
|
||||
virtual bool supports_usage_info() const {
|
||||
return usage_table_header_ != nullptr;
|
||||
}
|
||||
virtual bool SupportsUsageTable() const { return usage_table_ != nullptr; }
|
||||
|
||||
// This method will remove keys by resetting crypto resources and
|
||||
// policy information. This renders the session mostly useless and it is
|
||||
@@ -307,11 +305,11 @@ class CdmSession {
|
||||
// Usage related flags and data
|
||||
bool is_initial_usage_update_;
|
||||
bool is_usage_update_needed_;
|
||||
// Only assign |usage_table_header_| if capable of supporting usage
|
||||
// Only assign |usage_table_| if capable of supporting usage
|
||||
// information.
|
||||
UsageTableHeader* usage_table_header_ = nullptr;
|
||||
uint32_t usage_entry_number_;
|
||||
CdmUsageEntry usage_entry_;
|
||||
CdmUsageTable* usage_table_ = nullptr;
|
||||
UsageEntryIndex usage_entry_index_;
|
||||
UsageEntry usage_entry_;
|
||||
std::string usage_provider_session_token_;
|
||||
|
||||
// information useful for offline and usage scenarios
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// source code may only be used and distributed under the Widevine License
|
||||
// Agreement.
|
||||
|
||||
#ifndef WVCDM_CORE_USAGE_TABLE_HEADER_H_
|
||||
#define WVCDM_CORE_USAGE_TABLE_HEADER_H_
|
||||
#ifndef WVCDM_CORE_CDM_USAGE_TABLE_H_
|
||||
#define WVCDM_CORE_CDM_USAGE_TABLE_H_
|
||||
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
@@ -46,12 +46,12 @@ namespace wvcdm {
|
||||
//
|
||||
// Upgrades from a fixed size usage table (supported by previous
|
||||
// versions of the OEMCrypto API v9-12) are handled by this class.
|
||||
// |usage_entry| and |usage_entry_number|s need to be saved in the license
|
||||
// |entry| and |entry_index|s need to be saved in the license
|
||||
// and usage info records by the caller.
|
||||
class UsageTableHeader {
|
||||
class CdmUsageTable {
|
||||
public:
|
||||
UsageTableHeader();
|
||||
virtual ~UsageTableHeader() {}
|
||||
CdmUsageTable();
|
||||
virtual ~CdmUsageTable() {}
|
||||
|
||||
// |crypto_session| is used to create or load a usage master table
|
||||
// and not cached beyound this call.
|
||||
@@ -65,36 +65,36 @@ class UsageTableHeader {
|
||||
|
||||
// Adds a new entry to the OEMCrypto usage table header, and associates
|
||||
// the entry with the provided |crypto_session|. The index of the new
|
||||
// usage entry will be returned by |usage_entry_number|.
|
||||
// usage entry will be returned by |entry_index|.
|
||||
//
|
||||
// Type of entry depends on the value of |persistent_license|:
|
||||
// false - usage info / secure stop record
|
||||
// true - offline license
|
||||
//
|
||||
// Threading: Method takes exclusive use of |usage_table_header_lock_|.
|
||||
// Threading: Method takes exclusive use of |lock_|.
|
||||
virtual CdmResponseType AddEntry(CryptoSession* crypto_session,
|
||||
bool persistent_license,
|
||||
const CdmKeySetId& key_set_id,
|
||||
const std::string& usage_info_filename,
|
||||
const CdmKeyResponse& license_message,
|
||||
uint32_t* usage_entry_number);
|
||||
// Threading: Method takes exclusive use of |usage_table_header_lock_|.
|
||||
UsageEntryIndex* entry_index);
|
||||
// Threading: Method takes exclusive use of |lock_|.
|
||||
virtual CdmResponseType LoadEntry(CryptoSession* crypto_session,
|
||||
const CdmUsageEntry& usage_entry,
|
||||
uint32_t usage_entry_number);
|
||||
// Threading: Method takes exclusive use of |usage_table_header_lock_|.
|
||||
virtual CdmResponseType UpdateEntry(uint32_t usage_entry_number,
|
||||
const UsageEntry& entry,
|
||||
UsageEntryIndex entry_index);
|
||||
// Threading: Method takes exclusive use of |lock_|.
|
||||
virtual CdmResponseType UpdateEntry(UsageEntryIndex entry_index,
|
||||
CryptoSession* crypto_session,
|
||||
CdmUsageEntry* usage_entry);
|
||||
UsageEntry* entry);
|
||||
|
||||
// The licenses or usage info records specified by |usage_entry_number|
|
||||
// The licenses or usage info records specified by |entry_index|
|
||||
// should not be in use by any open CryptoSession objects when calls
|
||||
// to InvalidateEntry and MoveEntry are made.
|
||||
// If |defrag_table| is true, the table will be defragmented after
|
||||
// the entry has been invalidated.
|
||||
//
|
||||
// Threading: Method takes exclusive use of |usage_table_header_lock_|.
|
||||
virtual CdmResponseType InvalidateEntry(uint32_t usage_entry_number,
|
||||
// Threading: Method takes exclusive use of |lock_|.
|
||||
virtual CdmResponseType InvalidateEntry(UsageEntryIndex entry_index,
|
||||
bool defrag_table,
|
||||
DeviceFiles* device_files,
|
||||
metrics::CryptoMetrics* metrics);
|
||||
@@ -107,13 +107,13 @@ class UsageTableHeader {
|
||||
// for the objects that InvalidateEntry depends on.
|
||||
//
|
||||
// Threading: Method requires care of caller for exclusive access.
|
||||
void InvalidateEntryForTest(uint32_t usage_entry_number);
|
||||
void InvalidateEntryForTest(UsageEntryIndex entry_index);
|
||||
|
||||
// == Table information methods ==
|
||||
// Threading: None of the following are thread safe. Intended for
|
||||
// testing or internal use.
|
||||
|
||||
size_t size() { return usage_entry_info_.size(); }
|
||||
size_t size() { return entry_info_list_.size(); }
|
||||
|
||||
size_t potential_table_capacity() const { return potential_table_capacity_; }
|
||||
|
||||
@@ -128,8 +128,8 @@ class UsageTableHeader {
|
||||
// are related to offline licenses.
|
||||
size_t OfflineEntryCount() const;
|
||||
|
||||
const std::vector<CdmUsageEntryInfo>& usage_entry_info() const {
|
||||
return usage_entry_info_;
|
||||
const std::vector<CdmUsageEntryInfo>& entry_info_list() const {
|
||||
return entry_info_list_;
|
||||
}
|
||||
|
||||
// Set the reference clock used for the method GetCurrentTime().
|
||||
@@ -141,10 +141,10 @@ class UsageTableHeader {
|
||||
}
|
||||
|
||||
static bool DetermineLicenseToRemoveForTesting(
|
||||
const std::vector<CdmUsageEntryInfo>& usage_entry_info_list,
|
||||
const std::vector<CdmUsageEntryInfo>& entry_info_list,
|
||||
int64_t current_time, size_t unexpired_threshold,
|
||||
uint32_t* entry_to_remove) {
|
||||
return DetermineLicenseToRemove(usage_entry_info_list, current_time,
|
||||
UsageEntryIndex* entry_to_remove) {
|
||||
return DetermineLicenseToRemove(entry_info_list, current_time,
|
||||
unexpired_threshold, entry_to_remove);
|
||||
}
|
||||
|
||||
@@ -155,13 +155,13 @@ class UsageTableHeader {
|
||||
|
||||
// Creates a new, empty usage table. Any existing usage table files
|
||||
// will be deleted.
|
||||
// Threading: Method takes exclusive use of |usage_table_header_lock_|
|
||||
// Threading: Method takes exclusive use of |lock_|
|
||||
// when required.
|
||||
bool CreateNewTable(CryptoSession* const crypto_session);
|
||||
// Attempts to restore the usage table from persistent storage, and
|
||||
// loads the usage table header into OEMCrypto.
|
||||
// Note: No other OEMCrypto session should be opened before calling.
|
||||
// Threading: Method takes exclusive use of |usage_table_header_lock_|
|
||||
// Threading: Method takes exclusive use of |lock_|
|
||||
// when required.
|
||||
bool RestoreTable(CryptoSession* const crypto_session);
|
||||
|
||||
@@ -173,76 +173,73 @@ class UsageTableHeader {
|
||||
// one more entry if the table is at or near the reported capacity.
|
||||
// If this check fails, a new usage table SHOULD be created.
|
||||
// Threading: Method requires caller to take exclusive use of
|
||||
// |usage_table_header_lock_|.
|
||||
// |lock_|.
|
||||
bool CapacityCheck(CryptoSession* const crypto_session);
|
||||
|
||||
// Attempts to determine the capacity of the OEMCrypto usage table.
|
||||
// Sets the result to |potential_table_capacity_|.
|
||||
// Threading: Method requires caller to take exclusive use of
|
||||
// |usage_table_header_lock_|.
|
||||
// |lock_|.
|
||||
bool DetermineTableCapacity(CryptoSession* crypto_session);
|
||||
|
||||
// == Table operation methods ==
|
||||
// Threading: All of the following methods require caller to take
|
||||
// exclusive use of |usage_table_header_lock_|.
|
||||
// exclusive use of |lock_|.
|
||||
|
||||
// Creates a new entry for the provided crypto session. If the
|
||||
// entry is created successfully in OEMCrypto, then a new entry
|
||||
// info is added to the table's vector of entry info.
|
||||
CdmResponseType CreateEntry(CryptoSession* const crypto_session,
|
||||
uint32_t* usage_entry_number);
|
||||
UsageEntryIndex* entry_index);
|
||||
|
||||
// Attempts to relocate a newly created usage entry associated with
|
||||
// the provided |crypto_session| to the lowest unoccupied position in
|
||||
// the table.
|
||||
// |usage_entry_number| is treated as both an input and output.
|
||||
// |entry_index| is treated as both an input and output.
|
||||
// Returns NO_ERROR so long as no internal operation fails,
|
||||
// regardless of whether the entry was moved or not.
|
||||
CdmResponseType RelocateNewEntry(CryptoSession* const crypto_session,
|
||||
uint32_t* usage_entry_number);
|
||||
UsageEntryIndex* entry_index);
|
||||
|
||||
// Checks if the specified |usage_entry_number| is known to be
|
||||
// Checks if the specified |entry_index| is known to be
|
||||
// unoccupied (released).
|
||||
bool IsEntryUnoccupied(const uint32_t usage_entry_number) const;
|
||||
bool IsEntryUnoccupied(const UsageEntryIndex entry_index) const;
|
||||
|
||||
// SetOfflineEntryInfo() and SetUsageInfoEntryInfo() populate the
|
||||
// entry meta-data with the required information based on the type
|
||||
// of entry.
|
||||
void SetOfflineEntryInfo(const uint32_t usage_entry_number,
|
||||
void SetOfflineEntryInfo(const UsageEntryIndex entry_index,
|
||||
const std::string& key_set_id,
|
||||
const CdmKeyResponse& license_message);
|
||||
void SetUsageInfoEntryInfo(const uint32_t usage_entry_number,
|
||||
void SetUsageInfoEntryInfo(const UsageEntryIndex entry_index,
|
||||
const std::string& key_set_id,
|
||||
const std::string& usage_info_file_name);
|
||||
|
||||
// Shrinks the table, removing all trailing unoccupied entries.
|
||||
// |usage_entry_info_| will be resized appropriately.
|
||||
// |entry_info_list_| will be resized appropriately.
|
||||
// Caller must store the table after a successful call.
|
||||
CdmResponseType RefitTable(CryptoSession* const crypto_session);
|
||||
|
||||
virtual CdmResponseType InvalidateEntryInternal(
|
||||
uint32_t usage_entry_number, bool defrag_table, DeviceFiles* device_files,
|
||||
UsageEntryIndex entry_index, bool defrag_table, DeviceFiles* device_files,
|
||||
metrics::CryptoMetrics* metrics);
|
||||
|
||||
CdmResponseType MoveEntry(uint32_t from /* usage entry number */,
|
||||
const CdmUsageEntry& from_usage_entry,
|
||||
uint32_t to /* usage entry number */,
|
||||
DeviceFiles* device_files,
|
||||
CdmResponseType MoveEntry(UsageEntryIndex from, const UsageEntry& from_entry,
|
||||
UsageEntryIndex to, DeviceFiles* device_files,
|
||||
metrics::CryptoMetrics* metrics);
|
||||
|
||||
CdmResponseType GetEntry(uint32_t usage_entry_number,
|
||||
DeviceFiles* device_files,
|
||||
CdmUsageEntry* usage_entry);
|
||||
CdmResponseType StoreEntry(uint32_t usage_entry_number,
|
||||
CdmResponseType GetEntry(UsageEntryIndex entry_index,
|
||||
DeviceFiles* device_files, UsageEntry* entry);
|
||||
CdmResponseType StoreEntry(UsageEntryIndex entry_index,
|
||||
DeviceFiles* device_files,
|
||||
const CdmUsageEntry& usage_entry);
|
||||
const UsageEntry& entry);
|
||||
|
||||
// Stores the usage table and it's info. This will increment
|
||||
// |store_table_counter_| if successful.
|
||||
bool StoreTable();
|
||||
|
||||
CdmResponseType Shrink(metrics::CryptoMetrics* metrics,
|
||||
uint32_t number_of_usage_entries_to_delete);
|
||||
uint32_t number_of_entries_to_delete);
|
||||
|
||||
// Must lock table before calling.
|
||||
CdmResponseType DefragTable(DeviceFiles* device_files,
|
||||
@@ -286,7 +283,7 @@ class UsageTableHeader {
|
||||
// types.
|
||||
//
|
||||
// Parameters:
|
||||
// [in] usage_entry_info_list: The complete list of known usage
|
||||
// [in] entry_info_list: The complete list of known usage
|
||||
// entries.
|
||||
// [in] current_time: The current time to compare expiration times
|
||||
// against.
|
||||
@@ -301,20 +298,20 @@ class UsageTableHeader {
|
||||
// |true| if an entry has been determined to be removed.
|
||||
// Otherwise returns |false|.
|
||||
static bool DetermineLicenseToRemove(
|
||||
const std::vector<CdmUsageEntryInfo>& usage_entry_info_list,
|
||||
const std::vector<CdmUsageEntryInfo>& entry_info_list,
|
||||
int64_t current_time, size_t unexpired_threshold,
|
||||
uint32_t* entry_to_remove);
|
||||
UsageEntryIndex* entry_to_remove);
|
||||
|
||||
// This handle and file system is only to be used when accessing
|
||||
// usage_table_header. Usage entries should use the file system provided
|
||||
// header. Usage entries should use the file system provided
|
||||
// by CdmSession.
|
||||
std::unique_ptr<DeviceFiles> device_files_;
|
||||
std::unique_ptr<wvutil::FileSystem> file_system_;
|
||||
CdmSecurityLevel security_level_ = kSecurityLevelUninitialized;
|
||||
RequestedSecurityLevel requested_security_level_ = kLevelDefault;
|
||||
|
||||
CdmUsageTableHeader usage_table_header_;
|
||||
std::vector<CdmUsageEntryInfo> usage_entry_info_;
|
||||
UsageTableHeader header_;
|
||||
std::vector<CdmUsageEntryInfo> entry_info_list_;
|
||||
|
||||
// Table is sync with persistent storage and can be used by the CDM
|
||||
// to interact with OEMCrypto.
|
||||
@@ -322,7 +319,7 @@ class UsageTableHeader {
|
||||
|
||||
// Synchonizes access to the Usage Table Header and bookkeeping
|
||||
// data-structures
|
||||
mutable std::mutex usage_table_header_lock_;
|
||||
mutable std::mutex lock_;
|
||||
|
||||
metrics::CryptoMetrics alternate_crypto_metrics_;
|
||||
|
||||
@@ -347,12 +344,12 @@ class UsageTableHeader {
|
||||
|
||||
#if defined(UNIT_TEST)
|
||||
// Test related declarations
|
||||
friend class UsageTableHeaderTest;
|
||||
friend class CdmUsageTableTest;
|
||||
|
||||
FRIEND_TEST(UsageTableHeaderTest, Shrink_NoneOfTable);
|
||||
FRIEND_TEST(UsageTableHeaderTest, Shrink_PartOfTable);
|
||||
FRIEND_TEST(UsageTableHeaderTest, Shrink_AllOfTable);
|
||||
FRIEND_TEST(UsageTableHeaderTest, Shrink_MoreThanTable);
|
||||
FRIEND_TEST(CdmUsageTableTest, Shrink_NoneOfTable);
|
||||
FRIEND_TEST(CdmUsageTableTest, Shrink_PartOfTable);
|
||||
FRIEND_TEST(CdmUsageTableTest, Shrink_AllOfTable);
|
||||
FRIEND_TEST(CdmUsageTableTest, Shrink_MoreThanTable);
|
||||
#endif
|
||||
|
||||
// These setters are for testing only. Takes ownership of the pointers.
|
||||
@@ -366,9 +363,9 @@ class UsageTableHeader {
|
||||
// Test related data members
|
||||
std::unique_ptr<CryptoSession> test_crypto_session_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(UsageTableHeader);
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(CdmUsageTable);
|
||||
};
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_USAGE_TABLE_HEADER_H_
|
||||
#endif // WVCDM_CORE_CDM_USAGE_TABLE_H_
|
||||
@@ -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_;
|
||||
|
||||
@@ -97,8 +97,8 @@ class DeviceFiles {
|
||||
// App parameters.
|
||||
CdmAppParameterMap app_parameters;
|
||||
// Usage entry and index.
|
||||
CdmUsageEntry usage_entry;
|
||||
uint32_t usage_entry_number;
|
||||
UsageEntry usage_entry;
|
||||
UsageEntryIndex usage_entry_index;
|
||||
std::string drm_certificate;
|
||||
CryptoWrappedKey wrapped_private_key;
|
||||
};
|
||||
@@ -108,8 +108,8 @@ class DeviceFiles {
|
||||
CdmKeyMessage license_request;
|
||||
CdmKeyResponse license;
|
||||
std::string key_set_id;
|
||||
CdmUsageEntry usage_entry;
|
||||
uint32_t usage_entry_number;
|
||||
UsageEntry usage_entry;
|
||||
UsageEntryIndex usage_entry_index;
|
||||
std::string drm_certificate;
|
||||
CryptoWrappedKey wrapped_private_key;
|
||||
};
|
||||
@@ -180,7 +180,7 @@ class DeviceFiles {
|
||||
const std::string& provider_session_token,
|
||||
const CdmKeyMessage& key_request, const CdmKeyResponse& key_response,
|
||||
const std::string& usage_info_file_name, const std::string& key_set_id,
|
||||
const CdmUsageEntry& usage_entry, uint32_t usage_entry_number,
|
||||
const UsageEntry& usage_entry, UsageEntryIndex usage_entry_index,
|
||||
const std::string& drm_certificate, const CryptoWrappedKey& wrapped_key);
|
||||
|
||||
// Retrieve usage identifying information stored on the file system.
|
||||
@@ -233,8 +233,8 @@ class DeviceFiles {
|
||||
const std::string& provider_session_token,
|
||||
CdmKeyMessage* license_request,
|
||||
CdmKeyResponse* license_response,
|
||||
CdmUsageEntry* usage_entry,
|
||||
uint32_t* usage_entry_number,
|
||||
UsageEntry* usage_entry,
|
||||
UsageEntryIndex* usage_entry_index,
|
||||
std::string* drm_certificate,
|
||||
CryptoWrappedKey* wrapped_key);
|
||||
// Retrieve the usage info entry specified by |key_set_id|.
|
||||
@@ -242,8 +242,8 @@ class DeviceFiles {
|
||||
virtual bool RetrieveUsageInfoByKeySetId(
|
||||
const std::string& usage_info_file_name, const std::string& key_set_id,
|
||||
std::string* provider_session_token, CdmKeyMessage* license_request,
|
||||
CdmKeyResponse* license_response, CdmUsageEntry* usage_entry,
|
||||
uint32_t* usage_entry_number, std::string* drm_certificate,
|
||||
CdmKeyResponse* license_response, UsageEntry* usage_entry,
|
||||
UsageEntryIndex* usage_entry_index, std::string* drm_certificate,
|
||||
CryptoWrappedKey* wrapped_key);
|
||||
|
||||
// These APIs support upgrading from usage tables to usage tabler header +
|
||||
@@ -271,15 +271,15 @@ class DeviceFiles {
|
||||
virtual bool DeleteHlsAttributes(const std::string& key_set_id);
|
||||
|
||||
virtual bool StoreUsageTableInfo(
|
||||
const CdmUsageTableHeader& usage_table_header,
|
||||
const std::vector<CdmUsageEntryInfo>& usage_entry_info);
|
||||
const UsageTableHeader& usage_table_header,
|
||||
const std::vector<CdmUsageEntryInfo>& usage_entry_info_list);
|
||||
|
||||
// When retrieving usage table information from the file system; any
|
||||
// table that has yet to be updated for the LRU attributes will be
|
||||
// indicated by |lru_upgrade|.
|
||||
virtual bool RetrieveUsageTableInfo(
|
||||
CdmUsageTableHeader* usage_table_header,
|
||||
std::vector<CdmUsageEntryInfo>* usage_entry_info, bool* lru_upgrade);
|
||||
UsageTableHeader* usage_table_header,
|
||||
std::vector<CdmUsageEntryInfo>* usage_entry_info_list, bool* lru_upgrade);
|
||||
|
||||
virtual bool DeleteUsageTableInfo();
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@ using CdmSecureStopId = std::string;
|
||||
using CdmSessionId = std::string;
|
||||
using CdmKeySetId = std::string;
|
||||
using RequestId = std::string;
|
||||
using CryptoResult = uint32_t;
|
||||
using CryptoSessionId = uint32_t;
|
||||
using EntitledKeySessionId = uint32_t;
|
||||
using CdmAppParameterMap = std::map<std::string, std::string>;
|
||||
@@ -34,8 +33,11 @@ using CdmUsageInfo = std::vector<std::string>;
|
||||
using CdmUsageInfoReleaseMessage = std::string;
|
||||
using CdmProvisioningRequest = std::string;
|
||||
using CdmProvisioningResponse = std::string;
|
||||
using CdmUsageTableHeader = std::string;
|
||||
using CdmUsageEntry = std::string;
|
||||
|
||||
// OEMCrypto's usage table information.
|
||||
using UsageTableHeader = std::string;
|
||||
using UsageEntry = std::string;
|
||||
using UsageEntryIndex = uint32_t;
|
||||
|
||||
enum CdmKeyRequestType : uint32_t {
|
||||
kKeyRequestTypeUnknown,
|
||||
|
||||
Reference in New Issue
Block a user