55 lines
2.0 KiB
C++
55 lines
2.0 KiB
C++
////////////////////////////////////////////////////////////////////////////////
|
|
// Copyright 2019 Google LLC.
|
|
//
|
|
// This software is licensed under the terms defined in the Widevine Master
|
|
// License Agreement. For a copy of this agreement, please contact
|
|
// widevine-licensing@google.com.
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "common/output_protection_util.h"
|
|
|
|
namespace widevine {
|
|
namespace op_util {
|
|
|
|
Status VerifyDeviceCapabilities(
|
|
const ClientIdentification::ClientCapabilities& device_capabilities,
|
|
const License::KeyContainer::OutputProtection& output_protection,
|
|
bool* should_disable_analog_output) {
|
|
bool device_has_analog_output =
|
|
device_capabilities.analog_output_capabilities() !=
|
|
ClientIdentification::ClientCapabilities::ANALOG_OUTPUT_NONE &&
|
|
device_capabilities.analog_output_capabilities() !=
|
|
ClientIdentification::ClientCapabilities::ANALOG_OUTPUT_UNKNOWN;
|
|
|
|
if (should_disable_analog_output != nullptr) {
|
|
*should_disable_analog_output = false;
|
|
}
|
|
if (device_has_analog_output) {
|
|
if (output_protection.disable_analog_output() &&
|
|
!device_capabilities.can_disable_analog_output()) {
|
|
return Status(error::PERMISSION_DENIED,
|
|
"Analog out cannot be disabled on this device.");
|
|
}
|
|
if (output_protection.cgms_flags() !=
|
|
License::KeyContainer::OutputProtection::CGMS_NONE) {
|
|
if (device_capabilities.analog_output_capabilities() !=
|
|
ClientIdentification::ClientCapabilities::
|
|
ANALOG_OUTPUT_SUPPORTS_CGMS_A) {
|
|
if (!device_capabilities.can_disable_analog_output()) {
|
|
return Status(
|
|
error::PERMISSION_DENIED,
|
|
"Analog out cannot be disabled on this device, no CGMS.");
|
|
}
|
|
// This device does not have support for CGMS protections.
|
|
if (should_disable_analog_output != nullptr) {
|
|
*should_disable_analog_output = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return OkStatus();
|
|
}
|
|
|
|
} // namespace op_util
|
|
} // namespace widevine
|