Source release 14.1.0
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
// 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_BUFFER_READER_H_
|
||||
#define WVCDM_CORE_BUFFER_READER_H_
|
||||
@@ -7,7 +9,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "wv_cdm_types.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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_CDM_CLIENT_PROPERTY_SET_H_
|
||||
#define WVCDM_CORE_CDM_CLIENT_PROPERTY_SET_H_
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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_CDM_ENGINE_H_
|
||||
#define WVCDM_CORE_CDM_ENGINE_H_
|
||||
@@ -11,6 +13,7 @@
|
||||
#include "certificate_provisioning.h"
|
||||
#include "clock.h"
|
||||
#include "crypto_session.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "file_store.h"
|
||||
#include "initialization_data.h"
|
||||
#include "lock.h"
|
||||
@@ -18,7 +21,6 @@
|
||||
#include "oemcrypto_adapter.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "service_certificate.h"
|
||||
#include "timer_metric.h"
|
||||
#include "wv_cdm_constants.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
@@ -39,15 +41,6 @@ class CdmEngine {
|
||||
CdmEngine(FileSystem* file_system, const std::string& spoid = EMPTY_SPOID);
|
||||
virtual ~CdmEngine();
|
||||
|
||||
// Set service certificate used when provisioning under this CDM/CdmEngine.
|
||||
// If no valid service certificate is set, a default one associated with
|
||||
// the WV production provisioning server will be used.
|
||||
virtual CdmResponseType SetProvisioningServiceCertificate(
|
||||
const std::string& certificate);
|
||||
|
||||
// Report whether the service certificate has been set.
|
||||
virtual bool HasProvisioningServiceCertificate();
|
||||
|
||||
// Session related methods
|
||||
virtual CdmResponseType OpenSession(
|
||||
const CdmKeySystem& key_system, CdmClientPropertySet* property_set,
|
||||
@@ -120,8 +113,18 @@ class CdmEngine {
|
||||
virtual CdmResponseType RestoreKey(const CdmSessionId& session_id,
|
||||
const CdmKeySetId& key_set_id);
|
||||
|
||||
// This method releases the crypto resources and policy resources associated
|
||||
// with the given session. This renders the session largely useless. It is
|
||||
// preferable to close the session outright. This method does not delete any
|
||||
// stored offline data associated with the session.
|
||||
virtual CdmResponseType RemoveKeys(const CdmSessionId& session_id);
|
||||
|
||||
// This method removes all offline data associated with the session, such as
|
||||
// offline keys and usage info. It should be used with care, as it deletes the
|
||||
// info immediately and without using a release message, so the server is not
|
||||
// able to receive usage info or track releases for offline licenses.
|
||||
virtual CdmResponseType RemoveLicense(const CdmSessionId& session_id);
|
||||
|
||||
// Construct valid renewal request for the current session keys.
|
||||
virtual CdmResponseType GenerateRenewalRequest(
|
||||
const CdmSessionId& session_id, CdmKeyRequest* key_request);
|
||||
@@ -165,6 +168,7 @@ class CdmEngine {
|
||||
// Generate and return a valid provisioning request.
|
||||
virtual CdmResponseType GetProvisioningRequest(
|
||||
CdmCertificateType cert_type, const std::string& cert_authority,
|
||||
const std::string& service_certificate,
|
||||
CdmProvisioningRequest* request, std::string* default_url);
|
||||
|
||||
// Verify and process a provisioning response.
|
||||
@@ -188,11 +192,13 @@ class CdmEngine {
|
||||
virtual CdmResponseType ListStoredLicenses(
|
||||
CdmSecurityLevel security_level, std::vector<std::string>* key_set_ids);
|
||||
|
||||
// Return the list of key_set_ids stored as usage records on the
|
||||
// current (origin-specific) file system.
|
||||
virtual CdmResponseType ListUsageRecords(
|
||||
// Return the list of IDs associated with usage records for the
|
||||
// current (origin-specific) file system. At least one parameter
|
||||
// |ksids| or |provider_session_tokens| needs to be supplied.
|
||||
virtual CdmResponseType ListUsageIds(
|
||||
const std::string& app_id, CdmSecurityLevel security_level,
|
||||
std::vector<std::string>* ksids);
|
||||
std::vector<std::string>* ksids,
|
||||
std::vector<std::string>* provider_session_tokens);
|
||||
|
||||
// Delete the usage record for the given key_set_id. This removes the
|
||||
// usage record in the file system and the OEMCrypto usage record.
|
||||
@@ -220,6 +226,10 @@ class CdmEngine {
|
||||
// security levels.
|
||||
virtual CdmResponseType RemoveAllUsageInfo(const std::string& app_id);
|
||||
|
||||
virtual CdmResponseType RemoveUsageInfo(
|
||||
const std::string& app_id,
|
||||
const CdmSecureStopId& secure_stop_id);
|
||||
|
||||
virtual CdmResponseType ReleaseUsageInfo(
|
||||
const CdmUsageInfoReleaseMessage& message);
|
||||
virtual CdmResponseType LoadUsageSession(const CdmKeySetId& key_set_id,
|
||||
@@ -281,6 +291,8 @@ class CdmEngine {
|
||||
|
||||
virtual metrics::EngineMetrics* GetMetrics() { return &metrics_; }
|
||||
|
||||
virtual CdmResponseType ValidateServiceCertificate(const std::string& cert);
|
||||
|
||||
private:
|
||||
// private methods
|
||||
CdmResponseType OpenSession(
|
||||
@@ -310,7 +322,6 @@ class CdmEngine {
|
||||
* it is published.
|
||||
*/
|
||||
metrics::EngineMetrics metrics_;
|
||||
metrics::TimerMetric life_span_;
|
||||
|
||||
CdmSessionMap session_map_;
|
||||
CdmReleaseKeySetMap release_key_sets_;
|
||||
@@ -322,9 +333,6 @@ class CdmEngine {
|
||||
|
||||
static bool seeded_;
|
||||
|
||||
// Service certificate for the provisioning server.
|
||||
ServiceCertificate provisioning_service_certificate_;
|
||||
|
||||
// usage related variables
|
||||
scoped_ptr<CdmSession> usage_session_;
|
||||
scoped_ptr<UsagePropertySet> usage_property_set_;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
// 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_CDM_SESSION_H_
|
||||
#define WVCDM_CORE_CDM_SESSION_H_
|
||||
@@ -8,6 +10,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "crypto_session.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "device_files.h"
|
||||
#include "file_store.h"
|
||||
#include "initialization_data.h"
|
||||
@@ -145,15 +148,18 @@ class CdmSession {
|
||||
virtual CdmUsageSupportType get_usage_support_type()
|
||||
{ return usage_support_type_; }
|
||||
|
||||
// ReleaseCrypto() - Closes the underlying crypto session but leaves this
|
||||
// object alive. It is invalid to call any method that requires a crypto
|
||||
// session after calling this. Since calling this renders this object mostly
|
||||
// useless, it is preferable to simply delete this object (which will also
|
||||
// release the underlying crypto session) rather than call this method.
|
||||
virtual CdmResponseType ReleaseCrypto();
|
||||
// This method will remove keys by resetting crypto resources and
|
||||
// policy information. This renders the session mostly useless and it is
|
||||
// preferable to simply delete this object rather than call this method.
|
||||
virtual CdmResponseType RemoveKeys();
|
||||
|
||||
// Delete current license and matching usage record
|
||||
bool DeleteLicense();
|
||||
// Remove the current offline license and/or matching usage record, if any
|
||||
// exist.
|
||||
CdmResponseType RemoveLicense();
|
||||
// Delete this session's associated license or usage record file. Note that,
|
||||
// unlike RemoveLicense(), this method ONLY affects the file system and does
|
||||
// not touch the usage table headers.
|
||||
bool DeleteLicenseFile();
|
||||
|
||||
// Generate unique ID for each new session.
|
||||
CdmSessionId GenerateSessionId();
|
||||
@@ -199,6 +205,12 @@ class CdmSession {
|
||||
|
||||
bool UpdateUsageInfo();
|
||||
|
||||
CdmResponseType GenerateKeyRequestInternal(
|
||||
const InitializationData& init_data, CdmLicenseType license_type,
|
||||
const CdmAppParameterMap& app_parameters, CdmKeyRequest* key_request);
|
||||
virtual CdmResponseType AddKeyInternal(const CdmKeyResponse& key_response);
|
||||
void UpdateRequestLatencyTiming(CdmResponseType sts);
|
||||
|
||||
// These setters are for testing only. Takes ownership of the pointers.
|
||||
void set_license_parser(CdmLicense* license_parser);
|
||||
void set_crypto_session(CryptoSession* crypto_session);
|
||||
@@ -209,6 +221,8 @@ class CdmSession {
|
||||
metrics::SessionMetrics* metrics_;
|
||||
metrics::CryptoMetrics* crypto_metrics_;
|
||||
metrics::TimerMetric life_span_;
|
||||
metrics::TimerMetric license_request_latency_;
|
||||
CdmKeyRequestType key_request_type_;
|
||||
|
||||
bool initialized_;
|
||||
bool closed_; // Session closed, but final shared_ptr has not been released.
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
// 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_CDM_SESSION_MAP_H_
|
||||
#define WVCDM_CORE_CDM_SESSION_MAP_H_
|
||||
@@ -8,6 +10,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "cdm_session.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "lock.h"
|
||||
#include "shared_ptr.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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_CERTIFICATE_PROVISIONING_H_
|
||||
#define WVCDM_CORE_CERTIFICATE_PROVISIONING_H_
|
||||
@@ -6,6 +8,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "crypto_session.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "license_protocol.pb.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "oemcrypto_adapter.h"
|
||||
@@ -44,10 +47,6 @@ class CertificateProvisioning {
|
||||
std::string* cert, std::string* wrapped_key);
|
||||
|
||||
private:
|
||||
// TODO(b/36897239): Remove this once it is no longer needed.
|
||||
bool GetProvisioningTokenType(
|
||||
video_widevine::ClientIdentification::TokenType* token_type);
|
||||
|
||||
bool SetSpoidParameter(const std::string& origin, const std::string& spoid,
|
||||
video_widevine::ProvisioningRequest* request);
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
// 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_CLIENT_IDENTIFICATION_H_
|
||||
#define WVCDM_CORE_CLIENT_IDENTIFICATION_H_
|
||||
@@ -6,6 +8,7 @@
|
||||
// ClientIdentification fills in the ClientIdentification portion
|
||||
// of the License or Provisioning request messages.
|
||||
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "license_protocol.pb.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Clock - Platform independent interface for a time library
|
||||
//
|
||||
#ifndef WVCDM_CORE_CLOCK_H_
|
||||
#define WVCDM_CORE_CLOCK_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
// Provides time related information. The implementation is platform dependent.
|
||||
class Clock {
|
||||
public:
|
||||
Clock() {}
|
||||
virtual ~Clock() {}
|
||||
|
||||
// Provides the number of seconds since an epoch - 01/01/1970 00:00 UTC
|
||||
virtual int64_t GetCurrentTime();
|
||||
};
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_CLOCK_H_
|
||||
@@ -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,4 +1,6 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
// 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_CRYPTO_KEY_H_
|
||||
#define WVCDM_CORE_CRYPTO_KEY_H_
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
// 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_CRYPTO_SESSSION_H_
|
||||
#define WVCDM_CORE_CRYPTO_SESSSION_H_
|
||||
@@ -8,6 +10,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "key_session.h"
|
||||
#include "lock.h"
|
||||
#include "metrics_collections.h"
|
||||
@@ -196,10 +199,13 @@ class CryptoSession {
|
||||
virtual bool GenerateSubSessionNonce(const std::string& sub_session_key_id,
|
||||
bool* exists, uint32_t* nonce);
|
||||
|
||||
virtual CdmResponseType GetProvisioningMethod(
|
||||
SecurityLevel requested_security_level,
|
||||
CdmClientTokenType* token_type);
|
||||
|
||||
private:
|
||||
friend class CryptoSessionForTest;
|
||||
|
||||
bool GetProvisioningMethod(CdmClientTokenType* token_type);
|
||||
void Init();
|
||||
void Terminate();
|
||||
bool GetTokenFromKeybox(std::string* token);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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_DEVICE_FILES_H_
|
||||
#define WVCDM_CORE_DEVICE_FILES_H_
|
||||
@@ -10,6 +12,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "device_files.pb.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
@@ -105,9 +108,13 @@ class DeviceFiles {
|
||||
const CdmUsageEntry& usage_entry,
|
||||
uint32_t usage_entry_number);
|
||||
|
||||
// Extract KSIDs from usage information on the file system.
|
||||
virtual bool ListUsageRecords(const std::string& app_id,
|
||||
std::vector<std::string>* ksids);
|
||||
// Retrieve usage identifying information stored on the file system.
|
||||
// The caller needs to specify at least one of |ksids| or
|
||||
// |provider_session_tokens|
|
||||
virtual bool ListUsageIds(
|
||||
const std::string& app_id,
|
||||
std::vector<std::string>* ksids,
|
||||
std::vector<std::string>* provider_session_tokens);
|
||||
|
||||
// Get the provider session token for the given key_set_id.
|
||||
virtual bool GetProviderSessionToken(const std::string& app_id,
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
// 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 <map>
|
||||
#include <string>
|
||||
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "content_key_session.h"
|
||||
#include "key_session.h"
|
||||
#include "crypto_key.h"
|
||||
#include "metrics_collections.h"
|
||||
#include "override.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
@@ -15,20 +25,29 @@ 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);
|
||||
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;
|
||||
virtual OEMCryptoResult SelectKey(const std::string& key_id,
|
||||
CdmCipherMode cipher_mode) OVERRIDE;
|
||||
|
||||
private:
|
||||
std::vector<CryptoKey> keys_;
|
||||
// The object returned by this function contains raw pointers to the passed-in
|
||||
// CryptoKey object. Care should be taken that it does not outlive the
|
||||
// CryptoKey.
|
||||
OEMCrypto_EntitledContentKeyObject MakeOecEntitledKey(
|
||||
const CryptoKey& input_key);
|
||||
|
||||
std::map<std::string, CryptoKey> entitled_keys_;
|
||||
};
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_ENTITLEMENT_KEY_SESSSION_H_
|
||||
#endif // WVCDM_CORE_ENTITLEMENT_KEY_SESSSION_H_
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// File - Platform independent interface for a File class
|
||||
//
|
||||
#ifndef WVCDM_CORE_FILE_STORE_H_
|
||||
#define WVCDM_CORE_FILE_STORE_H_
|
||||
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
// File class. The implementation is platform dependent.
|
||||
class File {
|
||||
public:
|
||||
virtual ssize_t Read(char* buffer, size_t bytes);
|
||||
virtual ssize_t Write(const char* buffer, size_t bytes);
|
||||
virtual void Close();
|
||||
|
||||
protected:
|
||||
class Impl;
|
||||
|
||||
File(Impl*);
|
||||
virtual ~File();
|
||||
|
||||
private:
|
||||
Impl* impl_;
|
||||
|
||||
friend class FileSystem;
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(File);
|
||||
};
|
||||
|
||||
class FileSystem {
|
||||
public:
|
||||
class Impl;
|
||||
|
||||
// defines as bit flag
|
||||
enum OpenFlags {
|
||||
kNoFlags = 0,
|
||||
kCreate = 1,
|
||||
kReadOnly = 2, // defaults to read and write access
|
||||
kTruncate = 4
|
||||
};
|
||||
|
||||
FileSystem();
|
||||
FileSystem(const std::string& origin, void* extra_data);
|
||||
virtual ~FileSystem();
|
||||
|
||||
virtual File* Open(const std::string& file_path, int flags);
|
||||
|
||||
virtual bool Exists(const std::string& file_path);
|
||||
virtual bool Remove(const std::string& file_path);
|
||||
virtual ssize_t FileSize(const std::string& file_path);
|
||||
|
||||
// Return the filenames stored at dir_path.
|
||||
// dir_path will be stripped from the returned names.
|
||||
virtual bool List(const std::string& dir_path,
|
||||
std::vector<std::string>* names);
|
||||
|
||||
const std::string& origin() const { return origin_; }
|
||||
void SetOrigin(const std::string& origin);
|
||||
|
||||
const std::string& identifier() const { return identifier_; }
|
||||
void SetIdentifier(const std::string& identifier);
|
||||
bool IsGlobal() const { return identifier_.empty(); }
|
||||
|
||||
private:
|
||||
Impl* impl_;
|
||||
std::string origin_;
|
||||
std::string identifier_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(FileSystem);
|
||||
};
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_FILE_STORE_H_
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2014 Google Inc. All Rights Reserved.
|
||||
// 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 CORE_INCLUDE_INITIALIZATION_DATA_H_
|
||||
#define CORE_INCLUDE_INITIALIZATION_DATA_H_
|
||||
|
||||
@@ -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_
|
||||
|
||||
@@ -43,4 +47,4 @@ typedef std::map<std::string, CryptoSessionId> SubLicenseSessionMap;
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_KEY_SESSSION_H_
|
||||
#endif // WVCDM_CORE_KEY_SESSSION_H_
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
// 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_LICENSE_H_
|
||||
#define WVCDM_CORE_LICENSE_H_
|
||||
|
||||
#include <set>
|
||||
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "initialization_data.h"
|
||||
#include "license_protocol.pb.h"
|
||||
#include "scoped_ptr.h"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2016 Google Inc. All Rights Reserved.
|
||||
// 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_LICENSE_KEY_STATUS_H_
|
||||
#define WVCDM_CORE_LICENSE_KEY_STATUS_H_
|
||||
@@ -6,6 +8,7 @@
|
||||
#include <map>
|
||||
|
||||
#include "crypto_session.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "license_protocol.pb.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Lock - Platform independent interface for a Mutex class
|
||||
//
|
||||
#ifndef WVCDM_CORE_LOCK_H_
|
||||
#define WVCDM_CORE_LOCK_H_
|
||||
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
// Simple lock class. The implementation is platform dependent.
|
||||
//
|
||||
// The lock must be unlocked by the thread that locked it.
|
||||
// The lock is also not recursive (ie. cannot be taken multiple times).
|
||||
class Lock {
|
||||
public:
|
||||
Lock();
|
||||
~Lock();
|
||||
|
||||
void Acquire();
|
||||
void Release();
|
||||
|
||||
friend class AutoLock;
|
||||
|
||||
private:
|
||||
class Impl;
|
||||
Impl* impl_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(Lock);
|
||||
};
|
||||
|
||||
// Manages the lock automatically. It will be locked when AutoLock
|
||||
// is constructed and release when AutoLock goes out of scope.
|
||||
class AutoLock {
|
||||
public:
|
||||
explicit AutoLock(Lock& lock) : lock_(&lock) { lock_->Acquire(); }
|
||||
|
||||
explicit AutoLock(Lock* lock) : lock_(lock) { lock_->Acquire(); }
|
||||
|
||||
~AutoLock() { lock_->Release(); }
|
||||
|
||||
private:
|
||||
Lock* lock_;
|
||||
|
||||
CORE_DISALLOW_COPY_AND_ASSIGN(AutoLock);
|
||||
};
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_LOCK_H_
|
||||
@@ -1,46 +0,0 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
//
|
||||
// Log - Platform independent interface for a Logging class
|
||||
//
|
||||
#ifndef WVCDM_CORE_LOG_H_
|
||||
#define WVCDM_CORE_LOG_H_
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
// Simple logging class. The implementation is platform dependent.
|
||||
|
||||
typedef enum {
|
||||
LOG_ERROR,
|
||||
LOG_WARN,
|
||||
LOG_INFO,
|
||||
LOG_DEBUG,
|
||||
LOG_VERBOSE
|
||||
} LogPriority;
|
||||
|
||||
extern LogPriority g_cutoff;
|
||||
|
||||
// Enable/disable verbose logging (LOGV).
|
||||
// This function is supplied for cases where the system layer does not
|
||||
// initialize logging. This is also needed to initialize logging in
|
||||
// unit tests.
|
||||
void InitLogging();
|
||||
|
||||
void Log(const char* file, const char* function, int line, LogPriority level,
|
||||
const char* fmt, ...);
|
||||
|
||||
// Log APIs
|
||||
#ifndef LOGE
|
||||
#define LOGE(...) Log(__FILE__, __func__, __LINE__, \
|
||||
wvcdm::LOG_ERROR, __VA_ARGS__)
|
||||
#define LOGW(...) Log(__FILE__, __func__, __LINE__, \
|
||||
wvcdm::LOG_WARN, __VA_ARGS__)
|
||||
#define LOGI(...) Log(__FILE__, __func__, __LINE__, \
|
||||
wvcdm::LOG_INFO, __VA_ARGS__)
|
||||
#define LOGD(...) Log(__FILE__, __func__, __LINE__, \
|
||||
wvcdm::LOG_DEBUG, __VA_ARGS__)
|
||||
#define LOGV(...) Log(__FILE__, __func__, __LINE__, \
|
||||
wvcdm::LOG_VERBOSE, __VA_ARGS__)
|
||||
#endif
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_LOG_H_
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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_OEMCRYPTO_ADAPTER_H_
|
||||
#define WVCDM_CORE_OEMCRYPTO_ADAPTER_H_
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2015 Google Inc. All Rights Reserved.
|
||||
// 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.
|
||||
// TODO: Import to core/, use everywhere.
|
||||
#ifndef WVCDM_CDM_OVERRIDE_H_
|
||||
#define WVCDM_CDM_OVERRIDE_H_
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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_POLICY_ENGINE_H_
|
||||
#define WVCDM_CORE_POLICY_ENGINE_H_
|
||||
@@ -6,6 +8,7 @@
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "license_key_status.h"
|
||||
#include "license_protocol.pb.h"
|
||||
#include "scoped_ptr.h"
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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.
|
||||
//
|
||||
// Description:
|
||||
// Declaration of classes representing AES and RSA public keys used
|
||||
@@ -24,6 +26,7 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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_PROPERTIES_H_
|
||||
#define WVCDM_CORE_PROPERTIES_H_
|
||||
@@ -7,6 +9,7 @@
|
||||
#include <string>
|
||||
|
||||
#include "cdm_client_property_set.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "lock.h"
|
||||
#include "scoped_ptr.h"
|
||||
#include "wv_cdm_types.h"
|
||||
@@ -67,10 +70,6 @@ class Properties {
|
||||
std::string* service_certificate);
|
||||
static bool SetServiceCertificate(const CdmSessionId& session_id,
|
||||
const std::string& service_certificate);
|
||||
static bool GetDeviceProvisioningServiceCertificate(
|
||||
const CdmSessionId& session_id, std::string* service_certificate);
|
||||
static bool SetDeviceProvisioningServiceCertificate(
|
||||
const CdmSessionId& session_id, const std::string& service_certificate);
|
||||
static bool UsePrivacyMode(const CdmSessionId& session_id);
|
||||
static uint32_t GetSessionSharingId(const CdmSessionId& session_id);
|
||||
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
|
||||
/*********************************************************************
|
||||
* pst_report.h
|
||||
*
|
||||
* Reference APIs needed to support Widevine's crypto algorithms.
|
||||
*********************************************************************/
|
||||
|
||||
#ifndef PST_REPORT_H_
|
||||
#define PST_REPORT_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "string_conversions.h" // needed for htonll64.
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
class Unpacked_PST_Report {
|
||||
public:
|
||||
// This object does not own the buffer, and does not check that buffer
|
||||
// is not null.
|
||||
Unpacked_PST_Report(uint8_t *buffer) : buffer_(buffer) {}
|
||||
|
||||
// Copy and move semantics of this class is like that of a pointer.
|
||||
Unpacked_PST_Report(const Unpacked_PST_Report& other) :
|
||||
buffer_(other.buffer_) {}
|
||||
|
||||
Unpacked_PST_Report& operator=(const Unpacked_PST_Report& other) {
|
||||
buffer_ = other.buffer_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
size_t report_size() const {
|
||||
return pst_length() + kraw_pst_report_size;
|
||||
}
|
||||
|
||||
static size_t report_size(size_t pst_length) {
|
||||
return pst_length + kraw_pst_report_size;
|
||||
}
|
||||
|
||||
uint8_t status() const {
|
||||
return static_cast<uint8_t>(* (buffer_ + kstatus_offset));
|
||||
}
|
||||
|
||||
void set_status(uint8_t value) {
|
||||
buffer_[kstatus_offset] = value;
|
||||
}
|
||||
|
||||
uint8_t* signature() {
|
||||
return buffer_ + ksignature_offset;
|
||||
}
|
||||
|
||||
uint8_t clock_security_level() const {
|
||||
return static_cast<uint8_t>(* (buffer_ + kclock_security_level_offset));
|
||||
}
|
||||
|
||||
void set_clock_security_level(uint8_t value) {
|
||||
buffer_[kclock_security_level_offset] = value;
|
||||
}
|
||||
|
||||
uint8_t pst_length() const {
|
||||
return static_cast<uint8_t>(* (buffer_ + kpst_length_offset));
|
||||
}
|
||||
|
||||
void set_pst_length(uint8_t value) {
|
||||
buffer_[kpst_length_offset] = value;
|
||||
}
|
||||
|
||||
uint8_t padding() const {
|
||||
return static_cast<uint8_t>(* (buffer_ + kpadding_offset));
|
||||
}
|
||||
|
||||
void set_padding(uint8_t value) {
|
||||
buffer_[kpadding_offset] = value;
|
||||
}
|
||||
|
||||
// In host byte order.
|
||||
int64_t seconds_since_license_received() const {
|
||||
int64_t time;
|
||||
memcpy(&time, buffer_ + kseconds_since_license_received_offset,
|
||||
sizeof(int64_t));
|
||||
return ntohll64(time);
|
||||
}
|
||||
|
||||
// Parameter time is in host byte order.
|
||||
void set_seconds_since_license_received(int64_t time) const {
|
||||
time = ntohll64(time);
|
||||
memcpy(buffer_ + kseconds_since_license_received_offset, &time,
|
||||
sizeof(int64_t));
|
||||
}
|
||||
|
||||
// In host byte order.
|
||||
int64_t seconds_since_first_decrypt() const {
|
||||
int64_t time;
|
||||
memcpy(&time, buffer_ + kseconds_since_first_decrypt_offset,
|
||||
sizeof(int64_t));
|
||||
return ntohll64(time);
|
||||
}
|
||||
|
||||
// Parameter time is in host byte order.
|
||||
void set_seconds_since_first_decrypt(int64_t time) const {
|
||||
time = ntohll64(time);
|
||||
memcpy(buffer_ + kseconds_since_first_decrypt_offset, &time,
|
||||
sizeof(int64_t));
|
||||
}
|
||||
|
||||
// In host byte order.
|
||||
int64_t seconds_since_last_decrypt() const {
|
||||
int64_t time;
|
||||
memcpy(&time, buffer_ + kseconds_since_last_decrypt_offset,
|
||||
sizeof(int64_t));
|
||||
return ntohll64(time);
|
||||
}
|
||||
|
||||
// Parameter time is in host byte order.
|
||||
void set_seconds_since_last_decrypt(int64_t time) const {
|
||||
time = ntohll64(time);
|
||||
memcpy(buffer_ + kseconds_since_last_decrypt_offset, &time,
|
||||
sizeof(int64_t));
|
||||
}
|
||||
|
||||
uint8_t* pst() {
|
||||
return (buffer_ + kpst_offset);
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t *buffer_;
|
||||
|
||||
// Size of the PST_Report without the pst string.
|
||||
static const size_t kraw_pst_report_size = 48;
|
||||
static const size_t ksignature_offset = 0;
|
||||
static const size_t kstatus_offset = 20;
|
||||
static const size_t kclock_security_level_offset = 21;
|
||||
static const size_t kpst_length_offset = 22;
|
||||
static const size_t kpadding_offset = 23;
|
||||
static const size_t kseconds_since_license_received_offset = 24;
|
||||
static const size_t kseconds_since_first_decrypt_offset = 32;
|
||||
static const size_t kseconds_since_last_decrypt_offset = 40;
|
||||
static const size_t kpst_offset = 48;
|
||||
};
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // PST_REPORT_H_
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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.
|
||||
//
|
||||
// A simple and partial implementation of scoped_ptr class.
|
||||
// The implementation is copied from gtest/include/gtest/internal/gtest-port.h.
|
||||
@@ -6,7 +8,7 @@
|
||||
#ifndef WVCDM_CORE_SCOPED_PTR_H_
|
||||
#define WVCDM_CORE_SCOPED_PTR_H_
|
||||
|
||||
#include "wv_cdm_types.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
// 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_SERVICE_CERTIFICATE_H_
|
||||
#define WVCDM_CORE_SERVICE_CERTIFICATE_H_
|
||||
@@ -13,6 +15,7 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "license_protocol.pb.h"
|
||||
#include "privacy_crypto.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
@@ -1,31 +1,7 @@
|
||||
// Copyright 2017 Google Inc. All rights reserved.
|
||||
// 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.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// from google3/util/gtl/shared_ptr.h
|
||||
// from protobuf/src/google/protobuf/stubs/shared_ptr.h
|
||||
|
||||
@@ -36,9 +12,17 @@
|
||||
#include <stddef.h>
|
||||
#include <memory>
|
||||
|
||||
#include "lock.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
extern Lock shared_ptr_ref_count_lock_;
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
namespace {
|
||||
|
||||
bool Barrier_AtomicIncrement(volatile uint32_t* ptr, uint32_t value) {
|
||||
*ptr += value;
|
||||
return *ptr;
|
||||
@@ -49,10 +33,12 @@ bool NoBarrier_AtomicIncrement(volatile uint32_t* ptr, uint32_t value) {
|
||||
}
|
||||
|
||||
inline bool RefCountDec(volatile uint32_t *ptr) {
|
||||
wvcdm::AutoLock auto_lock(wvcdm::shared_ptr_ref_count_lock_);
|
||||
return Barrier_AtomicIncrement(ptr, -1) != 0;
|
||||
}
|
||||
|
||||
inline void RefCountInc(volatile uint32_t *ptr) {
|
||||
wvcdm::AutoLock auto_lock(wvcdm::shared_ptr_ref_count_lock_);
|
||||
NoBarrier_AtomicIncrement(ptr, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
|
||||
#ifndef WVCDM_CORE_STRING_CONVERSIONS_H_
|
||||
#define WVCDM_CORE_STRING_CONVERSIONS_H_
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
std::vector<uint8_t> a2b_hex(const std::string& b);
|
||||
std::vector<uint8_t> a2b_hex(const std::string& label, const std::string& b);
|
||||
std::string a2bs_hex(const std::string& b);
|
||||
std::string b2a_hex(const std::vector<uint8_t>& b);
|
||||
std::string b2a_hex(const std::string& b);
|
||||
std::string Base64Encode(const std::vector<uint8_t>& bin_input);
|
||||
std::vector<uint8_t> Base64Decode(const std::string& bin_input);
|
||||
std::string Base64SafeEncode(const std::vector<uint8_t>& bin_input);
|
||||
std::string Base64SafeEncodeNoPad(const std::vector<uint8_t>& bin_input);
|
||||
std::vector<uint8_t> Base64SafeDecode(const std::string& bin_input);
|
||||
std::string HexEncode(const uint8_t* bytes, unsigned size);
|
||||
std::string IntToString(int value);
|
||||
int64_t htonll64(int64_t x);
|
||||
inline int64_t ntohll64(int64_t x) { return htonll64(x); }
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
#endif // WVCDM_CORE_STRING_CONVERSIONS_H_
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2017 Google Inc. All Rights Reserved.
|
||||
// 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_USAGE_TABLE_HEADER_H_
|
||||
#define WVCDM_CORE_USAGE_TABLE_HEADER_H_
|
||||
@@ -7,6 +9,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "device_files.h"
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "file_store.h"
|
||||
#include "lock.h"
|
||||
#include "metrics_collections.h"
|
||||
@@ -51,22 +54,23 @@ class UsageTableHeader {
|
||||
bool Init(CdmSecurityLevel security_level, CryptoSession* crypto_session);
|
||||
|
||||
// |persistent_license| false indicates usage info record
|
||||
CdmResponseType AddEntry(CryptoSession* crypto_session,
|
||||
bool persistent_license,
|
||||
const CdmKeySetId& key_set_id,
|
||||
const std::string& usage_info_filename,
|
||||
uint32_t* usage_entry_number);
|
||||
CdmResponseType LoadEntry(CryptoSession* crypto_session,
|
||||
const CdmUsageEntry& usage_entry,
|
||||
uint32_t usage_entry_number);
|
||||
CdmResponseType UpdateEntry(CryptoSession* crypto_session,
|
||||
CdmUsageEntry* usage_entry);
|
||||
virtual CdmResponseType AddEntry(CryptoSession* crypto_session,
|
||||
bool persistent_license,
|
||||
const CdmKeySetId& key_set_id,
|
||||
const std::string& usage_info_filename,
|
||||
uint32_t* usage_entry_number);
|
||||
virtual CdmResponseType LoadEntry(CryptoSession* crypto_session,
|
||||
const CdmUsageEntry& usage_entry,
|
||||
uint32_t usage_entry_number);
|
||||
virtual CdmResponseType UpdateEntry(CryptoSession* crypto_session,
|
||||
CdmUsageEntry* usage_entry);
|
||||
|
||||
// The licenses or usage info records specified by |usage_entry_number|
|
||||
// should not be in use by any open CryptoSession objects when calls
|
||||
// to DeleteEntry and MoveEntry are made.
|
||||
CdmResponseType DeleteEntry(uint32_t usage_entry_number, DeviceFiles* handle,
|
||||
metrics::CryptoMetrics* metrics);
|
||||
virtual CdmResponseType DeleteEntry(uint32_t usage_entry_number,
|
||||
DeviceFiles* handle,
|
||||
metrics::CryptoMetrics* metrics);
|
||||
|
||||
private:
|
||||
CdmResponseType MoveEntry(uint32_t from /* usage entry number */,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
// 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_WV_CDM_CONSTANTS_H_
|
||||
#define WVCDM_CORE_WV_CDM_CONSTANTS_H_
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
// Copyright 2012 Google Inc. All Rights Reserved.
|
||||
// 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_WV_CDM_EVENT_LISTENER_H_
|
||||
#define WVCDM_CORE_WV_CDM_EVENT_LISTENER_H_
|
||||
|
||||
#include "disallow_copy_and_assign.h"
|
||||
#include "wv_cdm_types.h"
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
// Copyright 2013 Google Inc. All Rights Reserved.
|
||||
// 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_WV_CDM_TYPES_H_
|
||||
#define WVCDM_CORE_WV_CDM_TYPES_H_
|
||||
@@ -289,7 +291,7 @@ enum CdmResponseType {
|
||||
USAGE_STORE_LICENSE_FAILED = 247,
|
||||
USAGE_STORE_USAGE_INFO_FAILED = 248,
|
||||
USAGE_INVALID_LOAD_ENTRY = 249,
|
||||
REMOVE_ALL_USAGE_INFO_ERROR_4 = 250,
|
||||
/* previously REMOVE_ALL_USAGE_INFO_ERROR_4 = 250, */
|
||||
REMOVE_ALL_USAGE_INFO_ERROR_5 = 251,
|
||||
RELEASE_USAGE_INFO_FAILED = 252,
|
||||
INCORRECT_USAGE_SUPPORT_TYPE_1 = 253,
|
||||
@@ -328,6 +330,12 @@ enum CdmResponseType {
|
||||
NOT_AN_ENTITLEMENT_SESSION = 286,
|
||||
NO_MATCHING_ENTITLEMENT_KEY = 287,
|
||||
LOAD_ENTITLED_CONTENT_KEYS_ERROR = 288,
|
||||
GET_PROVISIONING_METHOD_ERROR = 289,
|
||||
SESSION_NOT_FOUND_17 = 290,
|
||||
SESSION_NOT_FOUND_18 = 291,
|
||||
/* Error code 292 can be reused as it was never present in a release */
|
||||
DEVICE_CANNOT_REPROVISION = 293,
|
||||
SESSION_NOT_FOUND_19 = 294,
|
||||
};
|
||||
|
||||
enum CdmKeyStatus {
|
||||
@@ -340,10 +348,6 @@ enum CdmKeyStatus {
|
||||
};
|
||||
typedef std::map<KeyId, CdmKeyStatus> CdmKeyStatusMap;
|
||||
|
||||
#define CORE_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
TypeName(const TypeName&); \
|
||||
void operator=(const TypeName&)
|
||||
|
||||
enum CdmLicenseType {
|
||||
kLicenseTypeOffline,
|
||||
kLicenseTypeStreaming,
|
||||
@@ -402,7 +406,8 @@ enum CdmSigningAlgorithm {
|
||||
enum CdmClientTokenType {
|
||||
kClientTokenKeybox,
|
||||
kClientTokenDrmCert,
|
||||
kClientTokenOemCert
|
||||
kClientTokenOemCert,
|
||||
kClientTokenUninitialized,
|
||||
};
|
||||
|
||||
// kNonSecureUsageSupport - TEE does not provide any support for usage
|
||||
|
||||
Reference in New Issue
Block a user