Merges to android Pi release (part 7)
These are a set of CLs merged from the wv cdm repo to the android repo. * Resolve intermittent decrypt error. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/35720 ] The CdmSession's closed state was not properly initialized resulting in intermittent SESSION_NOT_FOUND_FOR_DECRYPT errors. In CdmEngine::Decrypt the session is looked up by the key id. A list of open sessions is acquired by calling CdmSessionMap::GetSessionList and each session in the list is queried to see if it has the key. In building the list in CdmSessionMap::GetSessionList, sessions are only added to the query list *if* the session is not closed. The closed status was not initialized and during testing the query list would not contain the session causing CdmEngine::Decrypt to return SESSION_NOT_FOUND_FOR_DECRYPT resulting in the ce cdm api returning widevine::Cdm::kNoKey. * No support for pre- C++11 compilation. Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/35381 ] * Handle unaligned nonce pointer in RewrapDeviceRSAKey calls. Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/35340 ] The pointer points into a message and it may not be aligned. Always copy the nonce into aligned memory before checking it. BUG: 38140370 Add note to CHANGELOG for this. * Compiler strictness: more checks and code cleanup. Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/35300 ] Use the switches proposed in b/38033653 (as much as possible - some conflicts with protobufs and gtest prevent fully accepting them). Switch to clang for x32 build; ensure that both x86-64 and x86-32 builds compile and link cleanly. BUG: 38032429 BUG: 38033653 This partially resolves b/38458986 * Android build fixes Author: Rahul Frias <rfrias@google.com> [ Merge of http://go/wvgerrit/35102 ] These corrections address compile warnings and errors for android and unit tests. * Embedded License: Add sub license key sessions. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/33680 ] NOTE: this adds the AddSubSession() method, but it is not yet being used. Use and proper cleanup is in an upcoming CL. * Embedded license: Add track label field. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/33660 ] A new track label field (a string) is added to the key container and the sub session data objects. This field will be used in handling sub license requests. * Embedded license: extract keys from init_data. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/33621 ] * Embedded license: add protobuf messages. Author: Jeff Fore <jfore@google.com> [ Merge of http://go/wvgerrit/33620 ] also sync the widevine header definition with recent naming changes. * Improve handling of provisioning response errors. Author: Gene Morgan <gmorgan@google.com> [ Merge of http://go/wvgerrit/33600 ] Separate out the case of no response and the case where the message is believed to be a JSON+base64 message but it doesn't parse properly. BUG: 71650075 Test: Not currently passing. Will be addressed in a subsequent commit in the chain. Change-Id: I3c86f1c54980b071aec7461ac58541836551f896
This commit is contained in:
@@ -28,6 +28,7 @@ CdmSession::CdmSession(FileSystem* file_system,
|
||||
metrics::SessionMetrics* metrics) :
|
||||
metrics_(metrics),
|
||||
initialized_(false),
|
||||
closed_(true),
|
||||
file_handle_(new DeviceFiles(file_system)),
|
||||
license_received_(false),
|
||||
is_offline_(false),
|
||||
@@ -193,6 +194,7 @@ CdmResponseType CdmSession::Init(
|
||||
license_received_ = false;
|
||||
is_initial_decryption_ = true;
|
||||
initialized_ = true;
|
||||
closed_ = false;
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -230,7 +232,8 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
std::string provider_session_token;
|
||||
if (usage_support_type_ == kUsageEntrySupport) {
|
||||
if (!license_parser_->ExtractProviderSessionToken(
|
||||
key_response_, &provider_session_token)) {
|
||||
key_response_, &provider_session_token) ||
|
||||
usage_table_header_ == nullptr) {
|
||||
provider_session_token.clear();
|
||||
} else {
|
||||
CdmResponseType sts =
|
||||
@@ -252,13 +255,14 @@ CdmResponseType CdmSession::RestoreOfflineSession(
|
||||
} else {
|
||||
if (!license_parser_->RestoreOfflineLicense(
|
||||
key_request_, key_response_, offline_key_renewal_response_,
|
||||
playback_start_time, last_playback_time, grace_period_end_time)) {
|
||||
playback_start_time, last_playback_time, grace_period_end_time,
|
||||
this)) {
|
||||
return RESTORE_OFFLINE_LICENSE_ERROR_2;
|
||||
}
|
||||
}
|
||||
|
||||
if (usage_support_type_ == kUsageEntrySupport &&
|
||||
!provider_session_token.empty()) {
|
||||
!provider_session_token.empty() && usage_table_header_ != nullptr) {
|
||||
CdmResponseType sts =
|
||||
usage_table_header_->UpdateEntry(crypto_session_.get(), &usage_entry_);
|
||||
if (sts != NO_ERROR) {
|
||||
@@ -290,9 +294,10 @@ CdmResponseType CdmSession::RestoreUsageSession(
|
||||
usage_entry_number_ = usage_data.usage_entry_number;
|
||||
usage_provider_session_token_ = usage_data.provider_session_token;
|
||||
|
||||
if (usage_support_type_ == kUsageEntrySupport) {
|
||||
if (usage_support_type_ == kUsageEntrySupport &&
|
||||
usage_table_header_ != nullptr) {
|
||||
CdmResponseType sts = usage_table_header_->LoadEntry(
|
||||
crypto_session_.get(), usage_entry_, usage_entry_number_);
|
||||
crypto_session_.get(), usage_entry_, usage_entry_number_);
|
||||
if (sts != NO_ERROR) {
|
||||
LOGE("CdmSession::RestoreUsageSession: failed to load usage entry = %d",
|
||||
sts);
|
||||
@@ -304,7 +309,8 @@ CdmResponseType CdmSession::RestoreUsageSession(
|
||||
return RELEASE_LICENSE_ERROR_2;
|
||||
}
|
||||
|
||||
if (usage_support_type_ == kUsageEntrySupport) {
|
||||
if (usage_support_type_ == kUsageEntrySupport &&
|
||||
usage_table_header_ != nullptr) {
|
||||
CdmResponseType sts =
|
||||
usage_table_header_->UpdateEntry(crypto_session_.get(), &usage_entry_);
|
||||
if (sts != NO_ERROR) {
|
||||
@@ -424,7 +430,8 @@ CdmResponseType CdmSession::AddKey(const CdmKeyResponse& key_response) {
|
||||
// to be created.
|
||||
CdmResponseType sts;
|
||||
std::string provider_session_token;
|
||||
if (usage_support_type_ == kUsageEntrySupport) {
|
||||
if (usage_support_type_ == kUsageEntrySupport &&
|
||||
usage_table_header_ != nullptr) {
|
||||
if (license_parser_->ExtractProviderSessionToken(
|
||||
key_response, &provider_session_token) &&
|
||||
!provider_session_token.empty()) {
|
||||
@@ -440,7 +447,8 @@ CdmResponseType CdmSession::AddKey(const CdmKeyResponse& key_response) {
|
||||
|
||||
// Update or delete entry if usage table header+entries are supported
|
||||
if (usage_support_type_ == kUsageEntrySupport &&
|
||||
!provider_session_token.empty()) {
|
||||
!provider_session_token.empty() &&
|
||||
usage_table_header_ != nullptr) {
|
||||
if (sts != KEY_ADDED) {
|
||||
CdmResponseType sts =
|
||||
usage_table_header_->DeleteEntry(usage_entry_number_,
|
||||
@@ -463,7 +471,8 @@ CdmResponseType CdmSession::AddKey(const CdmKeyResponse& key_response) {
|
||||
|
||||
if (is_offline_ || has_provider_session_token()) {
|
||||
if (has_provider_session_token() &&
|
||||
usage_support_type_ == kUsageEntrySupport) {
|
||||
usage_support_type_ == kUsageEntrySupport &&
|
||||
usage_table_header_ != nullptr) {
|
||||
usage_table_header_->UpdateEntry(crypto_session_.get(), &usage_entry_);
|
||||
}
|
||||
|
||||
@@ -671,8 +680,7 @@ CdmResponseType CdmSession::ReleaseKey(const CdmKeyResponse& key_response) {
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::DeleteUsageEntry(uint32_t usage_entry_number) {
|
||||
if (usage_support_type_ != kUsageEntrySupport ||
|
||||
!has_provider_session_token()) {
|
||||
if (usage_support_type_ != kUsageEntrySupport) {
|
||||
LOGE("CdmSession::DeleteUsageEntry: Unexpected usage type supported: %d",
|
||||
usage_support_type_);
|
||||
return INCORRECT_USAGE_SUPPORT_TYPE_1;
|
||||
@@ -881,7 +889,8 @@ CdmResponseType CdmSession::UpdateUsageTableInformation() {
|
||||
|
||||
CdmResponseType CdmSession::UpdateUsageEntryInformation() {
|
||||
if (usage_support_type_ != kUsageEntrySupport ||
|
||||
!has_provider_session_token()) {
|
||||
!has_provider_session_token() ||
|
||||
usage_table_header_ == nullptr) {
|
||||
LOGE("CdmSession::UpdateUsageEntryInformation: Unexpected usage type "
|
||||
"supported: %d", usage_support_type_);
|
||||
return INCORRECT_USAGE_SUPPORT_TYPE_2;
|
||||
|
||||
Reference in New Issue
Block a user