//////////////////////////////////////////////////////////////////////////////// // 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. //////////////////////////////////////////////////////////////////////////////// // // Description: // Helper methods for the Root of Trust Id. #include "common/rot_id_util.h" #include #include "glog/logging.h" #include "absl/strings/str_cat.h" #include "common/crypto_util.h" #include "common/ec_key.h" #include "common/sha_util.h" namespace widevine { std::string GenerateRotIdHash(const std::string& salt, uint32_t system_id, const std::string& unique_id_hash) { if (salt.empty() || unique_id_hash.empty()) { return ""; } return Sha256_Hash(absl::StrCat(salt, system_id, unique_id_hash)); } std::string GenerateUniqueIdHash(const std::string& unique_id, const std::string& salt) { if (unique_id.empty()) { LOG(WARNING) << "unique_id should not be empty."; return ""; } if (salt.empty()) { LOG(WARNING) << "salt should not be empty."; return ""; } return widevine::Sha256_Hash(absl::StrCat(unique_id, salt)); } } // namespace widevine