From ad94e69d033fccc7661895e8998a3bf9b9e44620 Mon Sep 17 00:00:00 2001 From: Fred Gylys-Colwell Date: Wed, 26 Apr 2017 20:00:30 -0700 Subject: [PATCH] OEMCrypto Logging Merge from Widevine repo of http://go/wvgerrit/26521 This CL adds some missing logging when TraceOEMCryptoCalls is set. Several SRM functions were not properly logged. It also changes SelectKey from the TraceOEMCryptoCalls flag to the TraceDecryptCalls. This reduces flooding the logs when content is actually playing. b/37751139 Change-Id: Ie92379dc295c83d8ec9bacb2445b1ef47377e4cf --- .../oemcrypto/mock/src/oemcrypto_mock.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libwvdrmengine/oemcrypto/mock/src/oemcrypto_mock.cpp b/libwvdrmengine/oemcrypto/mock/src/oemcrypto_mock.cpp index 794db8f5..d888a3f8 100644 --- a/libwvdrmengine/oemcrypto/mock/src/oemcrypto_mock.cpp +++ b/libwvdrmengine/oemcrypto/mock/src/oemcrypto_mock.cpp @@ -509,7 +509,7 @@ extern "C" OEMCryptoResult OEMCrypto_QueryKeyControl( extern "C" OEMCryptoResult OEMCrypto_SelectKey(const OEMCrypto_SESSION session, const uint8_t* key_id, size_t key_id_length) { - if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) { + if (LogCategoryEnabled(kLoggingTraceDecryptCalls)) { LOGI("-- OEMCryptoResult OEMCrypto_SelectKey(%d, id=%s)", session, wvcdm::HexEncode(key_id, key_id_length).c_str()); } @@ -1630,6 +1630,9 @@ extern "C" OEMCryptoResult OEMCrypto_DeleteOldUsageTable() { } extern "C" bool OEMCrypto_IsSRMUpdateSupported() { + if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) { + LOGI("-- OEMCryptoResult OEMCrypto_IsSRMUpdateSupported()\n"); + } if (!crypto_engine) { LOGE("OEMCrypto_IsSRMUpdateSupported: OEMCrypto Not Initialized."); return false; @@ -1638,6 +1641,9 @@ extern "C" bool OEMCrypto_IsSRMUpdateSupported() { } extern "C" OEMCryptoResult OEMCrypto_GetCurrentSRMVersion(uint16_t* version) { + if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) { + LOGI("-- OEMCryptoResult OEMCrypto_GetCurrentSRMVersion()\n"); + } if (!crypto_engine) { LOGE("OEMCrypto_GetCurrentSRMVersion: OEMCrypto Not Initialized."); return OEMCrypto_ERROR_UNKNOWN_FAILURE; @@ -1650,6 +1656,9 @@ extern "C" OEMCryptoResult OEMCrypto_GetCurrentSRMVersion(uint16_t* version) { extern "C" OEMCryptoResult OEMCrypto_LoadSRM(const uint8_t* buffer, size_t buffer_length) { + if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) { + LOGI("-- OEMCryptoResult OEMCrypto_LoadSRM(length=%d)\n", buffer_length); + } if (!crypto_engine) { LOGE("OEMCrypto_LoadSRM: OEMCrypto Not Initialized."); return OEMCrypto_ERROR_UNKNOWN_FAILURE; @@ -1658,6 +1667,9 @@ extern "C" OEMCryptoResult OEMCrypto_LoadSRM(const uint8_t* buffer, } extern "C" OEMCryptoResult OEMCrypto_RemoveSRM() { + if (LogCategoryEnabled(kLoggingTraceOEMCryptoCalls)) { + LOGI("-- OEMCryptoResult OEMCrypto_RemoveSRM()\n"); + } if (!crypto_engine) { LOGE("OEMCrypto_RemoveSRM: OEMCrypto Not Initialized."); return OEMCrypto_ERROR_UNKNOWN_FAILURE;