OEMCrypto Profiler - Merge of Widevine Updates

This change is a merge of the following changes:
1. Remove MultipleSessions (go/wvgerrit/16763)
2. Increase Memory Budget (go/wvgerrit/16764)
3. Fixing Possible Integer Overflow (go/wvgerrit/16765)
4. Creating Call Table (go/wvgerrit/16766)
5. Creating Call History (go/wvgerrit/16767)
6. Connecting Profiled Scope (go/wvgerrit/16768)
7. Adding Call Table Version Number (go/wvgerrit/16780)
8. Add Version Number to Call History (go/wvgerrit/16781)

bug: 27157796

Change-Id: Ia3f088a1714f3f5b426fee6141daa4ea8d832cf4
This commit is contained in:
Aaron Vaage
2016-02-12 15:43:37 -08:00
committed by Jeff Tinker
parent 9c82455e8f
commit 0d77fecfb5
12 changed files with 457 additions and 153 deletions

View File

@@ -23,7 +23,6 @@
#include "lock.h"
#include "log.h"
#include "profiled_scope.h"
#include "profiler_session.h"
#include "properties.h"
using namespace wvoec3;
@@ -514,10 +513,6 @@ class Adapter {
session_map_[*session] = new_session;
}
if (result == OEMCrypto_SUCCESS) {
wvcdm::oemprofiler::ProfilerSession::Open(static_cast<int64_t>(*session));
}
return result;
}
@@ -534,10 +529,6 @@ class Adapter {
pair->second.fcn->CloseSession(pair->second.session);
session_map_.erase(pair);
if (result == OEMCrypto_SUCCESS) {
wvcdm::oemprofiler::ProfilerSession::Close(static_cast<int64_t>(session));
}
return result;
}
@@ -739,16 +730,6 @@ OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(SecurityLevel level,
} // namespace wvcdm
extern "C" OEMCryptoResult OEMCrypto_Initialize(void) {
if (wvcdm::oemprofiler::ProfilerSession::Find(
wvcdm::oemprofiler::ProfiledScope::kGlobalSID) != NULL) {
wvcdm::oemprofiler::ProfilerSession::Close(
wvcdm::oemprofiler::ProfiledScope::kGlobalSID);
}
wvcdm::oemprofiler::ProfilerSession::Open(
wvcdm::oemprofiler::ProfiledScope::kGlobalSID);
if (kAdapter) {
kAdapter->Terminate();
delete kAdapter;
@@ -758,13 +739,6 @@ extern "C" OEMCryptoResult OEMCrypto_Initialize(void) {
}
extern "C" OEMCryptoResult OEMCrypto_Terminate(void) {
if (wvcdm::oemprofiler::ProfilerSession::Find(
wvcdm::oemprofiler::ProfiledScope::kGlobalSID) != NULL) {
wvcdm::oemprofiler::ProfilerSession::Close(
wvcdm::oemprofiler::ProfiledScope::kGlobalSID);
}
OEMCryptoResult result = OEMCrypto_SUCCESS;
if (kAdapter) {
result = kAdapter->Terminate();
@@ -788,7 +762,7 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateDerivedKeys(
uint32_t mac_key_context_length, const uint8_t* enc_key_context,
uint32_t enc_key_context_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_DERIVED_KEYS);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -802,7 +776,7 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateDerivedKeys(
extern "C" OEMCryptoResult OEMCrypto_GenerateNonce(OEMCrypto_SESSION session,
uint32_t* nonce) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_NONCE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -815,7 +789,7 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateSignature(
OEMCrypto_SESSION session, const uint8_t* message, size_t message_length,
uint8_t* signature, size_t* signature_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_SIGNATURE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -832,7 +806,7 @@ extern "C" OEMCryptoResult OEMCrypto_LoadKeys(
const OEMCrypto_KeyObject* key_array, const uint8_t* pst,
size_t pst_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_LOAD_KEYS);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -876,7 +850,7 @@ extern "C" OEMCryptoResult OEMCrypto_RefreshKeys(
const uint8_t* signature, size_t signature_length, size_t num_keys,
const OEMCrypto_KeyRefreshObject* key_array) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_REFRESH_KEYS);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -890,7 +864,7 @@ extern "C" OEMCryptoResult OEMCrypto_QueryKeyControl(
OEMCrypto_SESSION session, const uint8_t* key_id, size_t key_id_length,
uint8_t* key_control_block, size_t* key_control_block_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_QUERY_KEY_CONTROL);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -905,7 +879,7 @@ extern "C" OEMCryptoResult OEMCrypto_SelectKey(const OEMCrypto_SESSION session,
const uint8_t* key_id,
size_t key_id_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_SELECT_KEY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -921,7 +895,7 @@ extern "C" OEMCryptoResult OEMCrypto_DecryptCENC(
const OEMCrypto_CENCEncryptPatternDesc* pattern,
uint8_t subsample_flags) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_DECRYPT_CENC);
ps.meta_data_.WriteVLV(static_cast<uint64_t>(data_length));
@@ -1014,7 +988,7 @@ extern "C" OEMCryptoResult OEMCrypto_RewrapDeviceRSAKey(
const uint8_t* enc_rsa_key_iv, uint8_t* wrapped_rsa_key,
size_t* wrapped_rsa_key_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_REWRAP_DEVICE_RSA_KEY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -1030,7 +1004,7 @@ extern "C" OEMCryptoResult OEMCrypto_LoadDeviceRSAKey(
OEMCrypto_SESSION session, const uint8_t* wrapped_rsa_key,
size_t wrapped_rsa_key_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_LOAD_DEVICE_RSA_KEY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -1057,7 +1031,7 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateRSASignature(
uint8_t* signature, size_t* signature_length,
RSA_Padding_Scheme padding_scheme) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_RSA_SIGNATURE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -1079,7 +1053,7 @@ extern "C" OEMCryptoResult OEMCrypto_DeriveKeysFromSessionKey(
size_t mac_key_context_length, const uint8_t* enc_key_context,
size_t enc_key_context_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_DERIVE_KEYS_FROM_SESSION_KEY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -1127,7 +1101,7 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Encrypt(
OEMCrypto_SESSION session, const uint8_t* in_buffer, size_t buffer_length,
const uint8_t* iv, OEMCrypto_Algorithm algorithm, uint8_t* out_buffer) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_GENERIC_ENCRYPT);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -1141,7 +1115,7 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Decrypt(
OEMCrypto_SESSION session, const uint8_t* in_buffer, size_t buffer_length,
const uint8_t* iv, OEMCrypto_Algorithm algorithm, uint8_t* out_buffer) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_GENERIC_DECRYPT);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -1158,7 +1132,7 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Sign(OEMCrypto_SESSION session,
uint8_t* signature,
size_t* signature_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_GENERIC_SIGN);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -1224,7 +1198,7 @@ extern "C" OEMCryptoResult OEMCrypto_ReportUsage(OEMCrypto_SESSION session,
OEMCrypto_PST_Report* buffer,
size_t* buffer_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_REPORT_USAGE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
@@ -1243,7 +1217,7 @@ extern "C" OEMCryptoResult OEMCrypto_DeleteUsageEntry(
const uint8_t* message, size_t message_length, const uint8_t* signature,
size_t signature_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_DELETE_USAGE_ENTRY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;