Correct request_license_test failures

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

* While deprecating keyboxes as identification, some code to
  restore a license was mistakenly removed in http:://go/wvgerrit/36740,
  http://ag/3442777

* Corrections to keep track of cipher mode, call SelectKeys when cipher
  mode changes and to use the backward compatible LoadKeys call in case
  OEMCrypto is v13.

Bug: 70160032

Test: Ran WV unit/integration tests. Request license test failures
      have been addressed.

Change-Id: Id03c50874085af6d9985d10c19a74a02efb7a1f5
This commit is contained in:
Rahul Frias
2018-01-31 00:19:00 -08:00
parent 51212b1505
commit d9d53dee3b
7 changed files with 279 additions and 33 deletions

View File

@@ -10,7 +10,9 @@ class ContentKeySession : public KeySession {
public:
ContentKeySession(CryptoSessionId oec_session_id,
metrics::CryptoMetrics* metrics)
: KeySession(metrics), oec_session_id_(oec_session_id) {}
: KeySession(metrics),
oec_session_id_(oec_session_id),
cipher_mode_(kCipherModeCtr) {}
virtual ~ContentKeySession() {}
KeySessionType Type() { return kDefault; }
@@ -32,7 +34,7 @@ class ContentKeySession : public KeySession {
CdmCipherMode* cipher_mode,
const std::string& srm_requirement);
OEMCryptoResult LoadEntitledContentKeys(const std::vector<CryptoKey>& keys) {
OEMCryptoResult LoadEntitledContentKeys(const std::vector<CryptoKey>&) {
return OEMCrypto_ERROR_INVALID_CONTEXT;
}
@@ -56,8 +58,9 @@ class ContentKeySession : public KeySession {
private:
KeyId cached_key_id_;
CdmCipherMode cipher_mode_;
};
} // namespace wvcdm
#endif // WVCDM_CORE_CONTENT_KEY_SESSSION_H_
#endif // WVCDM_CORE_CONTENT_KEY_SESSSION_H_

View File

@@ -29,6 +29,7 @@ void GenerateMacContext(const std::string& input_context,
void GenerateEncryptContext(const std::string& input_context,
std::string* deriv_context);
size_t GetOffset(std::string message, std::string field);
OEMCryptoCipherMode ToOEMCryptoCipherMode(CdmCipherMode cipher_mode);
class CryptoSession {
public:
@@ -272,8 +273,6 @@ class CryptoSession {
bool is_destination_buffer_type_valid_;
SecurityLevel requested_security_level_;
KeyId cached_key_id_;
bool is_usage_support_type_valid_;
CdmUsageSupportType usage_support_type_;
UsageTableHeader* usage_table_header_;
@@ -284,6 +283,7 @@ class CryptoSession {
static uint64_t request_id_index_;
CdmCipherMode cipher_mode_;
uint32_t api_version_;
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoSession);
};