Add DRM reprovisioning request generation

[ Merge of http://go/wvgerrit/192010 ]

Updates the CDM to add support for DRM reprovisioning request creation.
- Load the baked-in certificate for use as the client token.
- Add functions to build and sign a drm reprovisioning request.
- Update the Rikers L3 OEMCrypto implementation to support signing
  provisioning requests and getting embedded certificate.
- Update client id token to handle DRM reprovisioning.
- Add OEMCrypto function to load the baked-in device certificate in
  Rikers CDMs and stubs for non-Rikers CDMs.
- Add dynamic adapter support for getting embedded device certificate
  only on L3.

Bug: 305093063
Test: WVTS
Change-Id: I9a0ecf95e27213b046f03baa0781fb164179323b
This commit is contained in:
Rahul Frias
2024-03-07 14:39:46 -08:00
parent 6499e7063d
commit af2ffca5fa
16 changed files with 164 additions and 7 deletions

View File

@@ -21,6 +21,8 @@
#include "license_holder.h"
#include "license_request.h"
#include "log.h"
// TODO: b/305093063 - Remove when Drm Reprovisioning server is implemented.
#include "oec_device_features.h"
#include "properties.h"
#include "string_conversions.h"
#include "test_base.h"
@@ -152,6 +154,12 @@ class WvCdmEngineTest : public WvCdmEnginePreProvTest {
WvCdmEngineTest() {}
void SetUp() override {
// TODO: b/305093063 - Remove when Drm Reprovisioning server is implemented.
if (wvoec::global_features.provisioning_method ==
OEMCrypto_DrmReprovisioning) {
GTEST_SKIP()
<< "Skipping until Drm Reprovisioning server support is implemented.";
}
WvCdmEnginePreProvTest::SetUp();
session_opened_ = false;
WvCdmEnginePreProvTest::OpenSession();

View File

@@ -481,8 +481,8 @@ TEST_P(CertificateProvisioningTest, ProvisioningResponseSuccess) {
INSTANTIATE_TEST_SUITE_P(
CertificateProvisioningTests, CertificateProvisioningTest,
// TODO: b/305093063 - Add Drm Reprovisioning to Values once implemented.
testing::Values(kClientTokenKeybox, kClientTokenOemCert),
testing::Values(kClientTokenKeybox, kClientTokenOemCert,
kClientTokenDrmReprovisioning),
[](const testing::TestParamInfo<CertificateProvisioningTest::ParamType>&
param_type) {
return CdmClientTokenTypeToString(param_type.param);

View File

@@ -99,6 +99,9 @@ TEST_F(CryptoSessionMetricsTest, OpenSessionValidMetrics) {
} else if (token_type == kClientTokenBootCertChain) {
EXPECT_EQ(OEMCrypto_BootCertificateChain,
metrics_proto.oemcrypto_provisioning_method().int_value());
} else if (token_type == kClientTokenDrmReprovisioning) {
EXPECT_EQ(OEMCrypto_DrmReprovisioning,
metrics_proto.oemcrypto_provisioning_method().int_value());
} else {
FAIL() << "Unexpected token type: " << token_type;
}
@@ -140,6 +143,9 @@ TEST_F(CryptoSessionMetricsTest, GetProvisioningTokenValidMetrics) {
} else if (token_type == kClientTokenBootCertChain) {
EXPECT_EQ(OEMCrypto_BootCertificateChain,
metrics_proto.oemcrypto_provisioning_method().int_value());
} else if (token_type == kClientTokenDrmReprovisioning) {
EXPECT_EQ(OEMCrypto_DrmReprovisioning,
metrics_proto.oemcrypto_provisioning_method().int_value());
} else {
ASSERT_EQ(0, metrics_proto.crypto_session_get_token().size());
}

View File

@@ -40,6 +40,12 @@ class WvGenericCryptoTest : public WvCdmTestBaseWithEngine {
if (!wvoec::global_features.generic_crypto) {
GTEST_SKIP() << "Test for devices with generic crypto API only";
}
// TODO: b/305093063 - Remove when Drm Reprovisioning server is implemented.
if (wvoec::global_features.provisioning_method ==
OEMCrypto_DrmReprovisioning) {
GTEST_SKIP()
<< "Skipping until Drm Reprovisioning server support is implemented.";
}
EnsureProvisioned();
ASSERT_NO_FATAL_FAILURE(holder_.OpenSession());
ASSERT_NO_FATAL_FAILURE(holder_.FetchLicense());
@@ -68,7 +74,11 @@ class WvGenericCryptoTest : public WvCdmTestBaseWithEngine {
iv_ = std::string(iv_vector_.begin(), iv_vector_.end());
}
void TearDown() override { holder_.CloseSession(); }
void TearDown() override {
// TODO: b/305093063 - Remove when Drm Reprovisioning server is implemented.
if (IsSkipped()) return;
holder_.CloseSession();
}
protected:
LicenseHolder holder_;

View File

@@ -374,6 +374,12 @@ void WvCdmTestBase::Provision() {
}
void WvCdmTestBase::EnsureProvisioned() {
// TODO: b/305093063 - Remove when Drm Reprovisioning server is implemented.
if (wvoec::global_features.provisioning_method ==
OEMCrypto_DrmReprovisioning) {
GTEST_SKIP()
<< "Skipping until Drm Reprovisioning server support is implemented.";
}
CdmSessionId session_id;
std::unique_ptr<wvutil::FileSystem> file_system(CreateTestFileSystem());
// OpenSession will check if a DRM certificate exists, while