Merge from Widevine repo of http://go/wvgerrit/53202 and Merge from Widevine repo of http://go/wvgerrit/53624 This change contains a variety of small tweaks to the ContentKeySession and EntitlementKeySession classes that were discovered while fixing b/78652567. There should be no change in behavior from this patch. The fixes are: 1) Added missing headers and removed unnecessary headers. 2) Removed the unused keys_ member from EntitlementKeySession. 3) Renamed ContentKeySession's protected member function so that it is not an overload of the public LoadKeys() function. This makes it clearer what EntitlementKeySession::LoadKeys() is doing. 4) Added missing "virtual" and "OVERRIDE" keywords. 5) Added missing copyright headers. 6) Ran clang-format with Google style. 7) Correct missing OVERRIDE keywords. Test: tested as part of http://go/ag/4674759 Change-Id: Icb0af886d7d3eb097b5dffbb716be6ac28f0916d
51 lines
1.9 KiB
C++
51 lines
1.9 KiB
C++
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
|
|
#ifndef WVCDM_CORE_KEY_SESSSION_H_
|
|
#define WVCDM_CORE_KEY_SESSSION_H_
|
|
|
|
#include "metrics_collections.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
class CryptoKey;
|
|
|
|
class KeySession {
|
|
protected:
|
|
KeySession(metrics::CryptoMetrics* metrics) : metrics_(metrics) {}
|
|
|
|
public:
|
|
typedef enum { kDefault, kSubLicense, kEntitlement } KeySessionType;
|
|
virtual ~KeySession() {}
|
|
virtual KeySessionType Type() = 0;
|
|
virtual bool GenerateDerivedKeys(const std::string& message) = 0;
|
|
virtual bool GenerateDerivedKeys(const std::string& message,
|
|
const std::string& session_key) = 0;
|
|
virtual OEMCryptoResult LoadKeys(const std::string& message,
|
|
const std::string& signature,
|
|
const std::string& mac_key_iv,
|
|
const std::string& mac_key,
|
|
const std::vector<CryptoKey>& keys,
|
|
const std::string& provider_session_token,
|
|
CdmCipherMode* cipher_mode,
|
|
const std::string& srm_requirement) = 0;
|
|
virtual OEMCryptoResult LoadEntitledContentKeys(
|
|
const std::vector<CryptoKey>& keys) = 0;
|
|
virtual OEMCryptoResult SelectKey(const std::string& key_id,
|
|
CdmCipherMode cipher_mode) = 0;
|
|
virtual OEMCryptoResult Decrypt(
|
|
const CdmDecryptionParameters& params,
|
|
OEMCrypto_DestBufferDesc& buffer_descriptor,
|
|
OEMCrypto_CENCEncryptPatternDesc& pattern_descriptor) = 0;
|
|
|
|
protected:
|
|
metrics::CryptoMetrics* metrics_;
|
|
};
|
|
|
|
typedef std::map<std::string, CryptoSessionId> SubLicenseSessionMap;
|
|
|
|
} // namespace wvcdm
|
|
|
|
#endif // WVCDM_CORE_KEY_SESSSION_H_
|