From 1b35b915b57f1a168bfc3fe5d7358f38e6a2333b Mon Sep 17 00:00:00 2001 From: Alex Dale Date: Thu, 16 Dec 2021 19:32:30 -0800 Subject: [PATCH] Return failure if ignore keybox debug count is non-zero. [ Merge of http://go/wvgerrit/141949 ] [ Cherry-pick of http://ag/16496424 ] If the debug count for ignoring an L1 keybox is still non-zero after successfully processing an OTA keybox request, the dynamic layer MUST return a failure to the CDM to keep the CDM and dynamic layer in agreement that the L1 keybox should continue be treated as invalid. This will trigger a fallback; but the fallback can be canceled via the debugging app. Bug: 210823889 Test: Android manual testing Change-Id: I75f50ba605d17872c0e8abffc1eee13ff539f01c --- libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp index 283040b0..619e3807 100644 --- a/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp +++ b/libwvdrmengine/cdm/core/src/oemcrypto_adapter_dynamic.cpp @@ -2970,6 +2970,13 @@ extern "C" OEMCryptoResult OEMCrypto_ProcessOTAKeybox(OEMCrypto_SESSION session, LOGE("Installed OTA keybox. save ignore count failed %d, count=%u", static_cast(save_result), ignore_count); } + if (ignore_count > 0 && result == OEMCrypto_SUCCESS) { + // If success is returned while the dynamic adapter continues + // to ignore the keybox, the CDM layer will enter an invalid + // state and apps may get stuck. + LOGD("Ignoring install success"); + return OEMCrypto_ERROR_UNKNOWN_FAILURE; + } } } return result;