OEMCrypto v16.1
Merge of http://go/wvgerrit/93404 This CL updates the Widevine CDM to support OEMCrypto v16.1 Test: Tested in 16.2 CL Bug: 141247171 Change-Id: I69bd993500f6fb63bf6010c8b0250dc7acc3d71b
This commit is contained in:
@@ -31,6 +31,9 @@ typedef std::map<SessionId, SessionContext*> ActiveSessions;
|
||||
|
||||
class CryptoEngine {
|
||||
public:
|
||||
static const uint32_t kApiVersion = 16;
|
||||
static const uint32_t kMinorApiVersion = 0;
|
||||
|
||||
// This is like a factory method, except we choose which version to use at
|
||||
// compile time. It is defined in several source files. The build system
|
||||
// should choose which one to use by only linking in the correct one.
|
||||
@@ -87,12 +90,11 @@ class CryptoEngine {
|
||||
return kMaxSupportedOEMCryptoSessions;
|
||||
}
|
||||
|
||||
time_t OnlineTime();
|
||||
// The OEMCrypto system time. Prevents time rollback.
|
||||
// TODO(b/145836634): Combine RollbackCorrectedOfflineTime with OnlineTime().
|
||||
int64_t SystemTime() { return RollbackCorrectedOfflineTime(); }
|
||||
|
||||
time_t RollbackCorrectedOfflineTime();
|
||||
|
||||
// Verify that this nonce does not collide with another nonce in any session's
|
||||
// nonce table.
|
||||
// Verify that this nonce does not collide with another nonce in any session.
|
||||
virtual bool NonceCollision(uint32_t nonce);
|
||||
|
||||
// Returns the HDCP version currently in use.
|
||||
@@ -133,12 +135,15 @@ class CryptoEngine {
|
||||
return OEMCrypto_Keybox;
|
||||
}
|
||||
|
||||
virtual OEMCryptoResult get_oem_certificate(SessionContext* session,
|
||||
uint8_t* public_cert,
|
||||
virtual OEMCryptoResult get_oem_certificate(uint8_t* public_cert,
|
||||
size_t* public_cert_length) {
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
virtual OEMCryptoResult load_oem_private_key(SessionContext* session) {
|
||||
return OEMCrypto_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
// Used for OEMCrypto_IsAntiRollbackHwPresent.
|
||||
virtual bool config_is_anti_rollback_hw_present() { return false; }
|
||||
|
||||
@@ -150,14 +155,14 @@ class CryptoEngine {
|
||||
// been applied to the device that fixes a security bug.
|
||||
virtual uint8_t config_security_patch_level() { return 0; }
|
||||
|
||||
// If 0 no restriction, otherwise it's the max buffer for DecryptCENC.
|
||||
// This is the same as the max subsample size, not the sample or frame size.
|
||||
virtual size_t max_buffer_size() { return 1024 * 100; } // 100 KiB.
|
||||
// If 0 no restriction, otherwise it's the max subsample size for
|
||||
// DecryptCENC. This is not the same as the max sample or buffer size.
|
||||
virtual size_t max_subsample_size() { return 1024 * 100; } // 100 KiB
|
||||
|
||||
// If 0 no restriction, otherwise it's the max output buffer for DecryptCENC
|
||||
// and CopyBuffer. This is the same as the max frame or sample size, not the
|
||||
// subsample size.
|
||||
virtual size_t max_output_size() { return 0; }
|
||||
// If 0 no restriction, otherwise it's the max sample size for DecryptCENC.
|
||||
// This is the same as the max input and output buffer size for DecryptCENC
|
||||
// and CopyBuffer. It is not the same as the max subsample size.
|
||||
virtual size_t max_sample_size() { return 1024 * 1024; } // 1 MiB
|
||||
|
||||
virtual bool srm_update_supported() { return false; }
|
||||
|
||||
@@ -176,8 +181,8 @@ class CryptoEngine {
|
||||
|
||||
virtual bool srm_blacklisted_device_attached() { return false; }
|
||||
|
||||
// Rate limit for nonce generation. Default to 20 nonce/second.
|
||||
virtual int nonce_flood_count() { return 20; }
|
||||
// Rate limit for nonce generation. Default to 200 nonce/second.
|
||||
virtual int nonce_flood_count() { return 200; }
|
||||
|
||||
// Limit for size of usage table. If this is zero, then the
|
||||
// size is unlimited -- or limited only by memory size.
|
||||
@@ -186,24 +191,32 @@ class CryptoEngine {
|
||||
virtual uint32_t resource_rating() { return 1; }
|
||||
|
||||
// Set destination pointer based on the output destination description.
|
||||
OEMCryptoResult SetDestination(OEMCrypto_DestBufferDesc* out_description,
|
||||
size_t data_length, uint8_t subsample_flags);
|
||||
OEMCryptoResult SetDestination(
|
||||
const OEMCrypto_DestBufferDesc& out_description, size_t data_length,
|
||||
uint8_t subsample_flags);
|
||||
|
||||
// The current destination.
|
||||
uint8_t* destination() { return destination_; }
|
||||
|
||||
// Subclasses can adjust the destination -- for use in testing.
|
||||
virtual void adjust_destination(OEMCrypto_DestBufferDesc* out_description,
|
||||
size_t data_length, uint8_t subsample_flags) {
|
||||
}
|
||||
virtual void adjust_destination(
|
||||
const OEMCrypto_DestBufferDesc& out_description, size_t data_length,
|
||||
uint8_t subsample_flags) {}
|
||||
|
||||
// Push destination buffer to output -- used by subclasses for testing.
|
||||
virtual OEMCryptoResult PushDestination(
|
||||
OEMCrypto_DestBufferDesc* out_description, uint8_t subsample_flags) {
|
||||
const OEMCrypto_DestBufferDesc& out_description,
|
||||
uint8_t subsample_flags) {
|
||||
return OEMCrypto_SUCCESS;
|
||||
}
|
||||
|
||||
protected:
|
||||
// System clock, measuring time in seconds.
|
||||
int64_t OnlineTime();
|
||||
|
||||
// System clock with antirollback protection, measuring time in seconds.
|
||||
int64_t RollbackCorrectedOfflineTime();
|
||||
|
||||
explicit CryptoEngine(std::unique_ptr<wvcdm::FileSystem>&& file_system);
|
||||
virtual SessionContext* MakeSession(SessionId sid);
|
||||
virtual UsageTable* MakeUsageTable();
|
||||
|
||||
Reference in New Issue
Block a user