Clear OTA keybox flag. am: f5e4c94e26
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/16094844 Change-Id: Id8a110c13e2aed574ec1fd7641d4f0fc24ad382d
This commit is contained in:
@@ -302,7 +302,7 @@ class CryptoSession {
|
|||||||
// Returns a system-wide singleton instance of SystemFallbackPolicy
|
// Returns a system-wide singleton instance of SystemFallbackPolicy
|
||||||
// to be used for communicating OTA keybox provisioning state between
|
// to be used for communicating OTA keybox provisioning state between
|
||||||
// apps. Returns a null pointer if OTA provisioning is not supported,
|
// apps. Returns a null pointer if OTA provisioning is not supported,
|
||||||
// or if the device has already been provisioned.
|
// or not required.
|
||||||
static okp::SystemFallbackPolicy* GetOkpFallbackPolicy();
|
static okp::SystemFallbackPolicy* GetOkpFallbackPolicy();
|
||||||
|
|
||||||
// Generates an OTA provisioning request.
|
// Generates an OTA provisioning request.
|
||||||
|
|||||||
@@ -3041,8 +3041,6 @@ okp::SystemFallbackPolicy* CryptoSession::GetOkpFallbackPolicy() {
|
|||||||
// If not set, then OTA keybox provisioning is not supported or
|
// If not set, then OTA keybox provisioning is not supported or
|
||||||
// not needed.
|
// not needed.
|
||||||
if (!okp_fallback_policy_l1_) return nullptr;
|
if (!okp_fallback_policy_l1_) return nullptr;
|
||||||
// May have already been initialized.
|
|
||||||
if (okp_fallback_policy_l1_->IsProvisioned()) return nullptr;
|
|
||||||
return okp_fallback_policy_l1_.get();
|
return okp_fallback_policy_l1_.get();
|
||||||
};
|
};
|
||||||
return WithStaticFieldReadLock("GetOkpFallbackPolicy", getter);
|
return WithStaticFieldReadLock("GetOkpFallbackPolicy", getter);
|
||||||
@@ -3053,8 +3051,11 @@ CdmResponseType CryptoSession::PrepareOtaProvisioningRequest(
|
|||||||
RETURN_IF_NULL(request, PARAMETER_NULL);
|
RETURN_IF_NULL(request, PARAMETER_NULL);
|
||||||
RETURN_IF_NOT_OPEN(CRYPTO_SESSION_NOT_OPEN);
|
RETURN_IF_NOT_OPEN(CRYPTO_SESSION_NOT_OPEN);
|
||||||
size_t buffer_length = 0;
|
size_t buffer_length = 0;
|
||||||
OEMCryptoResult status = OEMCrypto_GenerateOTARequest(
|
OEMCryptoResult status =
|
||||||
oec_session_id_, nullptr, &buffer_length, use_test_key);
|
WithOecWriteLock("PrepareOtaProvisioningRequest", [&] {
|
||||||
|
return OEMCrypto_GenerateOTARequest(
|
||||||
|
oec_session_id_, nullptr, &buffer_length, use_test_key ? 1 : 0);
|
||||||
|
});
|
||||||
if (status != OEMCrypto_ERROR_SHORT_BUFFER)
|
if (status != OEMCrypto_ERROR_SHORT_BUFFER)
|
||||||
return MapOEMCryptoResult(status, UNKNOWN_ERROR,
|
return MapOEMCryptoResult(status, UNKNOWN_ERROR,
|
||||||
"PrepareOtaProvisioningRequest");
|
"PrepareOtaProvisioningRequest");
|
||||||
@@ -3064,8 +3065,10 @@ CdmResponseType CryptoSession::PrepareOtaProvisioningRequest(
|
|||||||
}
|
}
|
||||||
request->resize(buffer_length);
|
request->resize(buffer_length);
|
||||||
uint8_t* buf = reinterpret_cast<uint8_t*>(&request->front());
|
uint8_t* buf = reinterpret_cast<uint8_t*>(&request->front());
|
||||||
status = OEMCrypto_GenerateOTARequest(oec_session_id_, buf, &buffer_length,
|
status = WithOecWriteLock("PrepareOtaProvisioningRequest", [&] {
|
||||||
|
return OEMCrypto_GenerateOTARequest(oec_session_id_, buf, &buffer_length,
|
||||||
use_test_key ? 1 : 0);
|
use_test_key ? 1 : 0);
|
||||||
|
});
|
||||||
if (OEMCrypto_SUCCESS != status) {
|
if (OEMCrypto_SUCCESS != status) {
|
||||||
request->clear();
|
request->clear();
|
||||||
} else if (buffer_length != request->size()) {
|
} else if (buffer_length != request->size()) {
|
||||||
@@ -3078,9 +3081,15 @@ CdmResponseType CryptoSession::PrepareOtaProvisioningRequest(
|
|||||||
CdmResponseType CryptoSession::LoadOtaProvisioning(
|
CdmResponseType CryptoSession::LoadOtaProvisioning(
|
||||||
bool use_test_key, const std::string& response) {
|
bool use_test_key, const std::string& response) {
|
||||||
RETURN_IF_NOT_OPEN(CRYPTO_SESSION_NOT_OPEN);
|
RETURN_IF_NOT_OPEN(CRYPTO_SESSION_NOT_OPEN);
|
||||||
const OEMCryptoResult status = OEMCrypto_ProcessOTAKeybox(
|
const OEMCryptoResult status = WithOecWriteLock("LoadOtaProvisioning", [&] {
|
||||||
oec_session_id_, reinterpret_cast<const uint8_t*>(response.data()),
|
return OEMCrypto_ProcessOTAKeybox(
|
||||||
response.size(), use_test_key ? 1 : 0);
|
oec_session_id_, reinterpret_cast<const uint8_t*>(response.data()),
|
||||||
|
response.size(), use_test_key ? 1 : 0);
|
||||||
|
});
|
||||||
|
if (status == OEMCrypto_SUCCESS) {
|
||||||
|
WithOecWriteLock("LoadOtaProvisioning",
|
||||||
|
[&] { needs_keybox_provisioning_ = false; });
|
||||||
|
}
|
||||||
return MapOEMCryptoResult(status, UNKNOWN_ERROR, "LoadOtaProvisioning");
|
return MapOEMCryptoResult(status, UNKNOWN_ERROR, "LoadOtaProvisioning");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user