Source release 19.6.0

GitOrigin-RevId: 13a33e34413c19da1bfe76abcc66be519c9ac9d1
This commit is contained in:
Googler
2025-05-30 14:47:25 -07:00
committed by mattfedd
parent f7ec4fdeff
commit 6d36a0c93d
59 changed files with 3327 additions and 1491 deletions

View File

@@ -139,6 +139,54 @@ void ProvisioningHolder::LoadResponse(bool binary_provisioning) {
if (log_core_message_) MessageDumper::PrintProvisioningResponse(response_);
}
CdmResponseType ProvisioningHolder::LoadResponseReturnStatus(
bool binary_provisioning) {
// Preconditions.
if (response_.empty()) {
ADD_FAILURE() << "No response was fetched";
return CdmResponseType(UNKNOWN_ERROR);
}
std::string cdm_prov_response;
if (binary_provisioning) {
// CDM is expecting the response to be in binary form, response
// must be extracted and decoded.
std::string base_64_response;
if (!ExtractSignedMessage(response_, &base_64_response)) {
ADD_FAILURE()
<< "Failed to extract signed serialized response from JSON response";
return CdmResponseType(UNKNOWN_ERROR);
}
if (base_64_response.empty()) {
ADD_FAILURE()
<< "Base64 encoded provisioning response is unexpectedly empty";
return CdmResponseType(UNKNOWN_ERROR);
}
LOGV("Extracted response message: \n%s\n", base_64_response.c_str());
const std::vector<uint8_t> response_vec =
wvutil::Base64SafeDecode(base_64_response);
if (response_vec.empty()) {
ADD_FAILURE() << "Failed to decode base64 response: " << base_64_response;
return CdmResponseType(UNKNOWN_ERROR);
}
cdm_prov_response.assign(response_vec.begin(), response_vec.end());
} else {
cdm_prov_response = response_;
}
// HandleProvisioningResponse() may or may not succeed,
// left to caller to determine if this is considered a
// test failure.
const CdmResponseType status = cdm_engine_->HandleProvisioningResponse(
cdm_prov_response, kLevelDefault, &certificate_, &wrapped_key_);
if (status == NO_ERROR) {
// Only dump data if successful.
if (config_.dump_golden_data()) MessageDumper::DumpProvisioning(response_);
if (log_core_message_) MessageDumper::PrintProvisioningResponse(response_);
}
return status;
}
bool ProvisioningHolder::ExtractSignedMessage(const std::string& response,
std::string* result) {
static const std::string kMessageStart = "\"signedResponse\": \"";