Add usage support query method
[ Merge of http://go/wvgerrit/23522 ] A helper method has been added to CryptoSession to determine whether the TEE supports usage tables, usage table headers+entries or does not provide any support for persistent licenses. In addition * CryptoSession now supports deletion of multiple usage entries rather than a single one. * Typedefs have been added for usage table headers and entries b/34327459 Test: Verified by unit/integration tests on angler. Change-Id: I634d3b7b81ce94d1deccd2a7aaf26b9efde414a8
This commit is contained in:
@@ -141,17 +141,19 @@ class CryptoSession {
|
||||
const std::string& signature);
|
||||
|
||||
// Usage table header and usage entry related methods
|
||||
virtual CdmResponseType GetUsageSupportType(CdmUsageSupportType* type);
|
||||
virtual CdmResponseType CreateUsageTableHeader(
|
||||
std::string* usage_table_header);
|
||||
CdmUsageTableHeader* usage_table_header);
|
||||
virtual CdmResponseType LoadUsageTableHeader(
|
||||
const std::string& usage_table_header);
|
||||
const CdmUsageTableHeader& usage_table_header);
|
||||
virtual CdmResponseType CreateUsageEntry(uint32_t* entry_number);
|
||||
virtual CdmResponseType LoadUsageEntry(uint32_t entry_number,
|
||||
const std::string& usage_entry);
|
||||
virtual CdmResponseType UpdateUsageEntry(std::string* usage_table_header,
|
||||
std::string* usage_entry);
|
||||
virtual CdmResponseType DecrementUsageTableHeaderSize(
|
||||
uint32_t current_usage_table_size, std::string* usage_table_header);
|
||||
const CdmUsageEntry& usage_entry);
|
||||
virtual CdmResponseType UpdateUsageEntry(
|
||||
CdmUsageTableHeader* usage_table_header,
|
||||
CdmUsageEntry* usage_entry);
|
||||
virtual CdmResponseType ShrinkUsageTableHeader(
|
||||
uint32_t new_entry_count, CdmUsageTableHeader* usage_table_header);
|
||||
virtual CdmResponseType MoveUsageEntry(uint32_t new_entry_number);
|
||||
virtual CdmResponseType CopyOldUsageEntry(
|
||||
const std::string& provider_session_token);
|
||||
@@ -212,6 +214,9 @@ class CryptoSession {
|
||||
|
||||
KeyId cached_key_id_;
|
||||
|
||||
bool is_usage_support_type_valid_;
|
||||
CdmUsageSupportType usage_support_type_;
|
||||
|
||||
uint64_t request_id_base_;
|
||||
static uint64_t request_id_index_;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class DeviceFiles {
|
||||
int64_t last_playback_time,
|
||||
int64_t grace_period_end_time,
|
||||
const CdmAppParameterMap& app_parameters,
|
||||
const std::string& usage_entry);
|
||||
const CdmUsageEntry& usage_entry);
|
||||
virtual bool RetrieveLicense(
|
||||
const std::string& key_set_id, LicenseState* state,
|
||||
CdmInitData* pssh_data, CdmKeyMessage* key_request,
|
||||
@@ -77,7 +77,7 @@ class DeviceFiles {
|
||||
CdmKeyResponse* key_renewal_response, std::string* release_server_url,
|
||||
int64_t* playback_start_time, int64_t* last_playback_time,
|
||||
int64_t* grace_period_end_time, CdmAppParameterMap* app_parameters,
|
||||
std::string* usage_entry);
|
||||
CdmUsageEntry* usage_entry);
|
||||
virtual bool DeleteLicense(const std::string& key_set_id);
|
||||
virtual bool ListLicenses(std::vector<std::string>* key_set_ids);
|
||||
virtual bool DeleteAllFiles();
|
||||
@@ -91,7 +91,7 @@ class DeviceFiles {
|
||||
const CdmKeyResponse& key_response,
|
||||
const std::string& app_id,
|
||||
const std::string& key_set_id,
|
||||
const std::string& usage_entry);
|
||||
const CdmUsageEntry& usage_entry);
|
||||
virtual bool DeleteUsageInfo(const std::string& app_id,
|
||||
const std::string& provider_session_token);
|
||||
// Delete usage information from the file system. Puts a list of all the
|
||||
@@ -110,14 +110,14 @@ class DeviceFiles {
|
||||
const std::string& provider_session_token,
|
||||
CdmKeyMessage* license_request,
|
||||
CdmKeyResponse* license_response,
|
||||
std::string* usage_entry);
|
||||
CdmUsageEntry* usage_entry);
|
||||
// Retrieve the usage info entry specified by |key_set_id|.
|
||||
// Returns false if the entry could not be found.
|
||||
virtual bool RetrieveUsageInfoByKeySetId(const std::string& app_id,
|
||||
const std::string& key_set_id,
|
||||
CdmKeyMessage* license_request,
|
||||
CdmKeyResponse* license_response,
|
||||
std::string* usage_entry);
|
||||
CdmUsageEntry* usage_entry);
|
||||
|
||||
virtual bool StoreHlsAttributes(const std::string& key_set_id,
|
||||
const CdmHlsMethod method,
|
||||
@@ -128,11 +128,11 @@ class DeviceFiles {
|
||||
virtual bool DeleteHlsAttributes(const std::string& key_set_id);
|
||||
|
||||
virtual bool StoreUsageTableInfo(
|
||||
const std::string& usage_table_header,
|
||||
const CdmUsageTableHeader& usage_table_header,
|
||||
const std::vector<UsageEntryInfo>& usage_entry_info);
|
||||
|
||||
virtual bool RetrieveUsageTableInfo(
|
||||
std::string* usage_table_header,
|
||||
CdmUsageTableHeader* usage_table_header,
|
||||
std::vector<UsageEntryInfo>* usage_entry_info);
|
||||
|
||||
private:
|
||||
|
||||
@@ -28,6 +28,8 @@ typedef std::vector<std::string> CdmUsageInfo;
|
||||
typedef std::string CdmUsageInfoReleaseMessage;
|
||||
typedef std::string CdmProvisioningRequest;
|
||||
typedef std::string CdmProvisioningResponse;
|
||||
typedef std::string CdmUsageTableHeader;
|
||||
typedef std::string CdmUsageEntry;
|
||||
|
||||
enum CdmKeyRequestType {
|
||||
kKeyRequestTypeUnknown,
|
||||
@@ -274,6 +276,9 @@ enum CdmResponseType {
|
||||
INVALID_PARAMETERS_ENG_22,
|
||||
STORE_LICENSE_ERROR_4, /* 235 */
|
||||
LIST_LICENSES_ERROR,
|
||||
INVALID_PARAMETERS_ENG_23,
|
||||
USAGE_INFORMATION_SUPPORT_FAILED,
|
||||
USAGE_SUPPORT_GET_API_FAILED,
|
||||
};
|
||||
|
||||
enum CdmKeyStatus {
|
||||
@@ -346,6 +351,19 @@ enum CdmClientTokenType {
|
||||
kClientTokenOemCert
|
||||
};
|
||||
|
||||
// kNonSecureUsageSupport - TEE does not provide any support for usage
|
||||
// information.
|
||||
// kUsageTableSupport - TEE persists usage information securely in a fixed
|
||||
// size table, commonly 50 entries. (OEMCrypto v9+)
|
||||
// kUsageEntrySupport - usage information (table headers and entries) are
|
||||
// persisted in non-secure storage but are loaded and unloaded from
|
||||
// the TEE during use (OEMCrypto v13+)
|
||||
enum CdmUsageSupportType {
|
||||
kNonSecureUsageSupport,
|
||||
kUsageTableSupport,
|
||||
kUsageEntrySupport,
|
||||
};
|
||||
|
||||
class CdmKeyAllowedUsage {
|
||||
public:
|
||||
CdmKeyAllowedUsage() {
|
||||
|
||||
Reference in New Issue
Block a user