Merge changes I295f66f9,I142f286c into rvc-dev am: 05fbb3dd87 am: 0db9b974c2 am: 1c6633d408 am: 7b0fe07c8a
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/11620164 Change-Id: If47d215914fbb11d2d33cd01b635d4fe16112957
This commit is contained in:
@@ -62,6 +62,7 @@ class UsagePropertySet : public CdmClientPropertySet {
|
||||
void set_session_sharing_id(uint32_t /* id */) override {}
|
||||
const std::string& app_id() const override { return app_id_; }
|
||||
void set_app_id(const std::string& appId) { app_id_ = appId; }
|
||||
bool use_atsc_mode() const override { return false; }
|
||||
|
||||
private:
|
||||
std::string app_id_;
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -71,6 +71,7 @@ using video_widevine_client::sdk::
|
||||
|
||||
namespace {
|
||||
|
||||
const char kAtscCertificateFileName[] = "atsccert.bin";
|
||||
const char kCertificateFileName[] = "cert.bin";
|
||||
const char kHlsAttributesFileNameExt[] = ".hal";
|
||||
const char kUsageInfoFileNamePrefix[] = "usage";
|
||||
@@ -127,19 +128,21 @@ bool DeviceFiles::StoreCertificate(const std::string& certificate,
|
||||
std::string serialized_file;
|
||||
file.SerializeToString(&serialized_file);
|
||||
|
||||
return StoreFileWithHash(GetCertificateFileName(), serialized_file) ==
|
||||
return StoreFileWithHash(GetCertificateFileName(false), serialized_file) ==
|
||||
kNoError;
|
||||
}
|
||||
|
||||
bool DeviceFiles::RetrieveCertificate(std::string* certificate,
|
||||
bool DeviceFiles::RetrieveCertificate(bool atsc_mode_enabled,
|
||||
std::string* certificate,
|
||||
std::string* wrapped_private_key,
|
||||
std::string* serial_number,
|
||||
uint32_t* system_id) {
|
||||
RETURN_FALSE_IF_UNINITIALIZED();
|
||||
|
||||
video_widevine_client::sdk::File file;
|
||||
if (RetrieveHashedFile(GetCertificateFileName(), &file) != kNoError) {
|
||||
LOGE("Unable to retrieve certificate file");
|
||||
if (RetrieveHashedFile(GetCertificateFileName(atsc_mode_enabled), &file) !=
|
||||
kNoError) {
|
||||
LOGW("Unable to retrieve certificate file");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -167,14 +170,16 @@ bool DeviceFiles::RetrieveCertificate(std::string* certificate,
|
||||
device_certificate.certificate(), serial_number, system_id);
|
||||
}
|
||||
|
||||
bool DeviceFiles::HasCertificate() {
|
||||
bool DeviceFiles::HasCertificate(bool atsc_mode_enabled) {
|
||||
RETURN_FALSE_IF_UNINITIALIZED();
|
||||
return FileExists(GetCertificateFileName());
|
||||
|
||||
return FileExists(GetCertificateFileName(atsc_mode_enabled));
|
||||
}
|
||||
|
||||
bool DeviceFiles::RemoveCertificate() {
|
||||
RETURN_FALSE_IF_UNINITIALIZED()
|
||||
return RemoveFile(GetCertificateFileName());
|
||||
|
||||
return RemoveFile(GetCertificateFileName(false));
|
||||
}
|
||||
|
||||
bool DeviceFiles::StoreLicense(const CdmLicenseData& license_data,
|
||||
@@ -1215,8 +1220,8 @@ ssize_t DeviceFiles::GetFileSize(const std::string& name) {
|
||||
return file_system_->FileSize(path);
|
||||
}
|
||||
|
||||
std::string DeviceFiles::GetCertificateFileName() {
|
||||
return kCertificateFileName;
|
||||
std::string DeviceFiles::GetCertificateFileName(bool atsc_mode_enabled) {
|
||||
return atsc_mode_enabled ? kAtscCertificateFileName : kCertificateFileName;
|
||||
}
|
||||
|
||||
std::string DeviceFiles::GetUsageTableFileName() { return kUsageTableFileName; }
|
||||
|
||||
Reference in New Issue
Block a user