From 3480900b1a1c9e17470bba52984a4afaa7705e05 Mon Sep 17 00:00:00 2001 From: Rahul Frias Date: Fri, 16 Feb 2018 13:45:43 -0800 Subject: [PATCH] Correct format specifier [ Merged from http://go/wvgerrit/43640 ] Bug: 62266605 Test: WV unit/integration test Change-Id: I9944805f0dd7f5b33e3a0b2eb40f2a3a6e26489e --- .../cdm/core/src/crypto_session.cpp | 74 +++++++++---------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/libwvdrmengine/cdm/core/src/crypto_session.cpp b/libwvdrmengine/cdm/core/src/crypto_session.cpp index 2f76eb13..e7a7be58 100644 --- a/libwvdrmengine/cdm/core/src/crypto_session.cpp +++ b/libwvdrmengine/cdm/core/src/crypto_session.cpp @@ -646,7 +646,7 @@ CdmResponseType CryptoSession::Open(SecurityLevel requested_security_level) { OEMCryptoResult sts = OEMCrypto_OpenSession(&sid, requested_security_level); if (OEMCrypto_SUCCESS == sts) { oec_session_id_ = static_cast(sid); - LOGV("OpenSession: id= %ld", (uint32_t)oec_session_id_); + LOGV("OpenSession: id= %lu", oec_session_id_); open_ = true; } else if (OEMCrypto_ERROR_TOO_MANY_SESSIONS == 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() { - LOGV("CloseSession: id=%ld open=%s", (uint32_t)oec_session_id_, + LOGV("CloseSession: id=%lu open=%s", oec_session_id_, open_ ? "true" : "false"); OEMCryptoResult close_sts; @@ -809,7 +809,7 @@ CdmResponseType CryptoSession::LoadKeys( 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( message, signature, mac_key_iv, mac_key, keys, provider_session_token, &cipher_mode_, srm_requirement); @@ -861,7 +861,7 @@ bool CryptoSession::LoadCertificatePrivateKey(std::string& wrapped_key) { OEMCrypto_GetOEMPublicCertificate(oec_session_id_, buf, &buf_size); 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( sts = OEMCrypto_LoadDeviceRSAKey( oec_session_id_, reinterpret_cast(wrapped_key.data()), @@ -905,7 +905,7 @@ bool CryptoSession::RefreshKeys(const std::string& message, ko->key_control = NULL; } } - LOGV("RefreshKeys: id=%ld", static_cast(oec_session_id_)); + LOGV("RefreshKeys: id=%lu", oec_session_id_); OEMCryptoResult refresh_sts; M_TIME(refresh_sts = OEMCrypto_RefreshKeys( oec_session_id_, msg, message.size(), @@ -958,7 +958,7 @@ bool CryptoSession::GenerateDerivedKeys(const std::string& message, bool CryptoSession::GenerateSignature(const std::string& message, std::string* signature) { - LOGV("GenerateSignature: id=%ld", (uint32_t)oec_session_id_); + LOGV("GenerateSignature: id=%lu", oec_session_id_); if (!signature) { LOGE("GenerateSignature: null signature string"); return false; @@ -996,7 +996,7 @@ bool CryptoSession::GenerateSignature(const std::string& message, bool CryptoSession::GenerateRsaSignature(const std::string& message, std::string* signature) { - LOGV("GenerateRsaSignature: id=%ld", (uint32_t)oec_session_id_); + LOGV("GenerateRsaSignature: id=%lu", oec_session_id_); if (!signature) { LOGE("GenerateRsaSignature: null signature string"); return false; @@ -1146,7 +1146,7 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) { } 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; *has_support = OEMCrypto_SupportsUsageTable(requested_security_level_); @@ -1154,8 +1154,8 @@ bool CryptoSession::UsageInformationSupport(bool* has_support) { } CdmResponseType CryptoSession::UpdateUsageInformation() { - LOGV("CryptoSession::UpdateUsageInformation: id=%ld", - (uint32_t)oec_session_id_); + LOGV("CryptoSession::UpdateUsageInformation: id=%lu", + oec_session_id_); AutoLock auto_lock(crypto_lock_); if (!initialized_) return UNKNOWN_ERROR; @@ -1175,7 +1175,7 @@ CdmResponseType CryptoSession::UpdateUsageInformation() { CdmResponseType CryptoSession::DeactivateUsageInformation( 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_); uint8_t* pst = reinterpret_cast( @@ -1183,7 +1183,7 @@ CdmResponseType CryptoSession::DeactivateUsageInformation( // TODO(fredgc or rfrias): make sure oec_session_id_ is valid. 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); switch (status) { @@ -1202,7 +1202,7 @@ CdmResponseType CryptoSession::GenerateUsageReport( const std::string& provider_session_token, std::string* usage_report, UsageDurationStatus* usage_duration_status, int64_t* seconds_since_started, 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) { LOGE("CryptoSession::GenerateUsageReport: usage_report parameter is null"); @@ -1293,7 +1293,7 @@ CdmResponseType CryptoSession::GenerateUsageReport( CdmResponseType CryptoSession::ReleaseUsageInformation( const std::string& message, const std::string& signature, 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_); if (usage_table_header_ != NULL) { @@ -1434,8 +1434,7 @@ bool CryptoSession::RewrapCertificate(const std::string& signed_message, const std::string& iv, const std::string& wrapping_key, std::string* wrapped_private_key) { - LOGV("CryptoSession::RewrapCertificate, session id=%ld", - static_cast(oec_session_id_)); + LOGV("CryptoSession::RewrapCertificate, session id=%lu", oec_session_id_); if (pre_provision_token_type_ == kClientTokenKeybox) { return RewrapDeviceRSAKey(signed_message, signature, nonce, private_key, iv, @@ -1448,8 +1447,8 @@ bool CryptoSession::RewrapCertificate(const std::string& signed_message, } else { LOGE( "CryptoSession::RewrapCertificate, Bad pre-provision type=%d: " - "session id=%ld", - pre_provision_token_type_, static_cast(oec_session_id_)); + "session id=%lu", + pre_provision_token_type_, oec_session_id_); return false; } } @@ -1460,8 +1459,7 @@ bool CryptoSession::RewrapDeviceRSAKey(const std::string& message, const std::string& enc_rsa_key, const std::string& rsa_key_iv, std::string* wrapped_rsa_key) { - LOGV("CryptoSession::RewrapDeviceRSAKey, session id=%ld", - static_cast(oec_session_id_)); + LOGV("CryptoSession::RewrapDeviceRSAKey, session id=%lu", oec_session_id_); const uint8_t* signed_msg = reinterpret_cast(message.data()); 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& wrapping_key, std::string* wrapped_private_key) { - LOGV("CryptoSession::RewrapDeviceRSAKey30, session id=%ld", - static_cast(oec_session_id_)); + LOGV("CryptoSession::RewrapDeviceRSAKey30, session id=%lu", + oec_session_id_); const uint8_t* signed_msg = reinterpret_cast(message.data()); const uint8_t* msg_private_key = NULL; @@ -1570,7 +1568,7 @@ bool CryptoSession::RewrapDeviceRSAKey30(const std::string& message, bool CryptoSession::GetHdcpCapabilities(HdcpCapability* current, HdcpCapability* max) { - LOGV("GetHdcpCapabilities: id=%ld", (uint32_t)oec_session_id_); + LOGV("GetHdcpCapabilities: id=%lu", oec_session_id_); if (!initialized_) return false; if (current == NULL || max == NULL) { LOGE( @@ -1594,7 +1592,7 @@ bool CryptoSession::GetHdcpCapabilities(HdcpCapability* current, bool CryptoSession::GetSupportedCertificateTypes( SupportedCertificateTypes* support) { - LOGV("GetSupportedCertificateTypes: id=%ld", (uint32_t)oec_session_id_); + LOGV("GetSupportedCertificateTypes: id=%lu", oec_session_id_); if (!initialized_) return false; if (support == NULL) { LOGE( @@ -1720,7 +1718,7 @@ CdmResponseType CryptoSession::GenericEncrypt(const std::string& in_buffer, const std::string& iv, CdmEncryptionAlgorithm algorithm, std::string* out_buffer) { - LOGV("GenericEncrypt: id=%ld", (uint32_t)oec_session_id_); + LOGV("GenericEncrypt: id=%lu", oec_session_id_); if (!out_buffer) { LOGE("CryptoSession::GenericEncrypt: out_buffer not provided"); return PARAMETER_NULL; @@ -1772,7 +1770,7 @@ CdmResponseType CryptoSession::GenericDecrypt(const std::string& in_buffer, const std::string& iv, CdmEncryptionAlgorithm algorithm, std::string* out_buffer) { - LOGV("GenericDecrypt: id=%ld", (uint32_t)oec_session_id_); + LOGV("GenericDecrypt: id=%lu", oec_session_id_); if (!out_buffer) { LOGE("CryptoSession::GenericDecrypt: out_buffer not provided"); return PARAMETER_NULL; @@ -1823,7 +1821,7 @@ CdmResponseType CryptoSession::GenericSign(const std::string& message, const std::string& key_id, CdmSigningAlgorithm algorithm, std::string* signature) { - LOGV("GenericSign: id=%ld", (uint32_t)oec_session_id_); + LOGV("GenericSign: id=%lu", oec_session_id_); if (!signature) { LOGE("CryptoSession::GenericSign: signature not provided"); return PARAMETER_NULL; @@ -1883,7 +1881,7 @@ CdmResponseType CryptoSession::GenericVerify(const std::string& message, const std::string& key_id, CdmSigningAlgorithm algorithm, 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); if (oec_algorithm == kInvalidAlgorithm) { @@ -1921,7 +1919,7 @@ CdmResponseType CryptoSession::GenericVerify(const std::string& message, CdmResponseType CryptoSession::GetUsageSupportType( 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) { LOGE("GetUsageSupportType: usage_support_type param not provided"); @@ -1953,7 +1951,7 @@ CdmResponseType CryptoSession::GetUsageSupportType( CdmResponseType CryptoSession::CreateUsageTableHeader( 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) { LOGE("CreateUsageTableHeader: usage_table_header param not provided"); @@ -1989,7 +1987,7 @@ CdmResponseType CryptoSession::CreateUsageTableHeader( CdmResponseType CryptoSession::LoadUsageTableHeader( 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( requested_security_level_, @@ -2024,7 +2022,7 @@ CdmResponseType CryptoSession::LoadUsageTableHeader( } 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) { LOGE("CreateUsageEntry: entry_number param not provided"); @@ -2050,7 +2048,7 @@ CdmResponseType CryptoSession::CreateUsageEntry(uint32_t* entry_number) { CdmResponseType CryptoSession::LoadUsageEntry( 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( oec_session_id_, entry_number, @@ -2079,7 +2077,7 @@ CdmResponseType CryptoSession::LoadUsageEntry( CdmResponseType CryptoSession::UpdateUsageEntry( 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) { LOGE("UpdateUsageEntry: usage_table_header param not provided"); @@ -2121,7 +2119,7 @@ CdmResponseType CryptoSession::UpdateUsageEntry( CdmResponseType CryptoSession::ShrinkUsageTableHeader( 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) { LOGE("ShrinkUsageTableHeader: usage_table_header param not provided"); @@ -2154,7 +2152,7 @@ CdmResponseType CryptoSession::ShrinkUsageTableHeader( } 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 = OEMCrypto_MoveEntry(oec_session_id_, new_entry_number); @@ -2219,7 +2217,7 @@ bool CryptoSession::CreateOldUsageEntry( CdmResponseType CryptoSession::CopyOldUsageEntry( 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( oec_session_id_, @@ -2237,7 +2235,7 @@ CdmResponseType CryptoSession::CopyOldUsageEntry( bool CryptoSession::GetAnalogOutputCapabilities(bool* can_support_output, bool* can_disable_output, 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_); if ((flags & OEMCrypto_Unknown_Analog_Output) != 0) return false;