Fall back to L3 if L1 has test keybox

Merge from Widevine repo of http://go/wvgerrit/142150

For an EVT device, without a keybox or with a test keybox, we want it
to fall back to L3. However, when running the unit or integration
tests it should continue running tests with test keybox. This will
allow us to test L1 oemcrypto on an EVT device, while still using an
EVT device for dogfooding video content at the L3 level.

Bug: 210807585
Change-Id: I30c35134239db35bb39f11f75220063181987763
This commit is contained in:
Fred Gylys-Colwell
2021-12-19 07:28:04 +00:00
parent ff3ea0c90d
commit 1d25eeb616
10 changed files with 168 additions and 28 deletions

View File

@@ -217,16 +217,8 @@ TestCryptoSession::TestCryptoSession(metrics::CryptoMetrics* crypto_metrics)
// The first CryptoSession should have initialized OEMCrypto. This is right
// after that, so we should tell oemcrypto to use a test keybox.
if (session_count() == 1) {
OverrideNeedKeyboxForTesting(false);
// However, if the device does not have a keybox, initialization would have
// failed. In that case we should try again.
if (!initialized()) {
// Give up if we cannot initialize at all.
if (OEMCrypto_SUCCESS != OEMCrypto_Initialize()) return;
set_initialized(true);
// This was skipped in Init because initialization failed.
CacheVersion();
}
CryptoSession::SetAllowTestKeybox(true);
ReinitializeForTest();
WvCdmTestBase::InstallTestRootOfTrust();
}
}