Add decrypt hash support

[ Merge of http://go/wvgerrit/68083 ]

Add ability to query decrypt hash support, set a hash computed over a frame
and retrieve the last error at a later point.

Bug: 34080802
Test: WV unit/integration tests. New tests added to cdm_engine_test,
      libwvdrmdrmplugin_hidl_test and request_license_test.

Change-Id: I7548c8798c873a6af3e1cfc0df57c117e1e474a6
This commit is contained in:
Rahul Frias
2018-12-12 02:04:26 -08:00
parent d44a8016ad
commit 589a3cf27e
21 changed files with 601 additions and 10 deletions

View File

@@ -274,6 +274,16 @@ class CdmEngine {
virtual size_t SessionSize() const { return session_map_.Size(); }
static CdmResponseType ParseDecryptHashString(const std::string& hash_string,
CdmSessionId* id,
uint32_t* frame_number,
std::string* hash);
virtual CdmResponseType SetDecryptHash(const CdmSessionId& session_id,
uint32_t frame_number,
const std::string& hash);
virtual CdmResponseType GetDecryptHashError(const CdmSessionId& session_id,
std::string* hash_error_string);
// Is the key known to any session?
virtual bool IsKeyLoaded(const KeyId& key_id);
virtual bool FindSessionForKey(const KeyId& key_id, CdmSessionId* sessionId);

View File

@@ -193,6 +193,11 @@ class CdmSession {
CdmSigningAlgorithm algorithm,
const std::string& signature);
virtual CdmResponseType SetDecryptHash(uint32_t frame_number,
const std::string& hash);
virtual CdmResponseType GetDecryptHashError(std::string* hash_error_string);
virtual metrics::SessionMetrics* GetMetrics() { return metrics_; }
private:

View File

@@ -152,6 +152,14 @@ class CryptoSession {
virtual bool GetResourceRatingTier(uint32_t* tier);
virtual bool GetBuildInformation(std::string* info);
virtual uint32_t IsDecryptHashSupported();
virtual CdmResponseType SetDecryptHash(uint32_t frame_number,
const std::string& hash);
virtual CdmResponseType GetDecryptHashError(std::string* error_string);
virtual CdmResponseType GenericEncrypt(const std::string& in_buffer,
const std::string& key_id,
const std::string& iv,

View File

@@ -82,6 +82,8 @@ static const std::string QUERY_KEY_WVCDM_VERSION = "WidevineCdmVersion";
static const std::string QUERY_KEY_RESOURCE_RATING_TIER = "ResourceRatingTier";
static const std::string QUERY_KEY_OEMCRYPTO_BUILD_INFORMATION =
"OemCryptoBuildInformation";
static const std::string QUERY_KEY_DECRYPT_HASH_SUPPORT =
"DecryptHashSupport";
static const std::string QUERY_VALUE_TRUE = "True";
static const std::string QUERY_VALUE_FALSE = "False";

View File

@@ -338,6 +338,10 @@ enum CdmResponseType {
DEVICE_CANNOT_REPROVISION = 293,
SESSION_NOT_FOUND_19 = 294,
KEY_SIZE_ERROR_2 = 295,
SET_DECRYPT_HASH_ERROR = 296,
GET_DECRYPT_HASH_ERROR = 297,
SESSION_NOT_FOUND_20 = 298,
INVALID_DECRYPT_HASH_FORMAT = 299,
// Don't forget to add new values to ../test/test_printers.cpp.
};