This change incorporates the following CLs from the Widevine
cdm repository:
Update the java request/response test app to match Drm API changes
Don't build the mock liboemcrypto.so by default
Do not build CDM tests by default
Fix Build Break in DrmEngine Unit Tests
Fix Build Break in WVDrmPlugin
Initial version of roadmap for CDM projects.
Implement License Query
Implement Generic DRM in OEMCrypto Reference Implementation
Add key_data_length field when calling OEMCrypto_LoadKeys
Policy engine unittests
Generalized DRM API for OEMCrypto
Fixes proto buf libraries build.
Add Version Number to OEMCrypto API
Test key control block duration field in OEMCrypto
Add fix for missing crypto offset.
Fixed android/media*/test builds and added proto files for Cert. provisioning
Refactor and clean up callback code in CDM.
Add "device_id" name-value pair to LicenseRequest::ClientIdentification
Separate unit and end-to-end tests from the top level makefie.
Includes changes for 'fall back to l3 oemcrypto lib' in top level makefile.
Fall Back to Level 3 if Level 1 Fails
Fix compilation error in wvcdm_unittest.
Fix Android build break due to Decrypt() signature change in cdm_engine.h.
Wire up callbacks and errors in the Steel proxy.
Fix lock assert if there is no keybox on the device.
RSA Certificate Unit Test
Change Generic_Verify signature to constant.
Change-Id: I2e42db9d0b4f8d4e833675ae81d0714509bbfd2c
64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
// Copyright 2012 Google Inc. All Rights Reserved.
|
|
//
|
|
// OEMCrypto Client - wrapper class for C-style OEMCrypto interface
|
|
//
|
|
#ifndef CDM_BASE_CRYPTO_ENGINE_H_
|
|
#define CDM_BASE_CRYPTO_ENGINE_H_
|
|
|
|
#include "crypto_session.h"
|
|
#include "lock.h"
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
typedef std::map<CdmSessionId,CryptoSession*> CryptoSessionMap;
|
|
|
|
class CryptoEngine {
|
|
|
|
friend class CryptoSession;
|
|
|
|
private:
|
|
|
|
CryptoEngine();
|
|
~CryptoEngine();
|
|
|
|
public:
|
|
|
|
// get an instance of Crypto engine
|
|
static CryptoEngine* GetInstance();
|
|
|
|
bool Init();
|
|
bool Terminate();
|
|
bool ValidateKeybox();
|
|
|
|
CryptoSession* CreateSession(const CdmSessionId& session_id);
|
|
CryptoSession* FindSession(const CdmSessionId& session_id);
|
|
bool DestroySession(const CdmSessionId& session_id);
|
|
bool DestroySessions();
|
|
|
|
bool GetToken(std::string* token);
|
|
|
|
CdmResponseType Query(CdmQueryMap* info);
|
|
|
|
private:
|
|
|
|
void DeleteInstance();
|
|
static CryptoEngine* CreateSingleton();
|
|
|
|
CryptoSession* FindSessionInternal(const CdmSessionId& session_id);
|
|
|
|
static CryptoEngine* crypto_engine_;
|
|
static Lock crypto_engine_lock_;
|
|
|
|
bool initialized_;
|
|
mutable Lock crypto_lock_;
|
|
mutable Lock sessions_lock_;
|
|
CryptoSessionMap sessions_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoEngine);
|
|
};
|
|
|
|
}; // namespace wvcdm
|
|
|
|
#endif // CDM_BASE_CRYPTO_ENGINE_H_
|