Snap for 4610834 from aef1f6f48e to pi-release

Change-Id: Ied548dcb6a2a814fe640db546fcd41cf6d64b1b2
This commit is contained in:
android-build-team Robot
2018-02-18 08:26:34 +00:00
22 changed files with 113 additions and 98 deletions

View File

@@ -43,7 +43,7 @@ class SubLicenseKeySession : public KeySession {
CdmCipherMode* cipher_mode,
const std::string& srm_requirement);
OEMCryptoResult LoadEntitledContentKeys(const std::vector<CryptoKey>& keys) {
OEMCryptoResult LoadEntitledContentKeys(const std::vector<CryptoKey>& /*keys*/) {
return OEMCrypto_ERROR_INVALID_CONTEXT;
}
@@ -92,4 +92,4 @@ class SubLicenseKeySession : public KeySession {
} // namespace wvcdm
#endif // WVCDM_CORE_SUBLICENSE_KEY_SESSSION_H_
#endif // WVCDM_CORE_SUBLICENSE_KEY_SESSSION_H_

View File

@@ -319,6 +319,8 @@ enum CdmResponseType {
LICENSE_REQUEST_INVALID_SUBLICENSE = 277,
CERT_PROVISIONING_EMPTY_SERVICE_CERTIFICATE = 278,
LOAD_SYSTEM_ID_ERROR = 279,
INSUFFICIENT_CRYPTO_RESOURCES_4 = 280,
INSUFFICIENT_CRYPTO_RESOURCES_5 = 281,
};
enum CdmKeyStatus {

View File

@@ -586,7 +586,7 @@ CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
open_sessions_stream << number_of_open_sessions;
*query_response = open_sessions_stream.str();
} else if (query_token == QUERY_KEY_MAX_NUMBER_OF_SESSIONS) {
size_t maximum_number_of_sessions;
size_t maximum_number_of_sessions = 0;
if (!crypto_session.GetMaxNumberOfSessions(&maximum_number_of_sessions)) {
LOGW("CdmEngine::QueryStatus: GetMaxNumberOfOpenSessions failed");
return UNKNOWN_ERROR;

View File

@@ -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<CryptoSessionId>(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);
@@ -821,7 +821,7 @@ CdmResponseType CryptoSession::LoadKeys(
result = KEY_ADDED;
} else if (OEMCrypto_ERROR_TOO_MANY_KEYS == sts) {
LOGE("CryptoSession::LoadKeys: OEMCrypto_LoadKeys error=%d", sts);
result = INSUFFICIENT_CRYPTO_RESOURCES;
result = INSUFFICIENT_CRYPTO_RESOURCES_4;
} else if (OEMCrypto_ERROR_USAGE_TABLE_UNRECOVERABLE == sts) {
// Handle vendor specific error
LOGE("CryptoSession::LoadKeys: OEMCrypto_LoadKeys error=%d", sts);
@@ -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<const uint8_t*>(wrapped_key.data()),
@@ -905,7 +905,7 @@ bool CryptoSession::RefreshKeys(const std::string& message,
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;
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;
@@ -1128,7 +1128,7 @@ CdmResponseType CryptoSession::Decrypt(const CdmDecryptionParameters& params) {
case OEMCrypto_SUCCESS:
return NO_ERROR;
case OEMCrypto_ERROR_INSUFFICIENT_RESOURCES:
return INSUFFICIENT_CRYPTO_RESOURCES;
return INSUFFICIENT_CRYPTO_RESOURCES_5;
case OEMCrypto_ERROR_KEY_EXPIRED:
return NEED_KEY;
case OEMCrypto_ERROR_INVALID_SESSION:
@@ -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<uint8_t*>(
@@ -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<uint32_t>(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<uint32_t>(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<uint32_t>(oec_session_id_));
LOGV("CryptoSession::RewrapDeviceRSAKey, session id=%lu", oec_session_id_);
const uint8_t* signed_msg = reinterpret_cast<const uint8_t*>(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<uint32_t>(oec_session_id_));
LOGV("CryptoSession::RewrapDeviceRSAKey30, session id=%lu",
oec_session_id_);
const uint8_t* signed_msg = reinterpret_cast<const uint8_t*>(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(
@@ -1658,7 +1656,7 @@ bool CryptoSession::GetMaxNumberOfSessions(size_t* max) {
return false;
}
size_t max_sessions;
size_t max_sessions = 0;
OEMCryptoResult status = OEMCrypto_GetMaxNumberOfSessions(
requested_security_level_, &max_sessions);
if (OEMCrypto_SUCCESS != status) {
@@ -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;

View File

@@ -759,10 +759,10 @@ class Adapter {
OEMCrypto_INITIALIZED_USING_L3_COULD_NOT_OPEN_FACTORY_KEYBOX);
return false;
}
uint8_t keybox[size];
ssize_t size_read = file->Read(reinterpret_cast<char*>(keybox), size);
std::vector<uint8_t> keybox(size);
ssize_t size_read = file->Read(reinterpret_cast<char*>(&keybox[0]), size);
file->Close();
if (level1_.InstallKeybox(keybox, size) != OEMCrypto_SUCCESS) {
if (level1_.InstallKeybox(&keybox[0], size_read) != OEMCrypto_SUCCESS) {
LOGE("Could NOT install keybox from %s. Falling Back to L3.",
filename.c_str());
level1_.Terminate();

View File

@@ -574,6 +574,12 @@ void PrintTo(const enum CdmResponseType& value, ::std::ostream* os) {
case LOAD_SYSTEM_ID_ERROR:
*os << "LOAD_SYSTEM_ID_ERROR";
break;
case INSUFFICIENT_CRYPTO_RESOURCES_4:
*os << "INSUFFICIENT_CRYPTO_RESOURCES_4";
break;
case INSUFFICIENT_CRYPTO_RESOURCES_5:
*os << "INSUFFICIENT_CRYPTO_RESOURCES_5";
break;
default:
*os << "Unknown CdmResponseType";
break;

View File

@@ -94,7 +94,8 @@ inline void AppendFieldNames(std::vector<std::string>* field_name_vector,
template <bool>
struct CompileAssert {};
#define COMPILE_ASSERT(expr, msg) \
typedef util::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1]
typedef util::CompileAssert<(bool(expr))> msg[bool(expr) ? 1 : -1] \
__attribute__((unused))
template <typename T> struct is_unused { static const bool value = false; };
template <> struct is_unused<Unused> { static const bool value = true; };
@@ -125,4 +126,3 @@ class FirstUnusedType {
} // namespace wvcdm
#endif // WVCDM_METRICS_FIELD_TUPLES_H_

View File

@@ -49,7 +49,7 @@ void Log(const char* file, const char* function, int line, LogPriority level,
int len = snprintf(buf, LOG_BUF_SIZE, "[%s(%d):%s] ", filename, line,
function);
if (len < 0) len = 0;
if (len < sizeof(buf)) {
if (static_cast<unsigned int>(len) < sizeof(buf)) {
va_list ap;
va_start(ap, format);
vsnprintf(buf+len, LOG_BUF_SIZE-len, format, ap);

View File

@@ -30,12 +30,12 @@ namespace {
// HTTP response codes.
const int kHttpOk = 200;
const int kHttpBadRequest = 400;
const int kHttpInternalServerError = 500;
// The following two responses are unused, but left here for human debuggers.
// const int kHttpBadRequest = 400;
// const int kHttpInternalServerError = 500;
const uint32_t kMinute = 60;
const uint32_t kClockTolerance = 10;
const uint32_t kTwoMinutes = 120;
const uint32_t kMaxUsageTableSize = 50;
@@ -932,7 +932,6 @@ TEST_F(WvCdmExtendedDurationTest, DecryptionCloseSessionConcurrencyTest) {
TEST_F(WvCdmExtendedDurationTest, UsageOverflowTest) {
Provision();
SubSampleInfo* data = &kEncryptedStreamingClip5SubSample;
TestWvCdmClientPropertySet client_property_set;
TestWvCdmClientPropertySet* property_set = NULL;
@@ -959,19 +958,22 @@ TEST_F(WvCdmExtendedDurationTest, UsageOverflowTest) {
decryptor_.CloseSession(session_id_);
}
uint32_t num_usage_info = 0;
CdmUsageInfo usage_info;
CdmUsageInfoReleaseMessage release_msg;
CdmResponseType status = decryptor_.GetUsageInfo(
"", kDefaultCdmIdentifier, &usage_info);
EXPECT_EQ(usage_info.empty() ? NO_ERROR : KEY_MESSAGE, status);
int error_count = 0;
while (usage_info.size() > 0) {
for (size_t i = 0; i < usage_info.size(); ++i) {
release_msg =
GetUsageInfoResponse(g_license_server, g_client_auth, usage_info[i]);
EXPECT_EQ(NO_ERROR, decryptor_.ReleaseUsageInfo(release_msg,
kDefaultCdmIdentifier));
kDefaultCdmIdentifier))
<< i << "/" << usage_info.size() << " (err " << (error_count++) << ")"
<< release_msg;
}
ASSERT_LE(error_count, 100); // Give up after 100 failures.
status = decryptor_.GetUsageInfo("", kDefaultCdmIdentifier, &usage_info);
switch (status) {
case KEY_MESSAGE: EXPECT_FALSE(usage_info.empty()); break;
@@ -1003,9 +1005,6 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnTimerEvent) {
uint32_t initial_open_sessions =
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS);
uint32_t max_sessions =
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_MAX_NUMBER_OF_SESSIONS);
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
&session_id_);
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
@@ -1059,9 +1058,6 @@ TEST_F(WvCdmExtendedDurationTest, AutomatedOfflineSessionReleaseOnOpenSession) {
uint32_t initial_open_sessions =
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_NUMBER_OF_OPEN_SESSIONS);
uint32_t max_sessions =
QueryStatus(kLevelDefault, wvcdm::QUERY_KEY_MAX_NUMBER_OF_SESSIONS);
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
&session_id_);
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
@@ -1398,12 +1394,12 @@ TEST_P(WvCdmStreamingUsageReportTest, UsageTest) {
decryptor_.CloseSession(session_id_);
// Create usage report and validate
uint32_t num_usage_info = 0;
CdmUsageInfo usage_info;
CdmUsageInfoReleaseMessage release_msg;
CdmResponseType status = decryptor_.GetUsageInfo(
"", kDefaultCdmIdentifier, &usage_info);
EXPECT_EQ(usage_info.empty() ? NO_ERROR : KEY_MESSAGE, status);
int error_count = 0;
while (usage_info.size() > 0) {
for (size_t i = 0; i < usage_info.size(); ++i) {
ValidateReleaseRequest(usage_info[i],
@@ -1412,9 +1408,12 @@ TEST_P(WvCdmStreamingUsageReportTest, UsageTest) {
expected_seconds_since_last_playback);
release_msg =
GetUsageInfoResponse(g_license_server, g_client_auth, usage_info[i]);
EXPECT_EQ(NO_ERROR, decryptor_.ReleaseUsageInfo(release_msg,
kDefaultCdmIdentifier));
EXPECT_EQ(NO_ERROR,
decryptor_.ReleaseUsageInfo(release_msg, kDefaultCdmIdentifier))
<< i << "/" << usage_info.size() << " (err " << (error_count++) << ")"
<< release_msg;
}
ASSERT_LE(error_count, 100); // Give up after 100 failures.
status = decryptor_.GetUsageInfo("", kDefaultCdmIdentifier, &usage_info);
switch (status) {
case KEY_MESSAGE:

View File

@@ -47,12 +47,11 @@ namespace {
#define N_ELEM(a) (sizeof(a) / sizeof(a[0]))
const char kPathDelimiter = '/';
// HTTP response codes.
const int kHttpOk = 200;
const int kHttpBadRequest = 400;
const int kHttpInternalServerError = 500;
// The following two responses are unused, but left here for human debuggers.
// const int kHttpBadRequest = 400;
// const int kHttpInternalServerError = 500;
// Default license server, can be configured using --server command line option
// Default key id (pssh), can be configured using --keyid command line option

View File

@@ -42,8 +42,6 @@ namespace {
#define N_ELEM(a) (sizeof(a)/sizeof(a[0]))
const char kPathDelimiter = '/';
// HTTP response codes.
const int kHttpOk = 200;
const int kHttpBadRequest = 400;
@@ -1054,14 +1052,14 @@ Cenc30SampleInfo kCenc30CbcsKey33Sample = {
true, wvcdm::a2bs_hex("30303030303030303030303030303033"),
wvcdm::a2bs_hex("9FBE45DD47DA7EBA09A3E24CBA95C9AF"),
wvcdm::a2bs_hex(
"4392E38BAE263267ED15394DE349AD1577F37B7D906C3A61536EE5A288F66F22F2"
"F5098964B7F2860A848C3C4FD30E538B3BCD2E700DC3FBC1657A6E9EAE44DE97C4"
"6F27C82A49198EE185D92931F093C3342FDBF6CF8203E18CCDC4B88E79C95EC052"
"3FD10F9409945349169FAA8F6A37179D2BEDC04A158A09BCBF742DA05245428788"
"E972B9B465FED5849AEDDB74B8919673C0C8829B5B062A38B3146CB8D497F03A4D"
"5C0A1D463504C1F116A811EF32503695B8FF78D9E93CDF7B2F7493E8043D4DE110"
"FE1D342D1C0175BF1466A544FC0D02DD0E314098256DD65B48098323C3AED9B7E0"
"CF260DBC5A0F09A46E39AE5E26A66ABFA52CBA26FBA83975E4"),
"E300F37FEB0CDD9F276E67B971FF423003F3BF21DCF6100BA453A473A4522A19A8"
"2E098AA25511011D386FC7092FE3B407DF2BEB3AD57D5E1178F041E3FCABE25193"
"3F5EE35670CEB96BA3DAF922484F9A37773EF75D4B17FACC80B475004A6229AB4C"
"DFFA426468E578DE6A0285D942CDE476E06FF907D03F382552C2E14399C3FC2D21"
"9A59819FFF837EBC88A9F83A42D37F48ED8564EB40AC3BA8A6D2634A81F04FC2F1"
"379A45869036FD72B39C88222646AB7486A8416D78AB75951EB87ED1E16DF69209"
"A6966AC93C7BB65B85E429357A732CBC75F6EFB1781859FB771D60D11EB381D9CA"
"63F793507B02207810773FCABED0240E5BEEAD30116014E481"),
wvcdm::a2bs_hex(
"E7C566D86E98C36D2DCA54A966E7B469B6094B9201F200932F8EB5E1A94FB0B977"
"FAB8DFDAD57C677E279615F4EAFA872CA8EFF83179E4DE2AB78E6B41A860C42203"
@@ -2834,13 +2832,17 @@ TEST_F(WvCdmRequestLicenseTest, UsageInfoRetryTest) {
// before release.
status = decryptor_.GetUsageInfo(app_id, kDefaultCdmIdentifier, &usage_info);
EXPECT_EQ(usage_info.empty() ? NO_ERROR : KEY_MESSAGE, status);
int error_count = 0;
while (usage_info.size() > 0) {
for (size_t i = 0; i < usage_info.size(); ++i) {
release_msg =
GetUsageInfoResponse(g_license_server, g_client_auth, usage_info[i]);
EXPECT_EQ(NO_ERROR, decryptor_.ReleaseUsageInfo(release_msg,
kDefaultCdmIdentifier));
kDefaultCdmIdentifier))
<< i << "/" << usage_info.size() << " (err " << (error_count++) << ")"
<< release_msg;
}
ASSERT_LE(error_count, 100); // Give up after 100 failures.
status = decryptor_.GetUsageInfo(
app_id, kDefaultCdmIdentifier, &usage_info);
switch (status) {
@@ -2927,14 +2929,17 @@ TEST_P(WvCdmUsageInfoTest, UsageInfo) {
decryptor_.GetUsageInfo(usage_info_data->app_id, kDefaultCdmIdentifier,
&usage_info);
EXPECT_EQ(usage_info.empty() ? NO_ERROR : KEY_MESSAGE, status);
int error_count = 0;
while (usage_info.size() > 0) {
for (size_t i = 0; i < usage_info.size(); ++i) {
release_msg =
GetUsageInfoResponse(g_license_server, g_client_auth, usage_info[i]);
EXPECT_EQ(
NO_ERROR,
decryptor_.ReleaseUsageInfo(release_msg, kDefaultCdmIdentifier));
EXPECT_EQ(NO_ERROR,
decryptor_.ReleaseUsageInfo(release_msg, kDefaultCdmIdentifier))
<< i << "/" << usage_info.size() << " (err " << (error_count++) << ")"
<< release_msg;
}
ASSERT_LE(error_count, 100); // Give up after 100 failures.
status = decryptor_.GetUsageInfo(usage_info_data->app_id,
kDefaultCdmIdentifier, &usage_info);
EXPECT_EQ(usage_info.empty() ? NO_ERROR : KEY_MESSAGE, status);

View File

@@ -260,10 +260,12 @@ enum {
kLicenseRequestInvalidSublicense = ERROR_DRM_VENDOR_MIN + 269,
kCertProvisioningEmptyServiceCertificate = ERROR_DRM_VENDOR_MIN + 270,
kLoadSystemIdError = ERROR_DRM_VENDOR_MIN + 271,
kInsufficientCryptoResources4 = ERROR_DRM_VENDOR_MIN + 272,
kInsufficientCryptoResources5 = ERROR_DRM_VENDOR_MIN + 273,
// This should always follow the last error code.
// The offset value should be updated each time a new error code is added.
kErrorWVDrmMaxErrorUsed = ERROR_DRM_VENDOR_MIN + 271,
kErrorWVDrmMaxErrorUsed = ERROR_DRM_VENDOR_MIN + 273,
// Used by crypto test mode
kErrorTestMode = ERROR_DRM_VENDOR_MAX,

View File

@@ -501,6 +501,10 @@ static android::status_t mapCdmResponseType(wvcdm::CdmResponseType res) {
return kCertProvisioningEmptyServiceCertificate;
case wvcdm::LOAD_SYSTEM_ID_ERROR:
return kLoadSystemIdError;
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_4:
return kInsufficientCryptoResources4;
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_5:
return kInsufficientCryptoResources5;
}
// Return here instead of as a default case so that the compiler will warn

View File

@@ -234,6 +234,8 @@ static Status mapCdmResponseType(wvcdm::CdmResponseType res) {
case wvcdm::INVALID_PARAMETERS_ENG_17:
case wvcdm::INVALID_PARAMETERS_ENG_18:
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_3:
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_4:
case wvcdm::INSUFFICIENT_CRYPTO_RESOURCES_5:
case wvcdm::CREATE_USAGE_ENTRY_UNKNOWN_ERROR:
case wvcdm::LOAD_USAGE_ENTRY_GENERATION_SKEW:
case wvcdm::LOAD_USAGE_ENTRY_SIGNATURE_FAILURE:

View File

@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
-DDYNAMIC_ADAPTER \
-Wno-unused
-Wno-unused \
-Wno-unused-parameter
LOCAL_C_INCLUDES := \
system/core/include \
vendor/widevine/libwvdrmengine/cdm/core/include \

View File

@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
-DDYNAMIC_ADAPTER \
-Wno-unused
-Wno-unused \
-Wno-unused-parameter
LOCAL_C_INCLUDES := \
system/core/include \
vendor/widevine/libwvdrmengine/cdm/core/include \

View File

@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
-DDYNAMIC_ADAPTER \
-Wno-unused
-Wno-unused \
-Wno-unused-parameter
LOCAL_C_INCLUDES := \
system/core/include \
vendor/widevine/libwvdrmengine/cdm/core/include \

View File

@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
-DDYNAMIC_ADAPTER \
-Wno-unused
-Wno-unused \
-Wno-unused-parameter
LOCAL_C_INCLUDES := \
system/core/include \
vendor/widevine/libwvdrmengine/cdm/core/include \

View File

@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
-DDYNAMIC_ADAPTER \
-Wno-unused
-Wno-unused \
-Wno-unused-parameter
LOCAL_C_INCLUDES := \
system/core/include \
vendor/widevine/libwvdrmengine/cdm/core/include \

View File

@@ -2,7 +2,8 @@ LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS := \
-DDYNAMIC_ADAPTER \
-Wno-unused
-Wno-unused \
-Wno-unused-parameter
LOCAL_C_INCLUDES := \
system/core/include \
vendor/widevine/libwvdrmengine/cdm/core/include \

View File

@@ -475,7 +475,6 @@ TEST_F(WVCryptoPluginTest, CommunicatesSecureBufferRequest) {
WVCryptoPlugin plugin(sessionId, kSessionIdSize, cdm.get());
uint32_t bytesWritten = 0;
Status err = Status::OK;
std::string errorDetailMessage;
DestinationBuffer hDestination;
hDestination.type = BufferType::SHARED_MEMORY;
@@ -590,7 +589,6 @@ TEST_F(WVCryptoPluginTest, SetsFlagsForMinimumSubsampleRuns) {
WVCryptoPlugin plugin(sessionId, kSessionIdSize, cdm.get());
uint32_t bytesWritten = 0;
Status err = Status::OK;
std::string errorDetailMessage;
DestinationBuffer hDestination;
hDestination.type = BufferType::SHARED_MEMORY;
@@ -705,7 +703,6 @@ TEST_F(WVCryptoPluginTest, AllowsSessionIdChanges) {
WVCryptoPlugin plugin(blank, 0, cdm.get());
uint32_t bytesWritten = 0;
Status err = Status::OK;
std::string errorDetailMessage;
DestinationBuffer hDestination;
hDestination.type = BufferType::SHARED_MEMORY;

View File

@@ -730,7 +730,6 @@ TEST_F(WVDrmPluginTest, QueriesKeyStatus) {
for (std::map<std::string, std::string>::iterator itr =
expectedLicenseStatus.begin();
itr != expectedLicenseStatus.end(); ++itr) {
const std::string& key = itr->first;
keyValuePair.value = hLicenseStatus[i++].value;
EXPECT_EQ(itr->second.c_str(), std::string(keyValuePair.value.c_str()));
}
@@ -1409,7 +1408,6 @@ TEST_F(WVDrmPluginTest, FailsGenericMethodsWithoutAnAlgorithmSet) {
std::vector<uint8_t> input;
std::vector<uint8_t> iv;
std::vector<uint8_t> output;
bool match;
// Provide expected behavior to support session creation
EXPECT_CALL(*cdm, OpenSession(StrEq("com.widevine"), _, _, _, _))
@@ -1697,7 +1695,6 @@ TEST_F(WVDrmPluginTest, CallsGenericVerify) {
message.assign(messageRaw, messageRaw + kDataSize);
std::vector<uint8_t> signature;
signature.assign(signatureRaw, signatureRaw + kSignatureSize);
bool match;
{
InSequence calls;
@@ -2364,7 +2361,6 @@ TEST_F(WVDrmPluginTest, CanSetSessionSharing) {
}
WVDrmPlugin plugin(cdm.get(), appPackageName, &crypto, false);
Status res;
// Test turning on session sharing
Status status = plugin.setPropertyString(hidl_string("sessionSharing"),
@@ -2461,4 +2457,3 @@ TEST_F(WVDrmPluginTest, AllowsStoringOfSessionSharingId) {
} // namespace drm
} // namespace hardware
} // namespace wvdrm