SPOID
(This is a merge of go/wvgerrit/23182) This patch adds the framework for Stable Per-Origin Identifiers to the CDM. Calculating SPOIDs will be done on the client-side, and they are sent as part of the provisioning request. SPOIDs are also available to the app as the Device Unique ID, replacing the previous method of returning the actual Device Unique ID from the keybox / OEM certificate. Different SPOIDs must use separate storage, just as different origins already do. Support for this has been added to the Android adapter to the CDM Core. However, the code in the Android glue layer that would drive this behavior will be checked in in a separate change. As such, all Android devices will continue using the legacy behavior even after this patch goes in, until the glue layer code can be updated. Bug: 27101531 Test: CE CDM Unit Tests Test: Linux Jenkins Unit Tests Test: Android Unit Tests (with and without SPOIDs forced on) Test: Android GTS Tests Change-Id: Ia0caf890381cbcb97504d08b19aeab8b29bd07ae
This commit is contained in:
@@ -76,7 +76,10 @@ DrmPlugin::KeyStatusType ConvertFromCdmKeyStatus(CdmKeyStatus keyStatus) {
|
||||
|
||||
WVDrmPlugin::WVDrmPlugin(const sp<WvContentDecryptionModule>& cdm,
|
||||
WVGenericCryptoInterface* crypto)
|
||||
: mCDM(cdm), mCrypto(crypto), mOrigin(), mCryptoSessions() {}
|
||||
: mCDM(cdm),
|
||||
mCrypto(crypto),
|
||||
mCryptoSessions(),
|
||||
mCdmIdentifier(kDefaultCdmIdentifier) {}
|
||||
|
||||
WVDrmPlugin::~WVDrmPlugin() {
|
||||
typedef map<CdmSessionId, CryptoSession>::iterator mapIterator;
|
||||
@@ -94,7 +97,7 @@ WVDrmPlugin::~WVDrmPlugin() {
|
||||
status_t WVDrmPlugin::openSession(Vector<uint8_t>& sessionId) {
|
||||
CdmSessionId cdmSessionId;
|
||||
CdmResponseType res =
|
||||
mCDM->OpenSession("com.widevine", &mPropertySet, determineOrigin(), this,
|
||||
mCDM->OpenSession("com.widevine", &mPropertySet, mCdmIdentifier, this,
|
||||
&cdmSessionId);
|
||||
|
||||
if (!isCdmResponseTypeSuccess(res)) {
|
||||
@@ -222,7 +225,7 @@ status_t WVDrmPlugin::getKeyRequest(
|
||||
CdmKeyRequest keyRequest;
|
||||
CdmResponseType res = mCDM->GenerateKeyRequest(
|
||||
cdmSessionId, cdmKeySetId, cdmInitDataType, processedInitData,
|
||||
cdmLicenseType, cdmParameters, &mPropertySet, determineOrigin(),
|
||||
cdmLicenseType, cdmParameters, &mPropertySet, mCdmIdentifier,
|
||||
&keyRequest);
|
||||
|
||||
*keyRequestType = ConvertFromCdmKeyRequestType(keyRequest.type);
|
||||
@@ -346,7 +349,7 @@ status_t WVDrmPlugin::getProvisionRequest(const String8& cert_type,
|
||||
|
||||
CdmResponseType res = mCDM->GetProvisioningRequest(cdmCertType,
|
||||
cdmCertAuthority,
|
||||
determineOrigin(),
|
||||
mCdmIdentifier,
|
||||
&cdmProvisionRequest,
|
||||
&cdmDefaultUrl);
|
||||
|
||||
@@ -365,13 +368,14 @@ status_t WVDrmPlugin::provideProvisionResponse(
|
||||
Vector<uint8_t>& wrapped_key) {
|
||||
CdmProvisioningResponse cdmResponse(response.begin(), response.end());
|
||||
if (cdmResponse == kSpecialUnprovisionResponse) {
|
||||
const std::string origin = determineOrigin();
|
||||
if (origin == EMPTY_ORIGIN) return kErrorNoOriginSpecified;
|
||||
return unprovision(origin);
|
||||
if (mCdmIdentifier == kDefaultCdmIdentifier) {
|
||||
return kErrorNoOriginSpecified;
|
||||
}
|
||||
return unprovision(mCdmIdentifier);
|
||||
} else {
|
||||
string cdmCertificate;
|
||||
string cdmWrappedKey;
|
||||
CdmResponseType res = mCDM->HandleProvisioningResponse(determineOrigin(),
|
||||
CdmResponseType res = mCDM->HandleProvisioningResponse(mCdmIdentifier,
|
||||
cdmResponse,
|
||||
&cdmCertificate,
|
||||
&cdmWrappedKey);
|
||||
@@ -385,7 +389,7 @@ status_t WVDrmPlugin::provideProvisionResponse(
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::unprovisionDevice() {
|
||||
return unprovision(EMPTY_ORIGIN);
|
||||
return unprovision(kDefaultCdmIdentifier);
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::getSecureStop(const Vector<uint8_t>& ssid,
|
||||
@@ -483,7 +487,7 @@ status_t WVDrmPlugin::getPropertyString(const String8& name,
|
||||
} else if (name == "appId") {
|
||||
value = mPropertySet.app_id().c_str();
|
||||
} else if (name == "origin") {
|
||||
value = mOrigin.c_str();
|
||||
value = mCdmIdentifier.origin.c_str();
|
||||
} else {
|
||||
ALOGE("App requested unknown string property %s", name.string());
|
||||
return android::ERROR_DRM_CANNOT_HANDLE;
|
||||
@@ -570,11 +574,11 @@ status_t WVDrmPlugin::setPropertyString(const String8& name,
|
||||
return kErrorSessionIsOpen;
|
||||
}
|
||||
} else if (name == "origin") {
|
||||
if (mCryptoSessions.size() == 0) {
|
||||
mOrigin = value.string();
|
||||
} else {
|
||||
if (mCryptoSessions.size() != 0) {
|
||||
ALOGE("App tried to set the origin while sessions are opened.");
|
||||
return kErrorSessionIsOpen;
|
||||
} else {
|
||||
mCdmIdentifier.origin = value.string();
|
||||
}
|
||||
} else {
|
||||
ALOGE("App set unknown string property %s", name.string());
|
||||
@@ -977,9 +981,9 @@ bool WVDrmPlugin::initDataResemblesPSSH(const Vector<uint8_t>& initData) {
|
||||
return id == kPsshTag;
|
||||
}
|
||||
|
||||
status_t WVDrmPlugin::unprovision(const std::string& origin) {
|
||||
CdmResponseType res1 = mCDM->Unprovision(kSecurityLevelL1, origin);
|
||||
CdmResponseType res3 = mCDM->Unprovision(kSecurityLevelL3, origin);
|
||||
status_t WVDrmPlugin::unprovision(const CdmIdentifier& identifier) {
|
||||
CdmResponseType res1 = mCDM->Unprovision(kSecurityLevelL1, identifier);
|
||||
CdmResponseType res3 = mCDM->Unprovision(kSecurityLevelL3, identifier);
|
||||
if (!isCdmResponseTypeSuccess(res1))
|
||||
{
|
||||
return mapCdmResponseType(res1);
|
||||
@@ -990,8 +994,4 @@ status_t WVDrmPlugin::unprovision(const std::string& origin) {
|
||||
}
|
||||
}
|
||||
|
||||
const char* WVDrmPlugin::determineOrigin() const {
|
||||
return mOrigin.empty() ? EMPTY_ORIGIN : mOrigin.c_str();
|
||||
}
|
||||
|
||||
} // namespace wvdrm
|
||||
|
||||
Reference in New Issue
Block a user