Source release 17.1.0

This commit is contained in:
John "Juce" Bruce
2022-07-07 17:14:31 -07:00
parent 8c17574083
commit 694cf6fb25
2233 changed files with 272026 additions and 223371 deletions

View File

@@ -1,6 +1,6 @@
// 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.
// source code may only be used and distributed under the Widevine License
// Agreement.
// Based on the EME draft spec from 2016 June 10.
// http://www.w3.org/TR/2016/WD-encrypted-media-20160610/"
#ifndef WVCDM_CDM_CDM_H_
@@ -31,12 +31,13 @@ namespace widevine {
class CDM_EXPORT ITimerClient {
public:
virtual ~ITimerClient() {}
// Called by ITimer when a timer expires.
virtual void onTimerExpired(void* context) = 0;
protected:
ITimerClient() {}
virtual ~ITimerClient() {}
};
class CDM_EXPORT Cdm : public ITimerClient {
@@ -194,6 +195,14 @@ class CDM_EXPORT Cdm : public ITimerClient {
kL3 = 3,
};
// Status code returned by getProvisioningStatus API.
enum ProvisioningStatus : int32_t {
kProvisioned = 0,
kUnknownProvisionStatus = 1,
kNeedsDrmCertProvisioning = 2,
kNeedsOemCertProvisioning = 3,
};
// A map of key statuses.
// See Cdm::getKeyStatuses().
typedef std::map<std::string, KeyStatus> KeyStatusMap;
@@ -203,6 +212,8 @@ class CDM_EXPORT Cdm : public ITimerClient {
// See Cdm::createSession().
class IEventListener {
public:
virtual ~IEventListener() {}
// A message (license request, renewal, etc.) to be dispatched to the
// application's license server.
// The response, if successful, should be provided back to the CDM via a
@@ -220,7 +231,6 @@ class CDM_EXPORT Cdm : public ITimerClient {
protected:
IEventListener() {}
virtual ~IEventListener() {}
};
// A storage interface provided by the application. This defines the "origin"
@@ -240,6 +250,8 @@ class CDM_EXPORT Cdm : public ITimerClient {
// See http://www.w3.org/TR/encrypted-media/#privacy-storedinfo.
class IStorage {
public:
virtual ~IStorage() {}
virtual bool read(const std::string& name, std::string* data) = 0;
virtual bool write(const std::string& name, const std::string& data) = 0;
virtual bool exists(const std::string& name) = 0;
@@ -256,7 +268,6 @@ class CDM_EXPORT Cdm : public ITimerClient {
protected:
IStorage() {}
virtual ~IStorage() {}
};
// A clock interface provided by the application, independent of CDM
@@ -264,12 +275,13 @@ class CDM_EXPORT Cdm : public ITimerClient {
// See Cdm::initialize().
class IClock {
public:
virtual ~IClock() {}
// Returns the current time in milliseconds since 1970 UTC.
virtual int64_t now() = 0;
protected:
IClock() {}
virtual ~IClock() {}
};
// A timer interface provided by the application, independent of CDM
@@ -284,6 +296,8 @@ class CDM_EXPORT Cdm : public ITimerClient {
// setTimeout() again inside the timeout callback.
class ITimer {
public:
virtual ~ITimer() {}
// This typedef is for backward compatibility with v3.0.0.
typedef ITimerClient IClient;
@@ -296,38 +310,40 @@ class CDM_EXPORT Cdm : public ITimerClient {
protected:
ITimer() {}
virtual ~ITimer() {}
};
// Client information, provided by the application, independent of CDM
// instances.
// See Cdm::initialize().
// These parameters end up as client identification in license requests.
// All fields may be used by a license server proxy to drive business logic.
// Some fields are required (indicated below), but please fill out as many
// as make sense for your application.
// No user-identifying information may be put in these fields!
// The CE CDM has various pieces of client information baked into it at
// compile-time. These can be retrieved at runtime by Cdm::getClientInfo(),
// which returns them in this struct.
// These parameters match the client identification in license requests.
struct ClientInfo {
// The name of the product or application, e.g. "TurtleTube"
// Required.
std::string product_name;
// The name of the company who makes the device, e.g. "Kubrick, Inc."
// Required.
// The name of the company who makes the client, e.g. "KubrickTech".
// This matches the "Make" field in the Widevine Integration Console.
std::string company_name;
// The name of the device, e.g. "HAL"
std::string device_name;
// The device model, e.g. "HAL 9000"
// Required.
// The client's model name, e.g. "HAL 9000".
// This matches the "Model" field in the Widevine Integration Console.
std::string model_name;
// The architecture of the device, e.g. "x86-64"
// The client's model year, e.g. "2001".
// Can be used to distinguish different devices with the same model name.
// This matches the "Year" field in the Widevine Integration Console.
std::string model_year;
// The name or codename of the product or application, e.g. "clarke".
// This may be the same as "model_name".
std::string product_name;
// The name or codename of the client, e.g. "HAL".
// This may be the same as "model_name" or "product_name".
std::string device_name;
// The CPU architecture of the client, e.g. "ARMv7".
std::string arch_name;
// Information about the build of the browser, application, or platform into
// which the CDM is integrated, e.g. "v2.71828, 2038-01-19-03:14:07"
// A string containing build information about the CE CDM and the client
// it's integrated into. Consists of multiple values separated by spaces
// and vertical pipes. (e.g. " | ")
std::string build_info;
};
@@ -338,21 +354,23 @@ class CDM_EXPORT Cdm : public ITimerClient {
// Logging is controlled by |verbosity|.
// Must be called and must return kSuccess before create() is called.
static Status initialize(SecureOutputType secure_output_type,
const ClientInfo& client_info, IStorage* storage,
IClock* clock, ITimer* timer, LogLevel verbosity);
IStorage* storage, IClock* clock, ITimer* timer,
LogLevel verbosity);
// This is a variant of the above function that allows the caller to pass a
// Sandbox ID. Platforms that use Sandbox IDs should use this initalize()
// function instead of the previous one. Platforms that do not use Sandbox IDs
// should not use this version of initialize().
static Status initialize(SecureOutputType secure_output_type,
const ClientInfo& client_info, IStorage* storage,
IClock* clock, ITimer* timer, LogLevel verbosity,
const std::string& sandbox_id);
IStorage* storage, IClock* clock, ITimer* timer,
LogLevel verbosity, const std::string& sandbox_id);
// Query the CDM library version.
static const char* version();
// Retrieves the client information for this CE CDM integration.
static Status getClientInfo(ClientInfo* client_info);
// Constructs a new CDM instance.
// initialize() must be called first and must return kSuccess before a CDM
// instance may be constructed.
@@ -387,7 +405,7 @@ class CDM_EXPORT Cdm : public ITimerClient {
static Cdm* create(IEventListener* listener, IStorage* storage,
bool privacy_mode, bool storage_is_read_only);
virtual ~Cdm() {}
~Cdm() override {}
// The following three methods relate to service certificates. A service
// certificate holds the RSA public key for a server, as well as other fields
@@ -449,6 +467,9 @@ class CDM_EXPORT Cdm : public ITimerClient {
// and the license service should be used to make security decisions.
virtual Status getRobustnessLevel(RobustnessLevel* level) = 0;
// Query the underlying OEMCrypto implementation's System ID.
virtual Status getSystemId(uint32_t* id) = 0;
// Returns the resource rating tier of the device, as reported by OEMCrypto.
virtual Status getResourceRatingTier(uint32_t* tier) = 0;
@@ -456,10 +477,10 @@ class CDM_EXPORT Cdm : public ITimerClient {
// implementation.
virtual Status getOemCryptoBuildInfo(std::string* build_info) = 0;
// Determine if the device has a Device Certificate (for the current origin).
// The Device Certificate is origin-specific, and the origin is
// dertermined by the CDM's current IStorage object.
virtual bool isProvisioned() = 0;
// Retrieves the current provisioning status. The Device Certificate is
// origin-specific, and the origin is determined by the CDM's current IStorage
// object.
virtual ProvisioningStatus getProvisioningStatus() = 0;
// Creates a Provisioning Request message.
// This is used to provision the device. The request should be sent to the

View File

@@ -1,5 +1,25 @@
// Copyright 2015 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#define CDM_VERSION_STR_(x, y, z, w) #x "." #y "." #z w
#define CDM_VERSION_STR(x, y, z, w) CDM_VERSION_STR_(x, y, z, w)
// Widevine CE CDM Version
#ifndef CDM_VERSION
# define CDM_VERSION "16.4.0"
#ifndef CDM_VERSION_MAJOR
# define CDM_VERSION_MAJOR 17
#endif
#ifndef CDM_VERSION_MINOR
# define CDM_VERSION_MINOR 1
#endif
#ifndef CDM_VERSION_PATCH
# define CDM_VERSION_PATCH 0
#endif
#ifndef CDM_VERSION_TAG
# define CDM_VERSION_TAG ""
#endif
#define CDM_VERSION \
CDM_VERSION_STR(CDM_VERSION_MAJOR, CDM_VERSION_MINOR, CDM_VERSION_PATCH, \
CDM_VERSION_TAG)
#define EME_VERSION "https://www.w3.org/TR/2017/REC-encrypted-media-20170918"

View File

@@ -0,0 +1,42 @@
// Copyright 2022 Google LLC. All Rights Reserved. This file and proprietary
// source code may only be used and distributed under the Widevine License
// Agreement.
#ifndef WVCDM_CDM_COMPILER_DETECTION_H_
#define WVCDM_CDM_COMPILER_DETECTION_H_
// This file makes some best-effort attempts to detect details about the
// compilation environment used by CacheBuildInfo.
#if defined(CDM_DISABLE_LOGGING)
# define LOGGING_MESSAGE "Logging Disabled"
#else
# define LOGGING_MESSAGE "Logging Enabled"
#endif
#if defined(_DEBUG)
# define BUILD_FLAVOR_MESSAGE "Debug"
#elif defined(NDEBUG)
# define BUILD_FLAVOR_MESSAGE "Release"
#else
# define BUILD_FLAVOR_MESSAGE "Unknown"
#endif
#if defined(__x86_64__) || defined(_M_X64)
# define CPU_ARCH_MESSAGE "x86-64"
#elif defined(__i386__) || defined(_M_IX86)
# define CPU_ARCH_MESSAGE "i386"
#elif defined(__aarch64__) || defined(_M_ARM64)
# define CPU_ARCH_MESSAGE "AArch64"
#elif defined(__arm__) || defined(_M_ARM)
# define CPU_ARCH_MESSAGE "AArch32"
#elif defined(__mips__)
# define CPU_ARCH_MESSAGE "MIPS"
#elif defined(__powerpc64__)
# define CPU_ARCH_MESSAGE "64-bit PowerPC"
#elif defined(__powerpc__) || defined(_M_PPC)
# define CPU_ARCH_MESSAGE "32-bit PowerPC"
#else
# define CPU_ARCH_MESSAGE "Unrecognized CPU"
#endif
#endif // WVCDM_CDM_COMPILER_DETECTION_H_

View File

@@ -1,6 +1,6 @@
// 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.
// source code may only be used and distributed under the Widevine License
// Agreement.
#ifndef WVCDM_CDM_PROPERTIES_CE_H_
#define WVCDM_CDM_PROPERTIES_CE_H_
@@ -14,7 +14,6 @@ namespace widevine {
class PropertiesCE {
public:
static Cdm::ClientInfo GetClientInfo();
static Cdm::SecureOutputType GetSecureOutputType();
static void SetProvisioningMessagesAreBinary(bool bin_prov);
// If this is set to an empty string, (which is the default) then PropertiesCE
@@ -23,7 +22,6 @@ class PropertiesCE {
private:
static void SetSecureOutputType(Cdm::SecureOutputType secure_output_type);
static void SetClientInfo(const Cdm::ClientInfo& client_info);
friend class Cdm;
#if defined(UNIT_TEST)