Close session after provisioning
Merge of CDM change: https://widevine-internal-review.googlesource.com/#/c/10691/ This prevents the provisioning session from being created unless the device needs provisioning. And then, after provisioning, it closes the session it had previously opened. b/15782159 CertificateProvisioning object keeps unused CryptoSession Change-Id: Ic52ed864fa47c7ba50b7ca4d9fea1e74930228e9
This commit is contained in:
@@ -120,7 +120,7 @@ class CdmEngine {
|
|||||||
// instance variables
|
// instance variables
|
||||||
CdmSessionMap sessions_;
|
CdmSessionMap sessions_;
|
||||||
CdmReleaseKeySetMap release_key_sets_;
|
CdmReleaseKeySetMap release_key_sets_;
|
||||||
CertificateProvisioning cert_provisioning_;
|
scoped_ptr<CertificateProvisioning> cert_provisioning_;
|
||||||
SecurityLevel cert_provisioning_requested_security_level_;
|
SecurityLevel cert_provisioning_requested_security_level_;
|
||||||
|
|
||||||
static bool seeded_;
|
static bool seeded_;
|
||||||
|
|||||||
@@ -28,7 +28,8 @@ namespace wvcdm {
|
|||||||
bool CdmEngine::seeded_ = false;
|
bool CdmEngine::seeded_ = false;
|
||||||
|
|
||||||
CdmEngine::CdmEngine()
|
CdmEngine::CdmEngine()
|
||||||
: cert_provisioning_requested_security_level_(kLevelDefault),
|
: cert_provisioning_(NULL),
|
||||||
|
cert_provisioning_requested_security_level_(kLevelDefault),
|
||||||
usage_session_(NULL),
|
usage_session_(NULL),
|
||||||
last_usage_information_update_time(0) {
|
last_usage_information_update_time(0) {
|
||||||
Properties::Init();
|
Properties::Init();
|
||||||
@@ -459,12 +460,19 @@ CdmResponseType CdmEngine::GetProvisioningRequest(
|
|||||||
LOGE("CdmEngine::GetProvisioningRequest: invalid input parameters");
|
LOGE("CdmEngine::GetProvisioningRequest: invalid input parameters");
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
return cert_provisioning_.GetProvisioningRequest(
|
if (NULL == cert_provisioning_.get()) {
|
||||||
cert_provisioning_requested_security_level_,
|
cert_provisioning_.reset(new CertificateProvisioning());
|
||||||
cert_type,
|
}
|
||||||
cert_authority,
|
CdmResponseType ret = cert_provisioning_->GetProvisioningRequest(
|
||||||
request,
|
cert_provisioning_requested_security_level_,
|
||||||
default_url);
|
cert_type,
|
||||||
|
cert_authority,
|
||||||
|
request,
|
||||||
|
default_url);
|
||||||
|
if (ret != NO_ERROR) {
|
||||||
|
cert_provisioning_.reset(NULL); // Release resources.
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -480,20 +488,30 @@ CdmResponseType CdmEngine::HandleProvisioningResponse(
|
|||||||
std::string* wrapped_key) {
|
std::string* wrapped_key) {
|
||||||
if (response.empty()) {
|
if (response.empty()) {
|
||||||
LOGE("CdmEngine::HandleProvisioningResponse: Empty provisioning response.");
|
LOGE("CdmEngine::HandleProvisioningResponse: Empty provisioning response.");
|
||||||
|
cert_provisioning_.reset(NULL);
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
if (NULL == cert) {
|
if (NULL == cert) {
|
||||||
LOGE("CdmEngine::HandleProvisioningResponse: invalid certificate "
|
LOGE("CdmEngine::HandleProvisioningResponse: invalid certificate "
|
||||||
"destination");
|
"destination");
|
||||||
|
cert_provisioning_.reset(NULL);
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
if (NULL == wrapped_key) {
|
if (NULL == wrapped_key) {
|
||||||
LOGE("CdmEngine::HandleProvisioningResponse: invalid wrapped key "
|
LOGE("CdmEngine::HandleProvisioningResponse: invalid wrapped key "
|
||||||
"destination");
|
"destination");
|
||||||
|
cert_provisioning_.reset(NULL);
|
||||||
return UNKNOWN_ERROR;
|
return UNKNOWN_ERROR;
|
||||||
}
|
}
|
||||||
return cert_provisioning_.HandleProvisioningResponse(response, cert,
|
if (NULL == cert_provisioning_.get()) {
|
||||||
wrapped_key);
|
LOGE("CdmEngine::HandleProvisioningResponse: provisioning object missing.");
|
||||||
|
return UNKNOWN_ERROR;
|
||||||
|
}
|
||||||
|
CdmResponseType ret =
|
||||||
|
cert_provisioning_->HandleProvisioningResponse(response, cert,
|
||||||
|
wrapped_key);
|
||||||
|
cert_provisioning_.reset(NULL); // Release resources.
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CdmResponseType CdmEngine::Unprovision(CdmSecurityLevel security_level) {
|
CdmResponseType CdmEngine::Unprovision(CdmSecurityLevel security_level) {
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <arpa/inet.h> // needed for ntoh()
|
#include <arpa/inet.h> // needed for ntoh()
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "crypto_key.h"
|
#include "crypto_key.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user