Correct format specifier

[ Merged from http://go/wvgerrit/43640 ]

Bug: 62266605
Test: WV unit/integration test
Change-Id: I9944805f0dd7f5b33e3a0b2eb40f2a3a6e26489e
This commit is contained in:
Rahul Frias
2018-02-16 13:45:43 -08:00
parent a0040ec5bf
commit 3480900b1a

View File

@@ -646,7 +646,7 @@ CdmResponseType CryptoSession::Open(SecurityLevel requested_security_level) {
OEMCryptoResult sts = OEMCrypto_OpenSession(&sid, requested_security_level); OEMCryptoResult sts = OEMCrypto_OpenSession(&sid, requested_security_level);
if (OEMCrypto_SUCCESS == sts) { if (OEMCrypto_SUCCESS == sts) {
oec_session_id_ = static_cast<CryptoSessionId>(sid); oec_session_id_ = static_cast<CryptoSessionId>(sid);
LOGV("OpenSession: id= %ld", (uint32_t)oec_session_id_); LOGV("OpenSession: id= %lu", oec_session_id_);
open_ = true; open_ = true;
} else if (OEMCrypto_ERROR_TOO_MANY_SESSIONS == sts) { } else if (OEMCrypto_ERROR_TOO_MANY_SESSIONS == sts) {
LOGE("OEMCrypto_Open failed: %d, open sessions: %ld, initialized: %d", sts, LOGE("OEMCrypto_Open failed: %d, open sessions: %ld, initialized: %d", sts,
@@ -719,7 +719,7 @@ CdmResponseType CryptoSession::Open(SecurityLevel requested_security_level) {
} }
void CryptoSession::Close() { void CryptoSession::Close() {
LOGV("CloseSession: id=%ld open=%s", (uint32_t)oec_session_id_, LOGV("CloseSession: id=%lu open=%s", oec_session_id_,
open_ ? "true" : "false"); open_ ? "true" : "false");
OEMCryptoResult close_sts; OEMCryptoResult close_sts;
@@ -809,7 +809,7 @@ CdmResponseType CryptoSession::LoadKeys(
key_session_.reset(new EntitlementKeySession(oec_session_id_, metrics_)); key_session_.reset(new EntitlementKeySession(oec_session_id_, metrics_));
} }
LOGV("LoadKeys: id=%ld", (uint32_t)oec_session_id_); LOGV("LoadKeys: id=%lu", oec_session_id_);
OEMCryptoResult sts = key_session_->LoadKeys( OEMCryptoResult sts = key_session_->LoadKeys(
message, signature, mac_key_iv, mac_key, keys, provider_session_token, message, signature, mac_key_iv, mac_key, keys, provider_session_token,
&cipher_mode_, srm_requirement); &cipher_mode_, srm_requirement);
@@ -861,7 +861,7 @@ bool CryptoSession::LoadCertificatePrivateKey(std::string& wrapped_key) {
OEMCrypto_GetOEMPublicCertificate(oec_session_id_, buf, &buf_size); OEMCrypto_GetOEMPublicCertificate(oec_session_id_, buf, &buf_size);
metrics_->oemcrypto_get_oem_public_certificate_.Increment(sts); metrics_->oemcrypto_get_oem_public_certificate_.Increment(sts);
LOGV("LoadDeviceRSAKey: id=%ld", (uint32_t)oec_session_id_); LOGV("LoadDeviceRSAKey: id=%lu", oec_session_id_);
M_TIME( M_TIME(
sts = OEMCrypto_LoadDeviceRSAKey( sts = OEMCrypto_LoadDeviceRSAKey(
oec_session_id_, reinterpret_cast<const uint8_t*>(wrapped_key.data()), oec_session_id_, reinterpret_cast<const uint8_t*>(wrapped_key.data()),
@@ -905,7 +905,7 @@ bool CryptoSession::RefreshKeys(const std::string& message,
ko->key_control = NULL; ko->key_control = NULL;
} }
} }
LOGV("RefreshKeys: id=%ld", static_cast<uint32_t>(oec_session_id_)); LOGV("RefreshKeys: id=%lu", oec_session_id_);
OEMCryptoResult refresh_sts; OEMCryptoResult refresh_sts;
M_TIME(refresh_sts = OEMCrypto_RefreshKeys( M_TIME(refresh_sts = OEMCrypto_RefreshKeys(
oec_session_id_, msg, message.size(), oec_session_id_, msg, message.size(),
@@ -958,7 +958,7 @@ bool CryptoSession::GenerateDerivedKeys(const std::string& message,
bool CryptoSession::GenerateSignature(const std::string& message, bool CryptoSession::GenerateSignature(const std::string& message,
std::string* signature) { std::string* signature) {
LOGV("GenerateSignature: id=%ld", (uint32_t)oec_session_id_); LOGV("GenerateSignature: id=%lu", oec_session_id_);
if (!signature) { if (!signature) {
LOGE("GenerateSignature: null signature string"); LOGE("GenerateSignature: null signature string");
return false; return false;
@@ -996,7 +996,7 @@ bool CryptoSession::GenerateSignature(const std::string& message,
bool CryptoSession::GenerateRsaSignature(const std::string& message, bool CryptoSession::GenerateRsaSignature(const std::string& message,
std::string* signature) { std::string* signature) {
LOGV("GenerateRsaSignature: id=%ld", (uint32_t)oec_session_id_); LOGV("GenerateRsaSignature: id=%lu", oec_session_id_);
if (!signature) { if (!signature) {
LOGE("GenerateRsaSignature: null signature string"); LOGE("GenerateRsaSignature: null signature string");
return false; return false;
@@ -1146,7 +1146,7 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) {
} }
bool CryptoSession::UsageInformationSupport(bool* has_support) { bool CryptoSession::UsageInformationSupport(bool* has_support) {
LOGV("UsageInformationSupport: id=%ld", (uint32_t)oec_session_id_); LOGV("UsageInformationSupport: id=%lu", oec_session_id_);
if (!initialized_) return false; if (!initialized_) return false;
*has_support = OEMCrypto_SupportsUsageTable(requested_security_level_); *has_support = OEMCrypto_SupportsUsageTable(requested_security_level_);
@@ -1154,8 +1154,8 @@ bool CryptoSession::UsageInformationSupport(bool* has_support) {
} }
CdmResponseType CryptoSession::UpdateUsageInformation() { CdmResponseType CryptoSession::UpdateUsageInformation() {
LOGV("CryptoSession::UpdateUsageInformation: id=%ld", LOGV("CryptoSession::UpdateUsageInformation: id=%lu",
(uint32_t)oec_session_id_); oec_session_id_);
AutoLock auto_lock(crypto_lock_); AutoLock auto_lock(crypto_lock_);
if (!initialized_) return UNKNOWN_ERROR; if (!initialized_) return UNKNOWN_ERROR;
@@ -1175,7 +1175,7 @@ CdmResponseType CryptoSession::UpdateUsageInformation() {
CdmResponseType CryptoSession::DeactivateUsageInformation( CdmResponseType CryptoSession::DeactivateUsageInformation(
const std::string& provider_session_token) { const std::string& provider_session_token) {
LOGV("DeactivateUsageInformation: id=%ld", (uint32_t)oec_session_id_); LOGV("DeactivateUsageInformation: id=%lu", oec_session_id_);
AutoLock auto_lock(crypto_lock_); AutoLock auto_lock(crypto_lock_);
uint8_t* pst = reinterpret_cast<uint8_t*>( uint8_t* pst = reinterpret_cast<uint8_t*>(
@@ -1183,7 +1183,7 @@ CdmResponseType CryptoSession::DeactivateUsageInformation(
// TODO(fredgc or rfrias): make sure oec_session_id_ is valid. // TODO(fredgc or rfrias): make sure oec_session_id_ is valid.
OEMCryptoResult status = OEMCrypto_DeactivateUsageEntry( OEMCryptoResult status = OEMCrypto_DeactivateUsageEntry(
(uint32_t)oec_session_id_, pst, provider_session_token.length()); oec_session_id_, pst, provider_session_token.length());
metrics_->oemcrypto_deactivate_usage_entry_.Increment(status); metrics_->oemcrypto_deactivate_usage_entry_.Increment(status);
switch (status) { switch (status) {
@@ -1202,7 +1202,7 @@ CdmResponseType CryptoSession::GenerateUsageReport(
const std::string& provider_session_token, std::string* usage_report, const std::string& provider_session_token, std::string* usage_report,
UsageDurationStatus* usage_duration_status, int64_t* seconds_since_started, UsageDurationStatus* usage_duration_status, int64_t* seconds_since_started,
int64_t* seconds_since_last_played) { int64_t* seconds_since_last_played) {
LOGV("GenerateUsageReport: id=%ld", (uint32_t)oec_session_id_); LOGV("GenerateUsageReport: id=%lu", oec_session_id_);
if (NULL == usage_report) { if (NULL == usage_report) {
LOGE("CryptoSession::GenerateUsageReport: usage_report parameter is null"); LOGE("CryptoSession::GenerateUsageReport: usage_report parameter is null");
@@ -1293,7 +1293,7 @@ CdmResponseType CryptoSession::GenerateUsageReport(
CdmResponseType CryptoSession::ReleaseUsageInformation( CdmResponseType CryptoSession::ReleaseUsageInformation(
const std::string& message, const std::string& signature, const std::string& message, const std::string& signature,
const std::string& provider_session_token) { const std::string& provider_session_token) {
LOGV("ReleaseUsageInformation: id=%ld", (uint32_t)oec_session_id_); LOGV("ReleaseUsageInformation: id=%lu", oec_session_id_);
{ {
AutoLock auto_lock(crypto_lock_); AutoLock auto_lock(crypto_lock_);
if (usage_table_header_ != NULL) { if (usage_table_header_ != NULL) {
@@ -1434,8 +1434,7 @@ bool CryptoSession::RewrapCertificate(const std::string& signed_message,
const std::string& iv, const std::string& iv,
const std::string& wrapping_key, const std::string& wrapping_key,
std::string* wrapped_private_key) { std::string* wrapped_private_key) {
LOGV("CryptoSession::RewrapCertificate, session id=%ld", LOGV("CryptoSession::RewrapCertificate, session id=%lu", oec_session_id_);
static_cast<uint32_t>(oec_session_id_));
if (pre_provision_token_type_ == kClientTokenKeybox) { if (pre_provision_token_type_ == kClientTokenKeybox) {
return RewrapDeviceRSAKey(signed_message, signature, nonce, private_key, iv, return RewrapDeviceRSAKey(signed_message, signature, nonce, private_key, iv,
@@ -1448,8 +1447,8 @@ bool CryptoSession::RewrapCertificate(const std::string& signed_message,
} else { } else {
LOGE( LOGE(
"CryptoSession::RewrapCertificate, Bad pre-provision type=%d: " "CryptoSession::RewrapCertificate, Bad pre-provision type=%d: "
"session id=%ld", "session id=%lu",
pre_provision_token_type_, static_cast<uint32_t>(oec_session_id_)); pre_provision_token_type_, oec_session_id_);
return false; return false;
} }
} }
@@ -1460,8 +1459,7 @@ bool CryptoSession::RewrapDeviceRSAKey(const std::string& message,
const std::string& enc_rsa_key, const std::string& enc_rsa_key,
const std::string& rsa_key_iv, const std::string& rsa_key_iv,
std::string* wrapped_rsa_key) { std::string* wrapped_rsa_key) {
LOGV("CryptoSession::RewrapDeviceRSAKey, session id=%ld", LOGV("CryptoSession::RewrapDeviceRSAKey, session id=%lu", oec_session_id_);
static_cast<uint32_t>(oec_session_id_));
const uint8_t* signed_msg = reinterpret_cast<const uint8_t*>(message.data()); const uint8_t* signed_msg = reinterpret_cast<const uint8_t*>(message.data());
const uint8_t* msg_rsa_key = NULL; const uint8_t* msg_rsa_key = NULL;
@@ -1514,8 +1512,8 @@ bool CryptoSession::RewrapDeviceRSAKey30(const std::string& message,
const std::string& iv, const std::string& iv,
const std::string& wrapping_key, const std::string& wrapping_key,
std::string* wrapped_private_key) { std::string* wrapped_private_key) {
LOGV("CryptoSession::RewrapDeviceRSAKey30, session id=%ld", LOGV("CryptoSession::RewrapDeviceRSAKey30, session id=%lu",
static_cast<uint32_t>(oec_session_id_)); oec_session_id_);
const uint8_t* signed_msg = reinterpret_cast<const uint8_t*>(message.data()); const uint8_t* signed_msg = reinterpret_cast<const uint8_t*>(message.data());
const uint8_t* msg_private_key = NULL; const uint8_t* msg_private_key = NULL;
@@ -1570,7 +1568,7 @@ bool CryptoSession::RewrapDeviceRSAKey30(const std::string& message,
bool CryptoSession::GetHdcpCapabilities(HdcpCapability* current, bool CryptoSession::GetHdcpCapabilities(HdcpCapability* current,
HdcpCapability* max) { HdcpCapability* max) {
LOGV("GetHdcpCapabilities: id=%ld", (uint32_t)oec_session_id_); LOGV("GetHdcpCapabilities: id=%lu", oec_session_id_);
if (!initialized_) return false; if (!initialized_) return false;
if (current == NULL || max == NULL) { if (current == NULL || max == NULL) {
LOGE( LOGE(
@@ -1594,7 +1592,7 @@ bool CryptoSession::GetHdcpCapabilities(HdcpCapability* current,
bool CryptoSession::GetSupportedCertificateTypes( bool CryptoSession::GetSupportedCertificateTypes(
SupportedCertificateTypes* support) { SupportedCertificateTypes* support) {
LOGV("GetSupportedCertificateTypes: id=%ld", (uint32_t)oec_session_id_); LOGV("GetSupportedCertificateTypes: id=%lu", oec_session_id_);
if (!initialized_) return false; if (!initialized_) return false;
if (support == NULL) { if (support == NULL) {
LOGE( LOGE(
@@ -1720,7 +1718,7 @@ CdmResponseType CryptoSession::GenericEncrypt(const std::string& in_buffer,
const std::string& iv, const std::string& iv,
CdmEncryptionAlgorithm algorithm, CdmEncryptionAlgorithm algorithm,
std::string* out_buffer) { std::string* out_buffer) {
LOGV("GenericEncrypt: id=%ld", (uint32_t)oec_session_id_); LOGV("GenericEncrypt: id=%lu", oec_session_id_);
if (!out_buffer) { if (!out_buffer) {
LOGE("CryptoSession::GenericEncrypt: out_buffer not provided"); LOGE("CryptoSession::GenericEncrypt: out_buffer not provided");
return PARAMETER_NULL; return PARAMETER_NULL;
@@ -1772,7 +1770,7 @@ CdmResponseType CryptoSession::GenericDecrypt(const std::string& in_buffer,
const std::string& iv, const std::string& iv,
CdmEncryptionAlgorithm algorithm, CdmEncryptionAlgorithm algorithm,
std::string* out_buffer) { std::string* out_buffer) {
LOGV("GenericDecrypt: id=%ld", (uint32_t)oec_session_id_); LOGV("GenericDecrypt: id=%lu", oec_session_id_);
if (!out_buffer) { if (!out_buffer) {
LOGE("CryptoSession::GenericDecrypt: out_buffer not provided"); LOGE("CryptoSession::GenericDecrypt: out_buffer not provided");
return PARAMETER_NULL; return PARAMETER_NULL;
@@ -1823,7 +1821,7 @@ CdmResponseType CryptoSession::GenericSign(const std::string& message,
const std::string& key_id, const std::string& key_id,
CdmSigningAlgorithm algorithm, CdmSigningAlgorithm algorithm,
std::string* signature) { std::string* signature) {
LOGV("GenericSign: id=%ld", (uint32_t)oec_session_id_); LOGV("GenericSign: id=%lu", oec_session_id_);
if (!signature) { if (!signature) {
LOGE("CryptoSession::GenericSign: signature not provided"); LOGE("CryptoSession::GenericSign: signature not provided");
return PARAMETER_NULL; return PARAMETER_NULL;
@@ -1883,7 +1881,7 @@ CdmResponseType CryptoSession::GenericVerify(const std::string& message,
const std::string& key_id, const std::string& key_id,
CdmSigningAlgorithm algorithm, CdmSigningAlgorithm algorithm,
const std::string& signature) { const std::string& signature) {
LOGV("GenericVerify: id=%ld", (uint32_t)oec_session_id_); LOGV("GenericVerify: id=%lu", oec_session_id_);
OEMCrypto_Algorithm oec_algorithm = GenericSigningAlgorithm(algorithm); OEMCrypto_Algorithm oec_algorithm = GenericSigningAlgorithm(algorithm);
if (oec_algorithm == kInvalidAlgorithm) { if (oec_algorithm == kInvalidAlgorithm) {
@@ -1921,7 +1919,7 @@ CdmResponseType CryptoSession::GenericVerify(const std::string& message,
CdmResponseType CryptoSession::GetUsageSupportType( CdmResponseType CryptoSession::GetUsageSupportType(
CdmUsageSupportType* usage_support_type) { CdmUsageSupportType* usage_support_type) {
LOGV("GetUsageSupportType: id=%ld", (uint32_t)oec_session_id_); LOGV("GetUsageSupportType: id=%lu", oec_session_id_);
if (usage_support_type == NULL) { if (usage_support_type == NULL) {
LOGE("GetUsageSupportType: usage_support_type param not provided"); LOGE("GetUsageSupportType: usage_support_type param not provided");
@@ -1953,7 +1951,7 @@ CdmResponseType CryptoSession::GetUsageSupportType(
CdmResponseType CryptoSession::CreateUsageTableHeader( CdmResponseType CryptoSession::CreateUsageTableHeader(
CdmUsageTableHeader* usage_table_header) { CdmUsageTableHeader* usage_table_header) {
LOGV("CreateUsageTableHeader: id=%ld", (uint32_t)oec_session_id_); LOGV("CreateUsageTableHeader: id=%lu", oec_session_id_);
if (usage_table_header == NULL) { if (usage_table_header == NULL) {
LOGE("CreateUsageTableHeader: usage_table_header param not provided"); LOGE("CreateUsageTableHeader: usage_table_header param not provided");
@@ -1989,7 +1987,7 @@ CdmResponseType CryptoSession::CreateUsageTableHeader(
CdmResponseType CryptoSession::LoadUsageTableHeader( CdmResponseType CryptoSession::LoadUsageTableHeader(
const CdmUsageTableHeader& usage_table_header) { const CdmUsageTableHeader& usage_table_header) {
LOGV("LoadUsageTableHeader: id=%ld", (uint32_t)oec_session_id_); LOGV("LoadUsageTableHeader: id=%lu", oec_session_id_);
OEMCryptoResult result = OEMCrypto_LoadUsageTableHeader( OEMCryptoResult result = OEMCrypto_LoadUsageTableHeader(
requested_security_level_, requested_security_level_,
@@ -2024,7 +2022,7 @@ CdmResponseType CryptoSession::LoadUsageTableHeader(
} }
CdmResponseType CryptoSession::CreateUsageEntry(uint32_t* entry_number) { CdmResponseType CryptoSession::CreateUsageEntry(uint32_t* entry_number) {
LOGV("CreateUsageEntry: id=%ld", (uint32_t)oec_session_id_); LOGV("CreateUsageEntry: id=%lu", oec_session_id_);
if (entry_number == NULL) { if (entry_number == NULL) {
LOGE("CreateUsageEntry: entry_number param not provided"); LOGE("CreateUsageEntry: entry_number param not provided");
@@ -2050,7 +2048,7 @@ CdmResponseType CryptoSession::CreateUsageEntry(uint32_t* entry_number) {
CdmResponseType CryptoSession::LoadUsageEntry( CdmResponseType CryptoSession::LoadUsageEntry(
uint32_t entry_number, const CdmUsageEntry& usage_entry) { uint32_t entry_number, const CdmUsageEntry& usage_entry) {
LOGV("LoadUsageEntry: id=%ld", (uint32_t)oec_session_id_); LOGV("LoadUsageEntry: id=%lu", oec_session_id_);
OEMCryptoResult result = OEMCrypto_LoadUsageEntry( OEMCryptoResult result = OEMCrypto_LoadUsageEntry(
oec_session_id_, entry_number, oec_session_id_, entry_number,
@@ -2079,7 +2077,7 @@ CdmResponseType CryptoSession::LoadUsageEntry(
CdmResponseType CryptoSession::UpdateUsageEntry( CdmResponseType CryptoSession::UpdateUsageEntry(
CdmUsageTableHeader* usage_table_header, CdmUsageEntry* usage_entry) { CdmUsageTableHeader* usage_table_header, CdmUsageEntry* usage_entry) {
LOGV("UpdateUsageEntry: id=%ld", (uint32_t)oec_session_id_); LOGV("UpdateUsageEntry: id=%lu", oec_session_id_);
if (usage_table_header == NULL) { if (usage_table_header == NULL) {
LOGE("UpdateUsageEntry: usage_table_header param not provided"); LOGE("UpdateUsageEntry: usage_table_header param not provided");
@@ -2121,7 +2119,7 @@ CdmResponseType CryptoSession::UpdateUsageEntry(
CdmResponseType CryptoSession::ShrinkUsageTableHeader( CdmResponseType CryptoSession::ShrinkUsageTableHeader(
uint32_t new_entry_count, CdmUsageTableHeader* usage_table_header) { uint32_t new_entry_count, CdmUsageTableHeader* usage_table_header) {
LOGV("ShrinkUsageTableHeader: id=%ld", (uint32_t)oec_session_id_); LOGV("ShrinkUsageTableHeader: id=%lu", oec_session_id_);
if (usage_table_header == NULL) { if (usage_table_header == NULL) {
LOGE("ShrinkUsageTableHeader: usage_table_header param not provided"); LOGE("ShrinkUsageTableHeader: usage_table_header param not provided");
@@ -2154,7 +2152,7 @@ CdmResponseType CryptoSession::ShrinkUsageTableHeader(
} }
CdmResponseType CryptoSession::MoveUsageEntry(uint32_t new_entry_number) { CdmResponseType CryptoSession::MoveUsageEntry(uint32_t new_entry_number) {
LOGV("MoveUsageEntry: id=%ld", (uint32_t)oec_session_id_); LOGV("MoveUsageEntry: id=%lu", oec_session_id_);
OEMCryptoResult result = OEMCryptoResult result =
OEMCrypto_MoveEntry(oec_session_id_, new_entry_number); OEMCrypto_MoveEntry(oec_session_id_, new_entry_number);
@@ -2219,7 +2217,7 @@ bool CryptoSession::CreateOldUsageEntry(
CdmResponseType CryptoSession::CopyOldUsageEntry( CdmResponseType CryptoSession::CopyOldUsageEntry(
const std::string& provider_session_token) { const std::string& provider_session_token) {
LOGV("CopyOldUsageEntry: id=%ld", (uint32_t)oec_session_id_); LOGV("CopyOldUsageEntry: id=%lu", oec_session_id_);
OEMCryptoResult result = OEMCrypto_CopyOldUsageEntry( OEMCryptoResult result = OEMCrypto_CopyOldUsageEntry(
oec_session_id_, oec_session_id_,
@@ -2237,7 +2235,7 @@ CdmResponseType CryptoSession::CopyOldUsageEntry(
bool CryptoSession::GetAnalogOutputCapabilities(bool* can_support_output, bool CryptoSession::GetAnalogOutputCapabilities(bool* can_support_output,
bool* can_disable_output, bool* can_disable_output,
bool* can_support_cgms_a) { bool* can_support_cgms_a) {
LOGV("GetAnalogOutputCapabilities: id=%ld", (uint32_t)oec_session_id_); LOGV("GetAnalogOutputCapabilities: id=%lu", oec_session_id_);
uint32_t flags = OEMCrypto_GetAnalogOutputFlags(requested_security_level_); uint32_t flags = OEMCrypto_GetAnalogOutputFlags(requested_security_level_);
if ((flags & OEMCrypto_Unknown_Analog_Output) != 0) return false; if ((flags & OEMCrypto_Unknown_Analog_Output) != 0) return false;