Multiple changes

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=224206719
This commit is contained in:
Widevine Buildbot
2018-12-05 21:36:03 +00:00
committed by Fang Yu
parent 57385ffb5e
commit c70235c0bd
6 changed files with 57 additions and 12 deletions

Binary file not shown.

View File

@@ -32,6 +32,11 @@ class WvPLCASProxyEnvironment : public WvPLSDKEnvironment {
*/ */
~WvPLCASProxyEnvironment() override; ~WvPLCASProxyEnvironment() override;
/**
* One-time initialization. Must be called after creating the environment.
*/
virtual WvPLStatus Initialize();
/** /**
* Creates a session for the license request from the Widevine CDM. * Creates a session for the license request from the Widevine CDM.
* *
@@ -42,6 +47,17 @@ class WvPLCASProxyEnvironment : public WvPLSDKEnvironment {
*/ */
virtual WvPLStatus CreateSession(const std::string& cas_license_request, virtual WvPLStatus CreateSession(const std::string& cas_license_request,
WvPLCASProxySession** cas_proxy_session); WvPLCASProxySession** cas_proxy_session);
/**
* Set the certificate status list system-wide.
* |cert_list| specifies the device certificate status
* list as std::string or certificate status list response from keysmith.
*
* @param cert_list
*
* @return WvPLStatus enumeration
*/
WvPLStatus SetDeviceCertificateStatusList(const std::string& cert_list) const;
}; };
} // namespace wv_pl_sdk } // namespace wv_pl_sdk

View File

@@ -73,7 +73,9 @@ class WvPLCASProxySession : public WvPLSDKSession {
friend class WvPLCASProxyEnvironmentTest; friend class WvPLCASProxyEnvironmentTest;
friend class WvPLCASProxySessionTest; friend class WvPLCASProxySessionTest;
explicit WvPLCASProxySession(const std::string& cas_license_request_from_cdm) {} WvPLCASProxySession(
const widevine::DrmRootCertificate* drm_root_certificate,
const std::string& cas_license_request_from_cdm);
WvPLStatus ParsePsshData( WvPLStatus ParsePsshData(
WvPLWidevinePsshData* wvpl_widevine_pssh_data) const override; WvPLWidevinePsshData* wvpl_widevine_pssh_data) const override;

View File

@@ -9,9 +9,10 @@
#ifndef SDK_EXTERNAL_COMMON_WVPL_WVPL_SDK_ENVIRONMENT_H_ #ifndef SDK_EXTERNAL_COMMON_WVPL_WVPL_SDK_ENVIRONMENT_H_
#define SDK_EXTERNAL_COMMON_WVPL_WVPL_SDK_ENVIRONMENT_H_ #define SDK_EXTERNAL_COMMON_WVPL_WVPL_SDK_ENVIRONMENT_H_
#include <memory>
#include <string> #include <string>
#include "common/certificate_type.h" #include "common/drm_root_certificate.h"
#include "sdk/external/common/wvpl/wvpl_types.h" #include "sdk/external/common/wvpl/wvpl_types.h"
#include "protos/public/device_certificate_status.pb.h" #include "protos/public/device_certificate_status.pb.h"
#include "protos/public/provisioned_device_info.pb.h" #include "protos/public/provisioned_device_info.pb.h"
@@ -66,9 +67,10 @@ class WvPLSDKEnvironment {
const std::string& service_certificate, const std::string& service_private_key, const std::string& service_certificate, const std::string& service_private_key,
const std::string& service_private_key_passphrase); const std::string& service_private_key_passphrase);
// Returns the DRM Root Certificate type. This would be a setting passed into // Returns the DRM root certificate configured for this environment.
// the environment, by a derived class constructor. const widevine::DrmRootCertificate* drm_root_certificate() const {
virtual std::string GetDrmCertificateType() { return drm_certificate_type_; } return drm_root_certificate_.get();
}
protected: protected:
// Return the signature for the provider specified in the |config_values| // Return the signature for the provider specified in the |config_values|
@@ -83,6 +85,8 @@ class WvPLSDKEnvironment {
const widevine::DeviceCertificateStatusList& const widevine::DeviceCertificateStatusList&
certificate_status_list); certificate_status_list);
WvPLStatus SetDeviceCertificateStatusList(const std::string& cert_list) const;
// Number of seconds until the certificate status list expires after its // Number of seconds until the certificate status list expires after its
// creation time. Default value is 604800 seconds. // creation time. Default value is 604800 seconds.
uint32_t device_certificate_expiration_seconds_ = 604800; uint32_t device_certificate_expiration_seconds_ = 604800;
@@ -100,9 +104,8 @@ class WvPLSDKEnvironment {
bool is_service_certificate_loaded_ = false; bool is_service_certificate_loaded_ = false;
// If true, allow devices not in the certificate status list. // If true, allow devices not in the certificate status list.
bool allow_unknown_device_ = false; bool allow_unknown_device_ = false;
// DRM Certificate type. // DRM root certificate used for verifying all other DRM certificates.
widevine::CertificateType certificate_type_ = std::unique_ptr<widevine::DrmRootCertificate> drm_root_certificate_;
widevine::kCertificateTypeProduction;
private: private:
/** /**

View File

@@ -9,6 +9,7 @@
#ifndef SDK_EXTERNAL_COMMON_WVPL_WVPL_SDK_SESSION_H_ #ifndef SDK_EXTERNAL_COMMON_WVPL_WVPL_SDK_SESSION_H_
#define SDK_EXTERNAL_COMMON_WVPL_WVPL_SDK_SESSION_H_ #define SDK_EXTERNAL_COMMON_WVPL_WVPL_SDK_SESSION_H_
#include <memory>
#include "sdk/external/common/wvpl/wvpl_types.h" #include "sdk/external/common/wvpl/wvpl_types.h"
#include "protos/public/client_identification.pb.h" #include "protos/public/client_identification.pb.h"
#include "protos/public/device_certificate_status.pb.h" #include "protos/public/device_certificate_status.pb.h"
@@ -17,13 +18,16 @@
#include "protos/public/provisioned_device_info.pb.h" #include "protos/public/provisioned_device_info.pb.h"
namespace widevine { namespace widevine {
class DrmRootCertificate;
class SessionInit; class SessionInit;
} } // namespace widevine
namespace widevine_server { namespace widevine_server {
namespace wv_pl_sdk { namespace wv_pl_sdk {
class WvPLSDKSession { class WvPLSDKSession {
public: public:
explicit WvPLSDKSession(
const widevine::DrmRootCertificate* drm_root_certificate);
virtual ~WvPLSDKSession() = 0; virtual ~WvPLSDKSession() = 0;
public: public:
@@ -102,7 +106,7 @@ class WvPLSDKSession {
} }
protected: protected:
uint32_t system_id_ = 0xFFFFFFFF; const widevine::DrmRootCertificate* drm_root_certificate_;
std::string user_agent_; std::string user_agent_;
std::vector<WvPLKey> keys_; std::vector<WvPLKey> keys_;
WvPLPlaybackPolicy policy_; WvPLPlaybackPolicy policy_;
@@ -110,7 +114,6 @@ class WvPLSDKSession {
WvPLWidevinePsshData pssh_data_; WvPLWidevinePsshData pssh_data_;
widevine::ClientIdentification client_id_; widevine::ClientIdentification client_id_;
bool has_pssh_data_ = false; bool has_pssh_data_ = false;
bool has_system_id_ = false;
bool has_client_id_ = false; bool has_client_id_ = false;
MessageType message_type_ = UNKNOWN; MessageType message_type_ = UNKNOWN;
PlatformVerificationStatus platform_verification_status_ = PlatformVerificationStatus platform_verification_status_ =
@@ -182,7 +185,28 @@ class WvPLSDKSession {
void CopySessionState(const WvPLSessionState& wvpl_session_state, void CopySessionState(const WvPLSessionState& wvpl_session_state,
widevine::SessionState* session_state); widevine::SessionState* session_state);
// Set system_id value.
virtual void SetSystemId(uint32_t system_id);
// Return has_system_id_ value. True if session has system id.
virtual bool HasSystemId() const;
// Return system_id value in uint32_t. The function will crash if it does not
// have system_id.
virtual uint32_t GetSystemId() const;
/**
* Use system_id to loop up device info.
*
* @return WvPLStatus - Status::OK if success, else error.
*/
virtual WvPLStatus LookupDeviceInfo(
uint32_t system_id,
widevine::ProvisionedDeviceInfo* provisioned_device_info) const;
private: private:
std::unique_ptr<uint32_t> system_id_;
/** /**
* Parses WvPLWidevinePsshData in the new license request. * Parses WvPLWidevinePsshData in the new license request.
* *

View File

@@ -110,7 +110,7 @@ inline bool operator!=(const Status& s1, const Status& s2) {
// Prints a human-readable representation of 'x' to 'os'. // Prints a human-readable representation of 'x' to 'os'.
std::ostream& operator<<(std::ostream& os, const Status& x); std::ostream& operator<<(std::ostream& os, const Status& x);
#define CHECK_OK(expression) CHECK_EQ(util::error::OK, expression.error_code()) #define CHECK_OK(expression) CHECK(expression.ok()) << expression.ToString()
} // namespace util } // namespace util