Merge "Device unable to recover from a bad certificate" into jb-mr2-dev
This commit is contained in:
@@ -18,10 +18,12 @@ namespace wvcdm {
|
|||||||
|
|
||||||
class CdmSession {
|
class CdmSession {
|
||||||
public:
|
public:
|
||||||
CdmSession() : session_id_(GenerateSessionId()), license_received_(false) {}
|
CdmSession() : session_id_(GenerateSessionId()), license_received_(false),
|
||||||
|
reinitialize_session_(false) {}
|
||||||
~CdmSession() {}
|
~CdmSession() {}
|
||||||
|
|
||||||
CdmResponseType Init();
|
CdmResponseType Init();
|
||||||
|
CdmResponseType ReInit();
|
||||||
|
|
||||||
bool DestroySession();
|
bool DestroySession();
|
||||||
|
|
||||||
@@ -93,6 +95,7 @@ class CdmSession {
|
|||||||
CryptoSession* crypto_session_;
|
CryptoSession* crypto_session_;
|
||||||
PolicyEngine policy_engine_;
|
PolicyEngine policy_engine_;
|
||||||
bool license_received_;
|
bool license_received_;
|
||||||
|
bool reinitialize_session_;
|
||||||
|
|
||||||
KeyId key_id_;
|
KeyId key_id_;
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ CdmResponseType CdmSession::Init() {
|
|||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CdmResponseType CdmSession::ReInit() {
|
||||||
|
DestroySession();
|
||||||
|
return Init();
|
||||||
|
}
|
||||||
|
|
||||||
bool CdmSession::DestroySession() {
|
bool CdmSession::DestroySession() {
|
||||||
if (crypto_session_) {
|
if (crypto_session_) {
|
||||||
delete crypto_session_;
|
delete crypto_session_;
|
||||||
@@ -68,6 +73,16 @@ CdmResponseType CdmSession::GenerateKeyRequest(
|
|||||||
CdmAppParameterMap& app_parameters,
|
CdmAppParameterMap& app_parameters,
|
||||||
CdmKeyMessage* key_request,
|
CdmKeyMessage* key_request,
|
||||||
std::string* server_url) {
|
std::string* server_url) {
|
||||||
|
|
||||||
|
if (reinitialize_session_) {
|
||||||
|
CdmResponseType sts = ReInit();
|
||||||
|
if (sts != NO_ERROR) {
|
||||||
|
return sts;
|
||||||
|
}
|
||||||
|
reinitialize_session_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!crypto_session_) {
|
if (!crypto_session_) {
|
||||||
LOGW("CdmSession::GenerateKeyRequest: Invalid crypto session");
|
LOGW("CdmSession::GenerateKeyRequest: Invalid crypto session");
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
@@ -90,9 +105,11 @@ CdmResponseType CdmSession::GenerateKeyRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Properties::use_certificates_as_identification()) {
|
if (Properties::use_certificates_as_identification()) {
|
||||||
if (!crypto_session_->LoadCertificatePrivateKey(wrapped_key_))
|
if (!crypto_session_->LoadCertificatePrivateKey(wrapped_key_)) {
|
||||||
|
reinitialize_session_ = true;
|
||||||
return NEED_PROVISIONING;
|
return NEED_PROVISIONING;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!license_parser_.PrepareKeyRequest(pssh_data,
|
if (!license_parser_.PrepareKeyRequest(pssh_data,
|
||||||
license_type,
|
license_type,
|
||||||
|
|||||||
Reference in New Issue
Block a user