Snap for 7930058 from 9067a53892 to tm-release

Change-Id: Ie5d1f68c846b0cb9146eb3ceb3f43d6454351838
This commit is contained in:
Android Build Coastguard Worker
2021-11-19 02:19:12 +00:00

View File

@@ -756,8 +756,6 @@ class Adapter {
} }
} }
bool level1_valid() { return level1_valid_; }
void SetSandbox(const uint8_t* sandbox_id, size_t sandbox_id_length) { void SetSandbox(const uint8_t* sandbox_id, size_t sandbox_id_length) {
sandbox_id_.assign(sandbox_id, sandbox_id + sandbox_id_length); sandbox_id_.assign(sandbox_id, sandbox_id + sandbox_id_length);
} }
@@ -819,21 +817,17 @@ class Adapter {
level1_.BuildInformation()); level1_.BuildInformation());
} }
} else { } else {
FallBackToLevel3(); level1_ = FunctionPointers(); // revert to all null pointers.
level1_valid_ = false;
// Note: if the function pointers are bad, we do not close the library and
// try again later. Instead, we permanently fall back to L3. This is a
// debatable choice: I decided the risk of a dlclose resource leak out
// weighed the possibility that the library would be fixed on the next
// load.
} }
return result; return result;
} }
void FallBackToLevel3() {
level1_ = FunctionPointers(); // revert to all null pointers.
level1_valid_ = false;
// Note: if the function pointers are bad, we do not close the library and
// try again later. Instead, we permanently fall back to L3. This is a
// debatable choice: I decided the risk of a dlclose resource leak out
// weighed the possibility that the library would be fixed on the next
// load.
}
bool LoadLevel1(wvcdm::metrics::OemCryptoDynamicAdapterMetrics* metrics) { bool LoadLevel1(wvcdm::metrics::OemCryptoDynamicAdapterMetrics* metrics) {
if (metrics == nullptr) { if (metrics == nullptr) {
return false; return false;
@@ -1288,7 +1282,6 @@ namespace wvcdm {
OEMCryptoResult OEMCrypto_InitializeAndCheckKeybox( OEMCryptoResult OEMCrypto_InitializeAndCheckKeybox(
bool* needs_keybox_provisioning) { bool* needs_keybox_provisioning) {
if (!needs_keybox_provisioning) return OEMCrypto_ERROR_UNKNOWN_FAILURE; if (!needs_keybox_provisioning) return OEMCrypto_ERROR_UNKNOWN_FAILURE;
*needs_keybox_provisioning = false;
if (!gAdapter) { if (!gAdapter) {
gAdapter.reset(new Adapter()); gAdapter.reset(new Adapter());
} }
@@ -1302,8 +1295,7 @@ OEMCryptoResult OEMCrypto_InitializeAndCheckKeybox(
if (ignore_count > 0) { if (ignore_count > 0) {
LOGD("Ignoring keybox status %d", static_cast<int>(keybox_status)); LOGD("Ignoring keybox status %d", static_cast<int>(keybox_status));
} }
LOGD("L1 has no keybox. Falling back to L3."); *needs_keybox_provisioning = true;
gAdapter->FallBackToLevel3();
return OEMCrypto_SUCCESS; return OEMCrypto_SUCCESS;
} }
return keybox_status; return keybox_status;