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:
@@ -7,6 +7,7 @@
|
||||
#include <gmock/gmock.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "cdm_identifier.h"
|
||||
#include "clock.h"
|
||||
#include "config_test_env.h"
|
||||
#include "device_files.h"
|
||||
@@ -275,8 +276,8 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
|
||||
EXPECT_EQ(KEY_MESSAGE, decryptor_.GenerateKeyRequest(
|
||||
session_id_, key_set_id_, "video/mp4", init_data,
|
||||
license_type, app_parameters, NULL, EMPTY_ORIGIN,
|
||||
&key_request));
|
||||
license_type, app_parameters, NULL,
|
||||
kDefaultCdmIdentifier, &key_request));
|
||||
EXPECT_EQ(kKeyRequestTypeInitial, key_request.type);
|
||||
key_msg_ = key_request.message;
|
||||
EXPECT_EQ(0u, key_request.url.size());
|
||||
@@ -293,8 +294,8 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
|
||||
EXPECT_EQ(KEY_MESSAGE, decryptor_.GenerateKeyRequest(
|
||||
session_id_, key_set_id_, "video/mp4", init_data,
|
||||
license_type, app_parameters, NULL, EMPTY_ORIGIN,
|
||||
&key_request));
|
||||
license_type, app_parameters, NULL,
|
||||
kDefaultCdmIdentifier, &key_request));
|
||||
|
||||
*server_url = key_request.url;
|
||||
key_msg_ = key_request.message;
|
||||
@@ -314,7 +315,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
EXPECT_EQ(expected_response, decryptor_.GenerateKeyRequest(
|
||||
session_id, key_set_id, "video/mp4", init_data,
|
||||
kLicenseTypeRelease, app_parameters, NULL,
|
||||
EMPTY_ORIGIN, &key_request));
|
||||
kDefaultCdmIdentifier, &key_request));
|
||||
|
||||
if (expected_response == KEY_MESSAGE) {
|
||||
key_msg_ = key_request.message;
|
||||
@@ -420,13 +421,15 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
}
|
||||
|
||||
void Unprovision() {
|
||||
EXPECT_EQ(NO_ERROR, decryptor_.Unprovision(kSecurityLevelL1, EMPTY_ORIGIN));
|
||||
EXPECT_EQ(NO_ERROR, decryptor_.Unprovision(kSecurityLevelL3, EMPTY_ORIGIN));
|
||||
EXPECT_EQ(NO_ERROR,
|
||||
decryptor_.Unprovision(kSecurityLevelL1, kDefaultCdmIdentifier));
|
||||
EXPECT_EQ(NO_ERROR,
|
||||
decryptor_.Unprovision(kSecurityLevelL3, kDefaultCdmIdentifier));
|
||||
}
|
||||
|
||||
void Provision() {
|
||||
CdmResponseType status =
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL,
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
switch (status) {
|
||||
case NO_ERROR:
|
||||
@@ -444,7 +447,7 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
std::string cert_authority, cert, wrapped_key;
|
||||
|
||||
status = decryptor_.GetProvisioningRequest(
|
||||
cert_type, cert_authority, EMPTY_ORIGIN, &key_msg_,
|
||||
cert_type, cert_authority, kDefaultCdmIdentifier, &key_msg_,
|
||||
&provisioning_server_url);
|
||||
EXPECT_EQ(NO_ERROR, status);
|
||||
if (NO_ERROR != status) return;
|
||||
@@ -454,8 +457,8 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
GetCertRequestResponse(g_config->provisioning_server_url());
|
||||
EXPECT_NE(0, static_cast<int>(response.size()));
|
||||
EXPECT_EQ(NO_ERROR,
|
||||
decryptor_.HandleProvisioningResponse(EMPTY_ORIGIN, response, &cert,
|
||||
&wrapped_key));
|
||||
decryptor_.HandleProvisioningResponse(kDefaultCdmIdentifier, response,
|
||||
&cert, &wrapped_key));
|
||||
EXPECT_EQ(0, static_cast<int>(cert.size()));
|
||||
EXPECT_EQ(0, static_cast<int>(wrapped_key.size()));
|
||||
decryptor_.CloseSession(session_id_);
|
||||
@@ -651,8 +654,8 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
}
|
||||
|
||||
std::string GetSecurityLevel(TestWvCdmClientPropertySet* property_set) {
|
||||
decryptor_.OpenSession(g_key_system, property_set, EMPTY_ORIGIN, NULL,
|
||||
&session_id_);
|
||||
decryptor_.OpenSession(g_key_system, property_set, kDefaultCdmIdentifier,
|
||||
NULL, &session_id_);
|
||||
CdmQueryMap query_info;
|
||||
EXPECT_EQ(NO_ERROR,
|
||||
decryptor_.QuerySessionStatus(session_id_, &query_info));
|
||||
@@ -685,7 +688,8 @@ class WvCdmExtendedDurationTest : public WvCdmTestBase {
|
||||
|
||||
TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRequestTest) {
|
||||
Provision();
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, &session_id_);
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
GenerateKeyRequest(g_key_id, kLicenseTypeStreaming);
|
||||
|
||||
EXPECT_TRUE(!key_msg_.empty());
|
||||
@@ -753,7 +757,8 @@ TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRequestTest) {
|
||||
|
||||
TEST_F(WvCdmExtendedDurationTest, VerifyLicenseRenewalTest) {
|
||||
Provision();
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, &session_id_);
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
GenerateKeyRequest(g_key_id, kLicenseTypeStreaming);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, false);
|
||||
|
||||
@@ -840,8 +845,8 @@ TEST_F(WvCdmExtendedDurationTest, UsageOverflowTest) {
|
||||
EXPECT_TRUE(handle.DeleteAllUsageInfoForApp("", &provider_session_tokens));
|
||||
|
||||
for (size_t i = 0; i < kMaxUsageTableSize + 100; ++i) {
|
||||
decryptor_.OpenSession(g_key_system, property_set, EMPTY_ORIGIN, NULL,
|
||||
&session_id_);
|
||||
decryptor_.OpenSession(g_key_system, property_set, kDefaultCdmIdentifier,
|
||||
NULL, &session_id_);
|
||||
std::string key_id = a2bs_hex(
|
||||
"000000427073736800000000" // blob size and pssh
|
||||
"EDEF8BA979D64ACEA3C827DCD51D21ED00000022" // Widevine system id
|
||||
@@ -900,7 +905,7 @@ TEST_F(WvCdmExtendedDurationTest, DISABLED_AutomatedOfflineSessionReleaseTest) {
|
||||
|
||||
std::set<std::string> key_set_id_map;
|
||||
for (uint32_t i = 0; i < num_key_set_ids; ++i) {
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL,
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
GenerateKeyRequest(kOfflineClip4, kLicenseTypeOffline);
|
||||
VerifyKeyRequestResponse(kUatLicenseServer, client_auth, false);
|
||||
@@ -914,7 +919,7 @@ TEST_F(WvCdmExtendedDurationTest, DISABLED_AutomatedOfflineSessionReleaseTest) {
|
||||
for (iter = key_set_id_map.begin(); iter != key_set_id_map.end(); ++iter) {
|
||||
session_id_.clear();
|
||||
key_set_id_.clear();
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL,
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
EXPECT_EQ(wvcdm::KEY_ADDED, decryptor_.RestoreKey(session_id_, *iter));
|
||||
decryptor_.CloseSession(session_id_);
|
||||
@@ -957,7 +962,8 @@ TEST_P(WvCdmStreamingNoPstTest, UsageTest) {
|
||||
Unprovision();
|
||||
Provision();
|
||||
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, &session_id_);
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
GenerateKeyRequest(g_key_id, kLicenseTypeStreaming);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, false);
|
||||
|
||||
@@ -1031,7 +1037,8 @@ TEST_P(WvCdmStreamingPstTest, UsageTest) {
|
||||
Unprovision();
|
||||
Provision();
|
||||
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, &session_id_);
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
GenerateKeyRequest(kStreamingClip1PstInitData, kLicenseTypeStreaming);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, false);
|
||||
|
||||
@@ -1096,7 +1103,8 @@ TEST_P(WvCdmStreamingUsageReportTest, UsageTest) {
|
||||
Unprovision();
|
||||
Provision();
|
||||
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, &session_id_);
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
GenerateKeyRequest(kStreamingClip1PstInitData, kLicenseTypeStreaming);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, false);
|
||||
|
||||
@@ -1192,7 +1200,8 @@ TEST_P(WvCdmOfflineUsageReportTest, UsageTest) {
|
||||
Unprovision();
|
||||
Provision();
|
||||
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, &session_id_);
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
GenerateKeyRequest(kOfflineClip2PstInitData, kLicenseTypeOffline);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, false);
|
||||
|
||||
@@ -1215,7 +1224,8 @@ TEST_P(WvCdmOfflineUsageReportTest, UsageTest) {
|
||||
|
||||
for (size_t i = 0; i < GetParam(); ++i) {
|
||||
session_id_.clear();
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, &session_id_);
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
EXPECT_EQ(KEY_ADDED, decryptor_.RestoreKey(session_id_, key_set_id));
|
||||
|
||||
// Query and validate usage information
|
||||
@@ -1258,7 +1268,8 @@ TEST_P(WvCdmOfflineUsageReportTest, UsageTest) {
|
||||
}
|
||||
|
||||
session_id_.clear();
|
||||
decryptor_.OpenSession(g_key_system, NULL, EMPTY_ORIGIN, NULL, &session_id_);
|
||||
decryptor_.OpenSession(g_key_system, NULL, kDefaultCdmIdentifier, NULL,
|
||||
&session_id_);
|
||||
EXPECT_EQ(KEY_ADDED, decryptor_.RestoreKey(session_id_, key_set_id));
|
||||
|
||||
// Query and validate usage information
|
||||
|
||||
Reference in New Issue
Block a user