Merge "OEMCrypto Profiler"

This commit is contained in:
Aaron Vaage
2016-01-28 00:05:06 +00:00
committed by Android (Google) Code Review
23 changed files with 1608 additions and 2 deletions

View File

@@ -22,6 +22,8 @@
#include "level3.h"
#include "lock.h"
#include "log.h"
#include "profiled_scope.h"
#include "profiler_session.h"
#include "properties.h"
using namespace wvoec3;
@@ -489,6 +491,9 @@ class Adapter {
OEMCryptoResult OpenSession(OEMCrypto_SESSION* session,
wvcdm::SecurityLevel level) {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_OPEN_SESSION);
LevelSession new_session;
OEMCryptoResult result;
if (level == kLevelDefault && level1_valid_) {
@@ -508,10 +513,18 @@ class Adapter {
}
session_map_[*session] = new_session;
}
if (result == OEMCrypto_SUCCESS) {
wvcdm::oemprofiler::ProfilerSession::Open(static_cast<int64_t>(*session));
}
return result;
}
OEMCryptoResult CloseSession(OEMCrypto_SESSION session) {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_CLOSE_SESSION);
wvcdm::AutoLock auto_lock(session_map_lock_);
map_iterator pair = session_map_.find(session);
if (pair == session_map_.end()) {
@@ -520,6 +533,11 @@ class Adapter {
OEMCryptoResult result =
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;
}
@@ -552,6 +570,7 @@ namespace wvcdm {
OEMCryptoResult OEMCrypto_OpenSession(OEMCrypto_SESSION* session,
SecurityLevel level) {
if (!kAdapter) return OEMCrypto_ERROR_OPEN_SESSION_FAILED;
return kAdapter->OpenSession(session, level);
}
@@ -559,6 +578,11 @@ OEMCryptoResult OEMCrypto_OpenSession(OEMCrypto_SESSION* session,
OEMCryptoResult OEMCrypto_CopyBuffer(
SecurityLevel level, const uint8_t* data_addr, size_t data_length,
OEMCrypto_DestBufferDesc* out_buffer, uint8_t subsample_flags) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_COPY_BUFFER);
ps.meta_data_.WriteVLV(static_cast<uint64_t>(data_length));
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -569,6 +593,9 @@ OEMCryptoResult OEMCrypto_CopyBuffer(
OEMCryptoResult OEMCrypto_InstallKeybox(const uint8_t* keybox,
size_t keyBoxLength,
SecurityLevel level) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_INSTALL_KEYBOX);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -576,6 +603,9 @@ OEMCryptoResult OEMCrypto_InstallKeybox(const uint8_t* keybox,
}
OEMCryptoResult OEMCrypto_IsKeyboxValid(SecurityLevel level) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_IS_KEYBOX_VALID);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -584,6 +614,9 @@ OEMCryptoResult OEMCrypto_IsKeyboxValid(SecurityLevel level) {
OEMCryptoResult OEMCrypto_GetDeviceID(uint8_t* deviceID, size_t* idLength,
SecurityLevel level) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_GET_DEVICE_ID);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -592,6 +625,9 @@ OEMCryptoResult OEMCrypto_GetDeviceID(uint8_t* deviceID, size_t* idLength,
OEMCryptoResult OEMCrypto_GetKeyData(uint8_t* keyData, size_t* keyDataLength,
SecurityLevel level) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_GET_KEY_DATA);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -599,6 +635,9 @@ OEMCryptoResult OEMCrypto_GetKeyData(uint8_t* keyData, size_t* keyDataLength,
}
uint32_t OEMCrypto_APIVersion(SecurityLevel level) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_API_VERSION);
if (!kAdapter) return 0;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return 0;
@@ -606,6 +645,9 @@ uint32_t OEMCrypto_APIVersion(SecurityLevel level) {
}
uint8_t OEMCrypto_Security_Patch_Level(SecurityLevel level) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_SECURITY_PATCH_LEVEL);
if (!kAdapter) return 0;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return 0;
@@ -614,6 +656,9 @@ uint8_t OEMCrypto_Security_Patch_Level(SecurityLevel level) {
}
const char* OEMCrypto_SecurityLevel(SecurityLevel level) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_SECURITY_LEVEL);
if (!kAdapter) return "";
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return "";
@@ -623,6 +668,9 @@ const char* OEMCrypto_SecurityLevel(SecurityLevel level) {
OEMCryptoResult OEMCrypto_GetHDCPCapability(
SecurityLevel level, OEMCrypto_HDCP_Capability* current,
OEMCrypto_HDCP_Capability* maximum) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_GET_HDCP_CAPABILITIY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return OEMCrypto_ERROR_NOT_IMPLEMENTED;
@@ -641,6 +689,9 @@ OEMCryptoResult OEMCrypto_GetHDCPCapability(
}
bool OEMCrypto_SupportsUsageTable(SecurityLevel level) {
oemprofiler::ProfiledScope ps(oemprofiler::OEM_FUNCTION_SUPPORTS_USAGE_TABLE);
if (!kAdapter) return false;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return false;
@@ -649,6 +700,10 @@ bool OEMCrypto_SupportsUsageTable(SecurityLevel level) {
}
bool OEMCrypto_IsAntiRollbackHwPresent(SecurityLevel level) {
oemprofiler::ProfiledScope ps(
oemprofiler::OEM_FUNCTION_IS_ANTI_ROLLBACK_HW_PRESENT);
if (!kAdapter) return false;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return false;
@@ -658,6 +713,10 @@ bool OEMCrypto_IsAntiRollbackHwPresent(SecurityLevel level) {
OEMCryptoResult OEMCrypto_GetNumberOfOpenSessions(SecurityLevel level,
size_t* count) {
oemprofiler::ProfiledScope ps(
oemprofiler::OEM_FUNCTION_GET_NUMBER_OF_OPEN_SESSIONS);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -667,6 +726,10 @@ OEMCryptoResult OEMCrypto_GetNumberOfOpenSessions(SecurityLevel level,
OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(SecurityLevel level,
size_t* maximum) {
oemprofiler::ProfiledScope ps(
oemprofiler::OEM_FUNCTION_GET_MAX_NUMBER_OF_SESSIONS);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(level);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -676,6 +739,16 @@ 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;
@@ -685,6 +758,13 @@ 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();
@@ -707,6 +787,10 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateDerivedKeys(
OEMCrypto_SESSION session, const uint8_t* mac_key_context,
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::OEM_FUNCTION_GENERATE_DERIVED_KEYS);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -717,6 +801,10 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateDerivedKeys(
extern "C" OEMCryptoResult OEMCrypto_GenerateNonce(OEMCrypto_SESSION session,
uint32_t* nonce) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_NONCE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -726,6 +814,10 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateNonce(OEMCrypto_SESSION session,
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::OEM_FUNCTION_GENERATE_SIGNATURE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -739,6 +831,10 @@ extern "C" OEMCryptoResult OEMCrypto_LoadKeys(
const uint8_t* enc_mac_key_iv, const uint8_t* enc_mac_key, size_t num_keys,
const OEMCrypto_KeyObject* key_array, const uint8_t* pst,
size_t pst_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::OEM_FUNCTION_LOAD_KEYS);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -779,6 +875,10 @@ extern "C" OEMCryptoResult OEMCrypto_RefreshKeys(
OEMCrypto_SESSION session, const uint8_t* message, size_t message_length,
const uint8_t* signature, size_t signature_length, size_t num_keys,
const OEMCrypto_KeyRefreshObject* key_array) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::OEM_FUNCTION_REFRESH_KEYS);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -789,6 +889,10 @@ extern "C" OEMCryptoResult OEMCrypto_RefreshKeys(
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::OEM_FUNCTION_QUERY_KEY_CONTROL);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -800,6 +904,10 @@ extern "C" OEMCryptoResult OEMCrypto_QueryKeyControl(
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::OEM_FUNCTION_SELECT_KEY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -812,6 +920,12 @@ extern "C" OEMCryptoResult OEMCrypto_DecryptCENC(
OEMCrypto_DestBufferDesc* out_buffer,
const OEMCrypto_CENCEncryptPatternDesc* pattern,
uint8_t subsample_flags) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::OEM_FUNCTION_DECRYPT_CENC);
ps.meta_data_.WriteVLV(static_cast<uint64_t>(data_length));
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -839,6 +953,10 @@ extern "C" OEMCryptoResult OEMCrypto_WrapKeybox(const uint8_t* keybox,
size_t* wrappedKeyBoxLength,
const uint8_t* transportKey,
size_t transportKeyLength) {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_WRAP_KEYBOX);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(kLevelDefault);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -852,6 +970,10 @@ extern "C" OEMCryptoResult OEMCrypto_InstallKeybox(const uint8_t* keybox,
}
extern "C" OEMCryptoResult OEMCrypto_LoadTestKeybox() {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_LOAD_TEST_KEYBOX);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(kLevelDefault);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -875,6 +997,10 @@ extern "C" OEMCryptoResult OEMCrypto_GetKeyData(uint8_t* keyData,
extern "C" OEMCryptoResult OEMCrypto_GetRandom(uint8_t* randomData,
size_t dataLength) {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_GET_RANDOM);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(kLevelDefault);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -887,6 +1013,10 @@ extern "C" OEMCryptoResult OEMCrypto_RewrapDeviceRSAKey(
const uint8_t* enc_rsa_key, size_t enc_rsa_key_length,
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::OEM_FUNCTION_REWRAP_DEVICE_RSA_KEY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -899,6 +1029,10 @@ extern "C" OEMCryptoResult OEMCrypto_RewrapDeviceRSAKey(
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::OEM_FUNCTION_LOAD_DEVICE_RSA_KEY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -907,6 +1041,10 @@ extern "C" OEMCryptoResult OEMCrypto_LoadDeviceRSAKey(
}
extern "C" OEMCryptoResult OEMCrypto_LoadTestRSAKey() {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_LOAD_TEST_RSA_KEY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn = kAdapter->get(kLevelDefault);
if (!fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -918,6 +1056,10 @@ extern "C" OEMCryptoResult OEMCrypto_GenerateRSASignature(
OEMCrypto_SESSION session, const uint8_t* message, size_t message_length,
uint8_t* signature, size_t* signature_length,
RSA_Padding_Scheme padding_scheme) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::OEM_FUNCTION_GENERATE_RSA_SIGNATURE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -936,6 +1078,10 @@ extern "C" OEMCryptoResult OEMCrypto_DeriveKeysFromSessionKey(
size_t enc_session_key_length, const uint8_t* mac_key_context,
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::OEM_FUNCTION_DERIVE_KEYS_FROM_SESSION_KEY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -980,6 +1126,10 @@ extern "C" OEMCryptoResult OEMCrypto_GetMaxNumberOfSessions(size_t* maximum) {
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::OEM_FUNCTION_GENERIC_ENCRYPT);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -990,6 +1140,10 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Encrypt(
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::OEM_FUNCTION_GENERIC_DECRYPT);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -1003,6 +1157,10 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Sign(OEMCrypto_SESSION session,
OEMCrypto_Algorithm algorithm,
uint8_t* signature,
size_t* signature_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::OEM_FUNCTION_GENERIC_SIGN);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -1014,6 +1172,10 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Verify(
OEMCrypto_SESSION session, const uint8_t* in_buffer, size_t buffer_length,
OEMCrypto_Algorithm algorithm, const uint8_t* signature,
size_t signature_length) {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_GENERIC_VERIFY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -1022,6 +1184,10 @@ extern "C" OEMCryptoResult OEMCrypto_Generic_Verify(
}
extern "C" OEMCryptoResult OEMCrypto_UpdateUsageTable() {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_UPDATE_USAGE_TABLE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn1 = kAdapter->get(kLevelDefault);
const FunctionPointers* fcn3 = kAdapter->get(kLevel3);
@@ -1033,6 +1199,10 @@ extern "C" OEMCryptoResult OEMCrypto_UpdateUsageTable() {
extern "C" OEMCryptoResult OEMCrypto_DeactivateUsageEntry(const uint8_t* pst,
size_t pst_length) {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_DEACTIVATE_USAGE_ENTRY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn1 = kAdapter->get(kLevelDefault);
const FunctionPointers* fcn3 = kAdapter->get(kLevel3);
@@ -1053,6 +1223,10 @@ extern "C" OEMCryptoResult OEMCrypto_ReportUsage(OEMCrypto_SESSION session,
size_t pst_length,
OEMCrypto_PST_Report* buffer,
size_t* buffer_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::OEM_FUNCTION_REPORT_USAGE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -1068,6 +1242,10 @@ extern "C" OEMCryptoResult OEMCrypto_DeleteUsageEntry(
OEMCrypto_SESSION session, const uint8_t* pst, size_t pst_length,
const uint8_t* message, size_t message_length, const uint8_t* signature,
size_t signature_length) {
wvcdm::oemprofiler::ProfiledScope ps(session,
wvcdm::oemprofiler::OEM_FUNCTION_DELETE_USAGE_ENTRY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
LevelSession pair = kAdapter->get(session);
if (!pair.fcn) return OEMCrypto_ERROR_INVALID_SESSION;
@@ -1082,6 +1260,10 @@ extern "C" OEMCryptoResult OEMCrypto_DeleteUsageEntry(
extern "C" OEMCryptoResult OEMCrypto_ForceDeleteUsageEntry(
const uint8_t* pst, size_t pst_length) {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_FORCE_DELETE_USAGE_ENTRY);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn1 = kAdapter->get(kLevelDefault);
const FunctionPointers* fcn3 = kAdapter->get(kLevel3);
@@ -1099,6 +1281,10 @@ extern "C" OEMCryptoResult OEMCrypto_ForceDeleteUsageEntry(
}
extern "C" OEMCryptoResult OEMCrypto_DeleteUsageTable() {
wvcdm::oemprofiler::ProfiledScope ps(
wvcdm::oemprofiler::OEM_FUNCTION_DELETE_USAGE_TABLE);
if (!kAdapter) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
const FunctionPointers* fcn1 = kAdapter->get(kLevelDefault);
const FunctionPointers* fcn3 = kAdapter->get(kLevel3);