Clean merge of Client ID code

This CL cleans up some bad merges of client ID code, entitlement keys,
and concurrent session access. After this CL, core cdm code on
android should match that on widevine at the commit 2f916720 on branch
master.

CLs merged here are based on:
http://go/wvgerrit/50483 Protect sessions from concurrent access
http://go/wvgerrit/48860 Remove duplicate information from client identification
http://go/wvgerrit/49040 Revert revertion of Client ID Expansion
http://go/wvgerrit/46448 Test Entitlement Licenses

Test: tested as part of http://go/ag/4674759

Change-Id: I45854d6b034c247b16073a96d6ff3ea953ded3ae
This commit is contained in:
Fred Gylys-Colwell
2018-07-01 21:18:33 -07:00
parent bbb89c2d7f
commit 72e260da48
4 changed files with 34 additions and 78 deletions

View File

@@ -875,9 +875,22 @@ CdmResponseType CryptoSession::LoadKeys(
CdmResponseType CryptoSession::LoadEntitledContentKeys(
const std::vector<CryptoKey>& key_array) {
// TODO(jfore): Handle and return errors.
/*OEMCryptoResult status =*/ key_session_->LoadEntitledContentKeys(key_array);
return KEY_ADDED;
LOGV("CryptoSession::LoadEntitledContentKeys: Lock");
AutoLock auto_lock(crypto_lock_);
OEMCryptoResult sts = key_session_->LoadEntitledContentKeys(key_array);
if (OEMCrypto_SUCCESS == sts) {
return KEY_ADDED;
} else if (OEMCrypto_ERROR_INSUFFICIENT_RESOURCES == sts) {
return INSUFFICIENT_CRYPTO_RESOURCES_6;
} else if (OEMCrypto_ERROR_INVALID_CONTEXT == sts) {
return NOT_AN_ENTITLEMENT_SESSION;
} else if (OEMCrypto_KEY_NOT_ENTITLED == sts) {
return NO_MATCHING_ENTITLEMENT_KEY;
} else {
return LOAD_ENTITLED_CONTENT_KEYS_ERROR;
}
}
bool CryptoSession::LoadCertificatePrivateKey(std::string& wrapped_key) {