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
This commit is contained in:
Alex Dale
2022-06-15 14:11:50 -07:00
parent eb711ea0ec
commit 6024987733
2 changed files with 16 additions and 3 deletions

View File

@@ -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;

View File

@@ -390,13 +390,22 @@ TEST_F(SystemIdExtractorTest, GetProvisioningMethod_Failed) {
}
TEST_F(SystemIdExtractorTest, GetProvisioningMethod_Unsupported) {
ExpectProvisioningType(kClientTokenDrmCert);
ExpectProvisioningType(static_cast<CdmClientTokenType>(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()))