Assorted Key Session Code Cleanup
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
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
// 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_CONTENT_KEY_SESSSION_H_
|
||||
#define WVCDM_CORE_CONTENT_KEY_SESSSION_H_
|
||||
|
||||
#include "key_session.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "override.h"
|
||||
#include "timer_metric.h"
|
||||
|
||||
namespace wvcdm {
|
||||
@@ -15,45 +21,49 @@ class ContentKeySession : public KeySession {
|
||||
cipher_mode_(kCipherModeCtr) {}
|
||||
virtual ~ContentKeySession() {}
|
||||
|
||||
KeySessionType Type() { return kDefault; }
|
||||
virtual KeySessionType Type() OVERRIDE { return kDefault; }
|
||||
|
||||
// Generate Derived Keys for ContentKeySession
|
||||
bool GenerateDerivedKeys(const std::string& message);
|
||||
virtual bool GenerateDerivedKeys(const std::string& message) OVERRIDE;
|
||||
|
||||
// Generate Derived Keys (from session key) for ContentKeySession
|
||||
bool GenerateDerivedKeys(const std::string& message,
|
||||
const std::string& session_key);
|
||||
virtual bool GenerateDerivedKeys(const std::string& message,
|
||||
const std::string& session_key) OVERRIDE;
|
||||
|
||||
// Load Keys for ContentKeySession
|
||||
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);
|
||||
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) OVERRIDE;
|
||||
|
||||
OEMCryptoResult LoadEntitledContentKeys(const std::vector<CryptoKey>&) {
|
||||
virtual OEMCryptoResult LoadEntitledContentKeys(
|
||||
const std::vector<CryptoKey>&) OVERRIDE {
|
||||
return OEMCrypto_ERROR_INVALID_CONTEXT;
|
||||
}
|
||||
|
||||
// Select Key for ContentKeySession
|
||||
OEMCryptoResult SelectKey(const std::string& key_id,
|
||||
CdmCipherMode cipher_mode);
|
||||
virtual OEMCryptoResult SelectKey(const std::string& key_id,
|
||||
CdmCipherMode cipher_mode) OVERRIDE;
|
||||
|
||||
// Decrypt for ContentKeySession
|
||||
OEMCryptoResult Decrypt(const CdmDecryptionParameters& params,
|
||||
OEMCrypto_DestBufferDesc& buffer_descriptor,
|
||||
OEMCrypto_CENCEncryptPatternDesc& pattern_descriptor);
|
||||
virtual OEMCryptoResult Decrypt(
|
||||
const CdmDecryptionParameters& params,
|
||||
OEMCrypto_DestBufferDesc& buffer_descriptor,
|
||||
OEMCrypto_CENCEncryptPatternDesc& pattern_descriptor) OVERRIDE;
|
||||
|
||||
protected:
|
||||
OEMCryptoResult LoadKeys(
|
||||
virtual OEMCryptoResult LoadKeysAsLicenseType(
|
||||
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, OEMCrypto_LicenseType license_type);
|
||||
const std::string& srm_requirement,
|
||||
OEMCrypto_LicenseType license_type);
|
||||
|
||||
CryptoSessionId oec_session_id_;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
// 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_ENTITLEMENT_KEY_SESSSION_H_
|
||||
#define WVCDM_CORE_ENTITLEMENT_KEY_SESSSION_H_
|
||||
|
||||
#include "content_key_session.h"
|
||||
#include "key_session.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "override.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
@@ -15,18 +20,16 @@ class EntitlementKeySession : public ContentKeySession {
|
||||
KeySessionType Type() { return kEntitlement; }
|
||||
|
||||
// Load Keys for ContentKeySession
|
||||
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);
|
||||
OEMCryptoResult LoadEntitledContentKeys(const std::vector<CryptoKey>& keys);
|
||||
|
||||
private:
|
||||
std::vector<CryptoKey> keys_;
|
||||
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) OVERRIDE;
|
||||
virtual OEMCryptoResult LoadEntitledContentKeys(
|
||||
const std::vector<CryptoKey>& keys) OVERRIDE;
|
||||
};
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
// 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_
|
||||
|
||||
|
||||
Reference in New Issue
Block a user