Respect Client Properties when reporting CDM Status

[ Merge from go/wvgerrit/14286 ]

CDM now reports status information associated with the specified security level.
Earlier information would be reported from the default security level.

b/18709693

Change-Id: I7a01e8ea9773b56951c207437ce85e567fd32b09
This commit is contained in:
Rahul Frias
2015-05-07 10:26:07 -07:00
parent 1c6b675f0c
commit d2e91faf8e
12 changed files with 110 additions and 30 deletions

View File

@@ -98,7 +98,8 @@ class CdmEngine {
const CdmKeyResponse& key_data);
// Query system information
virtual CdmResponseType QueryStatus(CdmQueryMap* info);
virtual CdmResponseType QueryStatus(SecurityLevel security_level,
CdmQueryMap* info);
// Query session information
virtual CdmResponseType QuerySessionStatus(const CdmSessionId& session_id,

View File

@@ -4,11 +4,10 @@
#define WVCDM_CORE_OEMCRYPTO_ADAPTER_H_
#include "OEMCryptoCENC.h"
#include "wv_cdm_types.h"
namespace wvcdm {
enum SecurityLevel { kLevelDefault, kLevel3 };
// This attempts to open a session at the desired security level.
// If one level is not available, the other will be used instead.
OEMCryptoResult OEMCrypto_OpenSession(OEMCrypto_SESSION* session,

View File

@@ -185,6 +185,7 @@ enum CdmResponseType {
CLIENT_ID_AES_ENCRYPT_ERROR,
CLIENT_ID_RSA_INIT_ERROR,
CLIENT_ID_RSA_ENCRYPT_ERROR,
INVALID_QUERY_STATUS,
};
enum CdmKeyStatus {
@@ -206,6 +207,11 @@ enum CdmLicenseType {
kLicenseTypeRelease
};
enum SecurityLevel {
kLevelDefault,
kLevel3
};
enum CdmSecurityLevel {
kSecurityLevelUninitialized,
kSecurityLevelL1,

View File

@@ -393,9 +393,14 @@ CdmResponseType CdmEngine::RenewKey(const CdmSessionId& session_id,
return KEY_ADDED;
}
CdmResponseType CdmEngine::QueryStatus(CdmQueryMap* key_info) {
CdmResponseType CdmEngine::QueryStatus(SecurityLevel security_level,
CdmQueryMap* key_info) {
LOGI("CdmEngine::QueryStatus");
CryptoSession crypto_session;
if (security_level == kLevel3) {
CdmResponseType status = crypto_session.Open(kLevel3);
if (NO_ERROR != status) return INVALID_QUERY_STATUS;
}
switch (crypto_session.GetSecurityLevel()) {
case kSecurityLevelL1:
(*key_info)[QUERY_KEY_SECURITY_LEVEL] = QUERY_VALUE_SECURITY_LEVEL_L1;