Add Property for Provisioning ID
Adds a property that allows applications to get the provisioning-unique serial number. Bug: 9175567 Also fixes some missing mutexes that were causing intermittent failures in calls to OEMCrypto due to concurrency issues. Bug: 9175583 Merge of https://widevine-internal-review.googlesource.com/#/c/5831/ from the Widevine CDM repository Change-Id: I1d7e3ca9f3b06da345022f5f0d64e0c17a5cedca
This commit is contained in:
@@ -403,6 +403,12 @@ CdmResponseType CdmEngine::QueryStatus(CdmQueryMap* key_info) {
|
||||
(*key_info)[QUERY_KEY_SYSTEM_ID] = system_id_stream.str();
|
||||
}
|
||||
|
||||
std::string provisioning_id;
|
||||
success = crypto_engine->GetProvisioningId(&provisioning_id);
|
||||
if (success) {
|
||||
(*key_info)[QUERY_KEY_PROVISIONING_ID] = provisioning_id;
|
||||
}
|
||||
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@@ -168,13 +168,13 @@ bool CryptoEngine::GetToken(std::string* token) {
|
||||
LOGE("CryptoEngine::GetToken : No token passed to method.");
|
||||
return false;
|
||||
}
|
||||
uint8_t buf[72];
|
||||
size_t buflen = 72;
|
||||
OEMCryptoResult sts = OEMCrypto_GetKeyData(buf, &buflen);
|
||||
uint8_t buf[KEYBOX_KEY_DATA_SIZE];
|
||||
size_t bufSize = sizeof(buf);
|
||||
OEMCryptoResult sts = OEMCrypto_GetKeyData(buf, &bufSize);
|
||||
if (OEMCrypto_SUCCESS != sts) {
|
||||
return false;
|
||||
}
|
||||
token->assign((const char*)buf, (size_t)buflen);
|
||||
token->assign((const char*)buf, bufSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -182,6 +182,9 @@ CryptoEngine::SecurityLevel CryptoEngine::GetSecurityLevel() {
|
||||
if (!Init())
|
||||
return kSecurityLevelUnknown;
|
||||
|
||||
LOGV("CryptoEngine::GetSecurityLevel: Lock");
|
||||
AutoLock auto_lock(crypto_lock_);
|
||||
|
||||
std::string security_level = OEMCrypto_SecurityLevel();
|
||||
|
||||
if ((security_level.size() != 2) ||
|
||||
@@ -203,6 +206,14 @@ bool CryptoEngine::GetDeviceUniqueId(std::string* deviceId) {
|
||||
if (!Init())
|
||||
return false;
|
||||
|
||||
if (!deviceId) {
|
||||
LOGE("CryptoEngine::GetDeviceUniqueId : No buffer passed to method.");
|
||||
return false;
|
||||
}
|
||||
|
||||
LOGV("CryptoEngine::GetDeviceUniqueId: Lock");
|
||||
AutoLock auto_lock(crypto_lock_);
|
||||
|
||||
std::vector<uint8_t> id;
|
||||
size_t idLength = 32;
|
||||
|
||||
@@ -222,10 +233,18 @@ bool CryptoEngine::GetSystemId(uint32_t* systemId) {
|
||||
if (!Init())
|
||||
return false;
|
||||
|
||||
uint8_t buf[72];
|
||||
size_t buflen = 72;
|
||||
if (!systemId) {
|
||||
LOGE("CryptoEngine::GetSystemId : No buffer passed to method.");
|
||||
return false;
|
||||
}
|
||||
|
||||
OEMCryptoResult sts = OEMCrypto_GetKeyData(buf, &buflen);
|
||||
LOGV("CryptoEngine::GetSystemId: Lock");
|
||||
AutoLock auto_lock(crypto_lock_);
|
||||
|
||||
uint8_t buf[KEYBOX_KEY_DATA_SIZE];
|
||||
size_t bufSize = sizeof(buf);
|
||||
|
||||
OEMCryptoResult sts = OEMCrypto_GetKeyData(buf, &bufSize);
|
||||
|
||||
if (OEMCrypto_SUCCESS != sts) {
|
||||
return false;
|
||||
@@ -239,4 +258,29 @@ bool CryptoEngine::GetSystemId(uint32_t* systemId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CryptoEngine::GetProvisioningId(std::string* provisioningId) {
|
||||
if (!Init())
|
||||
return false;
|
||||
|
||||
if (!provisioningId) {
|
||||
LOGE("CryptoEngine::GetProvisioningId : No buffer passed to method.");
|
||||
return false;
|
||||
}
|
||||
|
||||
LOGV("CryptoEngine::GetProvisioningId: Lock");
|
||||
AutoLock auto_lock(crypto_lock_);
|
||||
|
||||
uint8_t buf[KEYBOX_KEY_DATA_SIZE];
|
||||
size_t bufSize = sizeof(buf);
|
||||
|
||||
OEMCryptoResult sts = OEMCrypto_GetKeyData(buf, &bufSize);
|
||||
|
||||
if (OEMCrypto_SUCCESS != sts) {
|
||||
return false;
|
||||
}
|
||||
|
||||
provisioningId->assign(reinterpret_cast<char*>(&buf[8]), 16);
|
||||
return true;
|
||||
}
|
||||
|
||||
}; // namespace wvcdm
|
||||
|
||||
Reference in New Issue
Block a user