CDM workarounds for OEMCrypto issues

Merge of https://widevine-internal-review.googlesource.com/#/c/10614/
from the widevine cdm repo.

* b/15467844 - GenerateRSASignature returns OEMCrypto_ERROR_INVALID_CONTEXT
  when called with a non-NULL signature pointer and signature length of
  0 (rather than OEMCrypto_ERROR_SHORT_BUFFER)
* b/15989260 - OEMCrypto_DecryptCTR does not return OEMCrypto_ERROR_KEY_EXPIRED
  after keys have expired

Also addresses
* integration test updated to reflect that loading certificate errors are
  returned on OpenSession rather than GenerateKeyRequest
* compiler warning on type casting

b/15989261

Change-Id: Ib68b972651479e99b9d05de4493aac55a96c4f39
This commit is contained in:
Rahul Frias
2014-07-01 13:30:23 -07:00
parent 2c0b1d6142
commit 2ec3049bda
4 changed files with 27 additions and 19 deletions

View File

@@ -278,15 +278,25 @@ CdmResponseType CdmSession::Decrypt(const CdmDecryptionParameters& params) {
CdmResponseType status = crypto_session_->Decrypt(params);
if (NO_ERROR == status) {
if (is_initial_decryption_) {
policy_engine_.BeginDecryption();
is_initial_decryption_ = false;
}
if (!is_usage_update_needed_) {
is_usage_update_needed_ =
!license_parser_.provider_session_token().empty();
}
switch (status) {
case NO_ERROR:
if (is_initial_decryption_) {
policy_engine_.BeginDecryption();
is_initial_decryption_ = false;
}
if (!is_usage_update_needed_) {
is_usage_update_needed_ =
!license_parser_.provider_session_token().empty();
}
break;
case UNKNOWN_ERROR:
Clock clock;
int64_t current_time = clock.GetCurrentTime();
if (policy_engine_.IsLicenseDurationExpired(current_time) ||
policy_engine_.IsPlaybackDurationExpired(current_time)) {
return NEED_KEY;
}
break;
}
return status;