Source release 15.1.0
This commit is contained in:
@@ -227,8 +227,7 @@ void CryptoSession::Init() {
|
||||
sts = OEMCrypto_SetSandbox(
|
||||
reinterpret_cast<const uint8_t*>(sandbox_id.c_str()),
|
||||
sandbox_id.length());
|
||||
// TODO(blueeyes): it might be worth saving the sandbox id in a
|
||||
// metric.
|
||||
metrics_->oemcrypto_set_sandbox_.Record(sandbox_id);
|
||||
}
|
||||
M_TIME(sts = OEMCrypto_Initialize(), metrics_, oemcrypto_initialize_,
|
||||
sts);
|
||||
@@ -736,6 +735,7 @@ CdmResponseType CryptoSession::Open(SecurityLevel requested_security_level) {
|
||||
}
|
||||
}
|
||||
usage_table_header_ = *header;
|
||||
metrics_->usage_table_header_initial_size_.Record((*header)->size());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1499,11 +1499,7 @@ CdmResponseType CryptoSession::GenerateNonce(uint32_t* nonce) {
|
||||
|
||||
bool CryptoSession::SetDestinationBufferType() {
|
||||
if (Properties::oem_crypto_use_secure_buffers()) {
|
||||
if (GetSecurityLevel() == kSecurityLevelL1) {
|
||||
destination_buffer_type_ = OEMCrypto_BufferType_Secure;
|
||||
} else {
|
||||
destination_buffer_type_ = OEMCrypto_BufferType_Clear;
|
||||
}
|
||||
destination_buffer_type_ = OEMCrypto_BufferType_Secure;
|
||||
} else if (Properties::oem_crypto_use_fifo()) {
|
||||
destination_buffer_type_ = OEMCrypto_BufferType_Direct;
|
||||
} else if (Properties::oem_crypto_use_userspace_buffers()) {
|
||||
@@ -1812,6 +1808,14 @@ CdmResponseType CryptoSession::GetSrmVersion(uint16_t* srm_version) {
|
||||
status = OEMCrypto_GetCurrentSRMVersion(srm_version);
|
||||
});
|
||||
|
||||
// SRM is an optional feature. Whether it is implemented is up to the
|
||||
// discretion of OEMs
|
||||
if (status == OEMCrypto_ERROR_NOT_IMPLEMENTED) {
|
||||
LOGV("CryptoSession::GetSrmVersion: OEMCrypto_GetCurrentSRMVersion not "
|
||||
"implemented");
|
||||
return NOT_IMPLEMENTED_ERROR;
|
||||
}
|
||||
|
||||
return MapOEMCryptoResult(
|
||||
status, GET_SRM_VERSION_ERROR, "GetCurrentSRMVersion");
|
||||
}
|
||||
@@ -1863,6 +1867,7 @@ bool CryptoSession::GetResourceRatingTier(SecurityLevel security_level,
|
||||
}
|
||||
WithOecReadLock("GetResourceRatingTier", [&] {
|
||||
*tier = OEMCrypto_ResourceRatingTier(security_level);
|
||||
metrics_->oemcrypto_resource_rating_tier_.Record(*tier);
|
||||
});
|
||||
if (*tier < RESOURCE_RATING_TIER_LOW || *tier > RESOURCE_RATING_TIER_HIGH) {
|
||||
uint32_t api_version;
|
||||
@@ -1933,6 +1938,7 @@ CdmResponseType CryptoSession::SetDecryptHash(
|
||||
sts = OEMCrypto_SetDecryptHash(
|
||||
oec_session_id_, frame_number,
|
||||
reinterpret_cast<const uint8_t*>(hash.data()), hash.size());
|
||||
metrics_->oemcrypto_set_decrypt_hash_.Increment(sts);
|
||||
});
|
||||
|
||||
return MapOEMCryptoResult(sts, SET_DECRYPT_HASH_ERROR, "SetDecryptHash");
|
||||
@@ -1946,7 +1952,7 @@ CdmResponseType CryptoSession::GetDecryptHashError(std::string* error_string) {
|
||||
}
|
||||
error_string->clear();
|
||||
|
||||
uint32_t failed_frame_number;
|
||||
uint32_t failed_frame_number = 0;
|
||||
OEMCryptoResult sts;
|
||||
WithOecSessionLock("GetDecryptHashError", [&] {
|
||||
sts = OEMCrypto_GetHashErrorCode(oec_session_id_, &failed_frame_number);
|
||||
@@ -2274,6 +2280,7 @@ CdmResponseType CryptoSession::CreateUsageTableHeader(
|
||||
reinterpret_cast<uint8_t*>(
|
||||
const_cast<char*>(usage_table_header->data())),
|
||||
&usage_table_header_size);
|
||||
metrics_->oemcrypto_create_usage_table_header_.Increment(result);
|
||||
});
|
||||
|
||||
if (result == OEMCrypto_ERROR_SHORT_BUFFER) {
|
||||
@@ -2284,6 +2291,7 @@ CdmResponseType CryptoSession::CreateUsageTableHeader(
|
||||
reinterpret_cast<uint8_t*>(
|
||||
const_cast<char*>(usage_table_header->data())),
|
||||
&usage_table_header_size);
|
||||
metrics_->oemcrypto_create_usage_table_header_.Increment(result);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2305,6 +2313,7 @@ CdmResponseType CryptoSession::LoadUsageTableHeader(
|
||||
requested_security_level_,
|
||||
reinterpret_cast<const uint8_t*>(usage_table_header.data()),
|
||||
usage_table_header.size());
|
||||
metrics_->oemcrypto_load_usage_table_header_.Increment(result);
|
||||
});
|
||||
|
||||
if (result != OEMCrypto_SUCCESS) {
|
||||
@@ -2347,6 +2356,7 @@ CdmResponseType CryptoSession::CreateUsageEntry(uint32_t* entry_number) {
|
||||
OEMCryptoResult result;
|
||||
WithOecWriteLock("CreateUsageEntry", [&] {
|
||||
result = OEMCrypto_CreateNewUsageEntry(oec_session_id_, entry_number);
|
||||
metrics_->oemcrypto_create_new_usage_entry_.Increment(result);
|
||||
});
|
||||
|
||||
if (result != OEMCrypto_SUCCESS) {
|
||||
@@ -2377,13 +2387,14 @@ CdmResponseType CryptoSession::LoadUsageEntry(
|
||||
oec_session_id_, entry_number,
|
||||
reinterpret_cast<const uint8_t*>(usage_entry.data()),
|
||||
usage_entry.size());
|
||||
metrics_->oemcrypto_load_usage_entry_.Increment(result);
|
||||
});
|
||||
|
||||
if (result != OEMCrypto_SUCCESS) {
|
||||
if (result == OEMCrypto_WARNING_GENERATION_SKEW) {
|
||||
LOGW("LoadUsageEntry: OEMCrypto_LoadUsageEntry warning: generation skew");
|
||||
} else {
|
||||
LOGE("LoadUsageTableHeader: OEMCrypto_LoadUsageEntry error: %d", result);
|
||||
LOGE("LoadUsageEntry: OEMCrypto_LoadUsageEntry error: %d", result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2469,6 +2480,7 @@ CdmResponseType CryptoSession::ShrinkUsageTableHeader(
|
||||
result = OEMCrypto_ShrinkUsageTableHeader(
|
||||
requested_security_level_, new_entry_count, NULL,
|
||||
&usage_table_header_len);
|
||||
metrics_->oemcrypto_shrink_usage_table_header_.Increment(result);
|
||||
});
|
||||
|
||||
if (result == OEMCrypto_ERROR_SHORT_BUFFER) {
|
||||
@@ -2480,6 +2492,7 @@ CdmResponseType CryptoSession::ShrinkUsageTableHeader(
|
||||
reinterpret_cast<uint8_t*>(
|
||||
const_cast<char*>(usage_table_header->data())),
|
||||
&usage_table_header_len);
|
||||
metrics_->oemcrypto_shrink_usage_table_header_.Increment(result);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2497,6 +2510,7 @@ CdmResponseType CryptoSession::MoveUsageEntry(uint32_t new_entry_number) {
|
||||
OEMCryptoResult result;
|
||||
WithOecWriteLock("MoveUsageEntry", [&] {
|
||||
result = OEMCrypto_MoveEntry(oec_session_id_, new_entry_number);
|
||||
metrics_->oemcrypto_move_entry_.Increment(result);
|
||||
});
|
||||
|
||||
return MapOEMCryptoResult(
|
||||
@@ -2545,6 +2559,7 @@ bool CryptoSession::CreateOldUsageEntry(
|
||||
reinterpret_cast<uint8_t*>(const_cast<char*>(client_mac_key.data())),
|
||||
reinterpret_cast<const uint8_t*>(provider_session_token.data()),
|
||||
provider_session_token.size());
|
||||
metrics_->oemcrypto_create_old_usage_entry_.Increment(result);
|
||||
});
|
||||
|
||||
if (result != OEMCrypto_SUCCESS) {
|
||||
@@ -2565,6 +2580,7 @@ CdmResponseType CryptoSession::CopyOldUsageEntry(
|
||||
oec_session_id_,
|
||||
reinterpret_cast<const uint8_t*>(provider_session_token.data()),
|
||||
provider_session_token.size());
|
||||
metrics_->oemcrypto_copy_old_usage_entry_.Increment(result);
|
||||
});
|
||||
|
||||
return MapOEMCryptoResult(
|
||||
|
||||
Reference in New Issue
Block a user