//////////////////////////////////////////////////////////////////////////////// // 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. //////////////////////////////////////////////////////////////////////////////// // Implements the device info helper function. #include "common/device_info_util.h" #include "absl/strings/ascii.h" namespace widevine { bool IsMatchedMakeModel(const std::string& expected_make, const std::string& expected_model, const std::string& make_from_client, const std::string& model_from_client) { return absl::AsciiStrToLower(expected_make) == absl::AsciiStrToLower(make_from_client) && absl::AsciiStrToLower(expected_model) == absl::AsciiStrToLower(model_from_client); } bool VerifyMakeModel(const ProvisionedDeviceInfo& device_info, const std::string& make_from_client, const std::string& model_from_client) { if (IsMatchedMakeModel(device_info.manufacturer(), device_info.model(), make_from_client, model_from_client)) { return true; } for (ProvisionedDeviceInfo::ModelInfo product_info : device_info.model_info()) { if (IsMatchedMakeModel(product_info.manufacturer(), product_info.model(), make_from_client, model_from_client)) { return true; } } return false; } } // namespace widevine