Files
android/libwvdrmengine/cdm/core/include/crypto_engine.h
Jeff Tinker f2afd99431 Add Property for Provisioning ID
Adds a property that allows applications to get the provisioning-unique serial
number.

Bug: 9175567

Also fixes some missing mutexes that were causing intermittent failures in
calls to OEMCrypto due to concurrency issues.

Bug: 9175583

Merge of https://widevine-internal-review.googlesource.com/#/c/5831/
from the Widevine CDM repository

Change-Id: I1d7e3ca9f3b06da345022f5f0d64e0c17a5cedca
2013-05-30 11:55:25 -07:00

78 lines
1.6 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 <stdint.h>
#include <map>
#include <string>
#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);
typedef enum {
kSecurityLevelL1,
kSecurityLevelL2,
kSecurityLevelL3,
kSecurityLevelUnknown
} SecurityLevel;
SecurityLevel GetSecurityLevel();
bool GetDeviceUniqueId(std::string* deviceId);
bool GetSystemId(uint32_t* systemId);
bool GetProvisioningId(std::string* provisioningId);
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_