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 {
|
||||
public:
|
||||
CdmSession() : session_id_(GenerateSessionId()), license_received_(false) {}
|
||||
CdmSession() : session_id_(GenerateSessionId()), license_received_(false),
|
||||
reinitialize_session_(false) {}
|
||||
~CdmSession() {}
|
||||
|
||||
CdmResponseType Init();
|
||||
CdmResponseType ReInit();
|
||||
|
||||
bool DestroySession();
|
||||
|
||||
@@ -93,6 +95,7 @@ class CdmSession {
|
||||
CryptoSession* crypto_session_;
|
||||
PolicyEngine policy_engine_;
|
||||
bool license_received_;
|
||||
bool reinitialize_session_;
|
||||
|
||||
KeyId key_id_;
|
||||
|
||||
|
||||
@@ -47,6 +47,11 @@ CdmResponseType CdmSession::Init() {
|
||||
return UNKNOWN_ERROR;
|
||||
}
|
||||
|
||||
CdmResponseType CdmSession::ReInit() {
|
||||
DestroySession();
|
||||
return Init();
|
||||
}
|
||||
|
||||
bool CdmSession::DestroySession() {
|
||||
if (crypto_session_) {
|
||||
delete crypto_session_;
|
||||
@@ -68,6 +73,16 @@ CdmResponseType CdmSession::GenerateKeyRequest(
|
||||
CdmAppParameterMap& app_parameters,
|
||||
CdmKeyMessage* key_request,
|
||||
std::string* server_url) {
|
||||
|
||||
if (reinitialize_session_) {
|
||||
CdmResponseType sts = ReInit();
|
||||
if (sts != NO_ERROR) {
|
||||
return sts;
|
||||
}
|
||||
reinitialize_session_ = false;
|
||||
}
|
||||
|
||||
|
||||
if (!crypto_session_) {
|
||||
LOGW("CdmSession::GenerateKeyRequest: Invalid crypto session");
|
||||
return UNKNOWN_ERROR;
|
||||
@@ -90,8 +105,10 @@ CdmResponseType CdmSession::GenerateKeyRequest(
|
||||
}
|
||||
|
||||
if (Properties::use_certificates_as_identification()) {
|
||||
if (!crypto_session_->LoadCertificatePrivateKey(wrapped_key_))
|
||||
if (!crypto_session_->LoadCertificatePrivateKey(wrapped_key_)) {
|
||||
reinitialize_session_ = true;
|
||||
return NEED_PROVISIONING;
|
||||
}
|
||||
}
|
||||
|
||||
if (!license_parser_.PrepareKeyRequest(pssh_data,
|
||||
|
||||
Reference in New Issue
Block a user