Refine OEMCrypto Mock Logging
Merge from Widevine repo of http://go/wvgerrit/24727 This separates out the logging of decrypt calls from all other calls. This is useful because we sometimes want to trace all the calls in a license request, but we don't want logging of decrypt calls which would slow down playback. b/37353534 b/35141278 Change-Id: I3f172c02778d86e66d0e1f90344a34c4d3b15a9e
This commit is contained in:
@@ -6,8 +6,8 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "log.h"
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "log.h"
|
||||
|
||||
namespace wvoec_mock {
|
||||
|
||||
@@ -20,13 +20,14 @@ namespace wvoec_mock {
|
||||
// LogCategoryEnabled(category1 | category2) will return true if
|
||||
// category1 and/or category2 are set to logging.
|
||||
|
||||
const int kLoggingTraceOEMCryptoCalls = 0x01;
|
||||
const int kLoggingTraceOEMCryptoCalls = 0x01; // All except decrypt calls.
|
||||
const int kLoggingDumpContentKeys = 0x02;
|
||||
const int kLoggingDumpKeyControlBlocks = 0x04;
|
||||
const int kLoggingDumpDerivedKeys = 0x08;
|
||||
const int kLoggingTraceNonce = 0x10;
|
||||
const int kLoggingTraceDecryption = 0x20;
|
||||
const int kLoggingTraceUsageTable = 0x40;
|
||||
const int kLoggingTraceDecryptCalls = 0x80;
|
||||
const int kLoggingDumpTraceAll = 0xFF;
|
||||
|
||||
void SetLoggingSettings(int level, int categories);
|
||||
@@ -56,10 +57,9 @@ void dump_array_part_helper(std::string& buffer, std::string array,
|
||||
size_t index, std::string name,
|
||||
const uint8_t* vector, size_t length);
|
||||
|
||||
void dump_array_part(std::string array, size_t index,
|
||||
std::string name, const uint8_t* vector, size_t length);
|
||||
void dump_array_part(std::string array, size_t index, std::string name,
|
||||
const uint8_t* vector, size_t length);
|
||||
|
||||
} // namespace wvoec_mock
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -580,9 +580,8 @@ extern "C" OEMCryptoResult OEMCrypto_DecryptCENC(
|
||||
bool is_encrypted, const uint8_t* iv, size_t block_offset,
|
||||
OEMCrypto_DestBufferDesc* out_buffer,
|
||||
const OEMCrypto_CENCEncryptPatternDesc* pattern, uint8_t subsample_flags) {
|
||||
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
|
||||
LOGI("-- OEMCryptoResult OEMCrypto_DecryptCENC"
|
||||
"(OEMCrypto_SESSION session,\n");
|
||||
if (LogCategoryEnabled(kLoggingTraceDecryptCalls)) {
|
||||
LOGI("-- OEMCryptoResult OEMCrypto_DecryptCENC(%d)", session);
|
||||
}
|
||||
if (!crypto_engine) {
|
||||
LOGE("OEMCrypto_DecryptCENC: OEMCrypto Not Initialized.");
|
||||
@@ -626,7 +625,7 @@ extern "C" OEMCryptoResult OEMCrypto_DecryptCENC(
|
||||
extern "C" OEMCryptoResult OEMCrypto_CopyBuffer(
|
||||
const uint8_t* data_addr, size_t data_length,
|
||||
OEMCrypto_DestBufferDesc* out_buffer, uint8_t subsample_flags) {
|
||||
if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) {
|
||||
if (LogCategoryEnabled(kLoggingTraceDecryptCalls)) {
|
||||
LOGI("-- OEMCryptoResult OEMCrypto_CopyBuffer(..)\n");
|
||||
}
|
||||
if (!crypto_engine) {
|
||||
|
||||
@@ -111,6 +111,7 @@ TEST_F(OEMCryptoLoggingTest, TestChangeLoggingCategories) {
|
||||
ASSERT_TRUE(LogCategoryEnabled(kLoggingTraceNonce));
|
||||
ASSERT_TRUE(LogCategoryEnabled(kLoggingTraceDecryption));
|
||||
ASSERT_TRUE(LogCategoryEnabled(kLoggingTraceUsageTable));
|
||||
ASSERT_TRUE(LogCategoryEnabled(kLoggingTraceDecryptCalls));
|
||||
ASSERT_TRUE(LogCategoryEnabled(kLoggingDumpTraceAll));
|
||||
|
||||
RemoveLoggingForCategories(kLoggingDumpKeyControlBlocks);
|
||||
|
||||
Reference in New Issue
Block a user