From 6024987733f20b2c43301beae9713c17935f0ce0 Mon Sep 17 00:00:00 2001 From: Alex Dale Date: Wed, 15 Jun 2022 14:11:50 -0700 Subject: [PATCH] Return null system ID for built-in DRM cert devices. [ Merge of http://go/wvgerrit/153489 ] OEMCrypto does not provide an API for retrieving the system ID when the TEE uses a built-in DRM certificate (provisioning 1.0). New OEMs and Android devices do not use prov 1.0; however, the Zimperium CDM (at least the tests) use a built-in certificate and are failing certain tests because of the missing system ID. To address this failure; the CDM SystemIdExtractor has been updated to return a null system ID. Bug: 235879962 Test: system_id_extractor_unittest Change-Id: Ib4c2bd75a7825967b0aa9e31e144184ae18fe8fb --- libwvdrmengine/cdm/core/src/system_id_extractor.cpp | 8 ++++++-- .../cdm/core/test/system_id_extractor_unittest.cpp | 11 ++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/libwvdrmengine/cdm/core/src/system_id_extractor.cpp b/libwvdrmengine/cdm/core/src/system_id_extractor.cpp index 85d0859f..33da5757 100644 --- a/libwvdrmengine/cdm/core/src/system_id_extractor.cpp +++ b/libwvdrmengine/cdm/core/src/system_id_extractor.cpp @@ -60,8 +60,12 @@ bool SystemIdExtractor::ExtractSystemId(uint32_t* system_id) { bool success = false; switch (type) { case kClientTokenDrmCert: - LOGE("Cannot get a system ID from a DRM certificate"); - return false; + LOGW( + "Cannot get a system ID from a DRM certificate, " + "using null system ID: security_level = %s", + RequestedSecurityLevelToString(security_level_)); + *system_id = NULL_SYSTEM_ID; + return true; case kClientTokenKeybox: success = ExtractSystemIdProv20(system_id); break; diff --git a/libwvdrmengine/cdm/core/test/system_id_extractor_unittest.cpp b/libwvdrmengine/cdm/core/test/system_id_extractor_unittest.cpp index e08ff529..93635479 100644 --- a/libwvdrmengine/cdm/core/test/system_id_extractor_unittest.cpp +++ b/libwvdrmengine/cdm/core/test/system_id_extractor_unittest.cpp @@ -390,13 +390,22 @@ TEST_F(SystemIdExtractorTest, GetProvisioningMethod_Failed) { } TEST_F(SystemIdExtractorTest, GetProvisioningMethod_Unsupported) { - ExpectProvisioningType(kClientTokenDrmCert); + ExpectProvisioningType(static_cast(9999)); auto extractor = CreateExtractor(kLevelDefault); ASSERT_TRUE(extractor); uint32_t system_id; EXPECT_FALSE(extractor->ExtractSystemId(&system_id)); } +TEST_F(SystemIdExtractorTest, DrmCertDevice_NullSystemId) { + ExpectProvisioningType(kClientTokenDrmCert); + auto extractor = CreateExtractor(kLevelDefault); + ASSERT_TRUE(extractor); + uint32_t system_id; + EXPECT_TRUE(extractor->ExtractSystemId(&system_id)); + EXPECT_EQ(system_id, NULL_SYSTEM_ID); +} + TEST_F(SystemIdExtractorTest, KeyboxDevice_Success) { ExpectProvisioningType(kClientTokenKeybox); EXPECT_CALL(*crypto_session_, GetTokenFromKeybox(kLevelDefault, NotNull()))