Add ATSC support - part 2

[ Merge of http://go/wvgerrit/100905 and http://go/ag/10708438 ]

Add support for ATSC certificate and licenses handling. ATSC
files are distinguished from the apps DRM certificate and licenses
by file naming conventions.

Bug: 139730600
Test: WV unit/integration test, GtsMediaTestCases
Change-Id: I295f66f92fe01d7716978deac9dc360d74addedd
This commit is contained in:
Rahul Frias
2020-03-17 01:35:01 -07:00
parent bbe9f6afc4
commit 8da1145012
8 changed files with 143 additions and 110 deletions

View File

@@ -159,8 +159,12 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
// License server client ID token is a stored certificate. Stage it or
// indicate that provisioning is needed. Get token from stored certificate
std::string wrapped_key;
if (!file_handle_->RetrieveCertificate(&client_token, &wrapped_key,
&serial_number, nullptr)) {
bool atsc_mode_enabled = false;
if (cdm_client_property_set != nullptr)
atsc_mode_enabled = cdm_client_property_set->use_atsc_mode();
if (!file_handle_->RetrieveCertificate(atsc_mode_enabled, &client_token,
&wrapped_key, &serial_number,
nullptr)) {
return NEED_PROVISIONING;
}
CdmResponseType load_cert_sts;
@@ -186,7 +190,7 @@ CdmResponseType CdmSession::Init(CdmClientPropertySet* cdm_client_property_set,
if (forced_session_id) {
key_set_id_ = *forced_session_id;
} else {
bool ok = GenerateKeySetId(&key_set_id_);
bool ok = GenerateKeySetId(atsc_mode_enabled, &key_set_id_);
(void)ok; // ok is now used when assertions are turned off.
assert(ok);
}
@@ -849,7 +853,8 @@ CdmSessionId CdmSession::GenerateSessionId() {
return SESSION_ID_PREFIX + IntToString(++session_num);
}
bool CdmSession::GenerateKeySetId(CdmKeySetId* key_set_id) {
bool CdmSession::GenerateKeySetId(bool atsc_mode_enabled,
CdmKeySetId* key_set_id) {
RETURN_FALSE_IF_NULL(key_set_id);
std::vector<uint8_t> random_data(
@@ -861,7 +866,10 @@ bool CdmSession::GenerateKeySetId(CdmKeySetId* key_set_id) {
return false;
}
*key_set_id = KEY_SET_ID_PREFIX + b2a_hex(random_data);
if (atsc_mode_enabled)
*key_set_id = ATSC_KEY_SET_ID_PREFIX + b2a_hex(random_data);
else
*key_set_id = KEY_SET_ID_PREFIX + b2a_hex(random_data);
// key set collision
if (file_handle_->LicenseExists(*key_set_id)) {