Don't use empty core message

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

This treats an empty core message as not having a core message.

Bug: 149110740
Change-Id: Icacfc5d9a5bdce9b136c25c59205eee575cfba72
Tests: Ran ExoPlayer on taimen
This commit is contained in:
Fred Gylys-Colwell
2020-02-11 13:59:23 -08:00
parent 6a0cc01e0f
commit eeeb0304ed
4 changed files with 17 additions and 8 deletions

View File

@@ -360,11 +360,13 @@ CdmResponseType CertificateProvisioning::HandleProvisioningResponse(
}
if (supports_core_messages() &&
!signed_response.has_oemcrypto_core_message()) {
(!signed_response.has_oemcrypto_core_message() ||
signed_response.oemcrypto_core_message().empty())) {
LOGE("Signed response does not have core message");
error = true;
} else if (!supports_core_messages() &&
signed_response.has_oemcrypto_core_message()) {
(signed_response.has_oemcrypto_core_message() &&
!signed_response.oemcrypto_core_message().empty())) {
const std::string& core_message = signed_response.oemcrypto_core_message();
// This case should not occur. However, the CDM will let OEMCrypto
// fail.

View File

@@ -363,7 +363,9 @@ CdmResponseType CdmLicense::PrepareKeyRequest(
signed_message.set_type(SignedMessage::LICENSE_REQUEST);
signed_message.set_signature(license_request_signature);
signed_message.set_msg(serialized_license_req);
signed_message.set_oemcrypto_core_message(core_message);
if (core_message.size() > 0) {
signed_message.set_oemcrypto_core_message(core_message);
}
signed_message.SerializeToString(signed_request);
@@ -560,7 +562,8 @@ CdmResponseType CdmLicense::HandleKeyResponse(
// the server is assumed to operate as V15. This will imply that the
// |signature| field in the response does not include a core message
// either.
if (!signed_response.has_oemcrypto_core_message()) {
if (!signed_response.has_oemcrypto_core_message() ||
signed_response.oemcrypto_core_message().empty()) {
supports_core_messages_ = false;
}
@@ -706,7 +709,8 @@ CdmResponseType CdmLicense::HandleKeyUpdateResponse(
// present; otherwise there might have beeen some tampering with the
// request or response.
if (supports_core_messages() &&
!signed_response.has_oemcrypto_core_message()) {
(!signed_response.has_oemcrypto_core_message() ||
signed_response.oemcrypto_core_message().empty())) {
LOGE("Renewal response is missing |core_message| field");
return CORE_MESSAGE_NOT_FOUND;
}
@@ -797,7 +801,8 @@ CdmResponseType CdmLicense::RestoreOfflineLicense(
return INVALID_LICENSE_REQUEST_TYPE_1;
}
if (!signed_request.has_oemcrypto_core_message()) {
if (!signed_request.has_oemcrypto_core_message() ||
signed_request.oemcrypto_core_message().empty()) {
// Pre V16 license did not include |core_message| components.
// The license response is checked by HandleKeyResponse().
supports_core_messages_ = false;
@@ -905,7 +910,8 @@ CdmResponseType CdmLicense::RestoreLicenseForRelease(
return SIGNATURE_NOT_FOUND_2;
}
if (!signed_response.has_oemcrypto_core_message()) {
if (!signed_response.has_oemcrypto_core_message() ||
signed_response.oemcrypto_core_message().empty()) {
// Possible that the request contains a |core_message|, but the
// response does not. This would occur if the licensing server
// is v15.