Add support for SRM
[ Merge of http://go/wvgerrit/22980 ] System Renewability Messages (SRM) contains a list of Key Selection Vectors, which are HDCP Identifiers that have been revoked. During HDCP negotiations a transmitter may authenticate a receiver and verify that its unique identier is not present in the SRM. This CL enables reporting of the current SRM version and whether SRM updates are supported. It also loads SRM updates in the license and specifies SRM version requirements when keys are loaded. Test: All unittests other than some oemcrypto, request_license_test passed. Those tests failed with or without this CL. b/28955520 Change-Id: Id840078ea2deb01d9619c1cd8d367b50452f76cc
This commit is contained in:
@@ -460,7 +460,8 @@ CdmResponseType CryptoSession::LoadKeys(
|
||||
const std::string& message, const std::string& signature,
|
||||
const std::string& mac_key_iv, const std::string& mac_key,
|
||||
const std::vector<CryptoKey>& keys,
|
||||
const std::string& provider_session_token) {
|
||||
const std::string& provider_session_token,
|
||||
const std::string& srm_requirement) {
|
||||
LOGV("CryptoSession::LoadKeys: Lock");
|
||||
AutoLock auto_lock(crypto_lock_);
|
||||
|
||||
@@ -501,13 +502,15 @@ CdmResponseType CryptoSession::LoadKeys(
|
||||
pst =
|
||||
const_cast<uint8_t*>(msg) + GetOffset(message, provider_session_token);
|
||||
}
|
||||
uint8_t* srm_req = NULL;
|
||||
if (!srm_requirement.empty())
|
||||
srm_req = const_cast<uint8_t*>(msg) + GetOffset(message, srm_requirement);
|
||||
LOGV("LoadKeys: id=%ld", (uint32_t)oec_session_id_);
|
||||
OEMCryptoResult sts = OEMCrypto_LoadKeys(
|
||||
oec_session_id_, msg, message.size(),
|
||||
reinterpret_cast<const uint8_t*>(signature.data()), signature.size(),
|
||||
enc_mac_key_iv, enc_mac_key, keys.size(), &load_keys[0], pst,
|
||||
provider_session_token.length(),
|
||||
NULL); // TODO(rfrias): http://b/28955520
|
||||
provider_session_token.length(), srm_req);
|
||||
|
||||
if (OEMCrypto_SUCCESS == sts) {
|
||||
if (!provider_session_token.empty()) {
|
||||
@@ -1213,6 +1216,45 @@ bool CryptoSession::GetMaxNumberOfSessions(size_t* max) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CryptoSession::GetSrmVersion(uint16_t* srm_version) {
|
||||
LOGV("GetSrmVersion");
|
||||
if (!initialized_) return false;
|
||||
if (srm_version == NULL) {
|
||||
LOGE("CryptoSession::GetSrmVersion: |srm_version| cannot be NULL");
|
||||
return false;
|
||||
}
|
||||
|
||||
OEMCryptoResult status = OEMCrypto_GetCurrentSRMVersion(srm_version);
|
||||
if (OEMCrypto_SUCCESS != status) {
|
||||
LOGW("OEMCrypto_GetCurrentSRMVersion fails with %d", status);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CryptoSession::IsSrmUpdateSupported() {
|
||||
LOGV("IsSrmUpdateSupported");
|
||||
if (!initialized_) return false;
|
||||
return OEMCrypto_IsSRMUpdateSupported();
|
||||
}
|
||||
|
||||
bool CryptoSession::LoadSrm(const std::string& srm) {
|
||||
LOGV("LoadSrm");
|
||||
if (!initialized_) return false;
|
||||
if (srm.empty()) {
|
||||
LOGE("CryptoSession::LoadSrm: |srm| cannot be empty");
|
||||
return false;
|
||||
}
|
||||
|
||||
OEMCryptoResult status = OEMCrypto_LoadSRM(
|
||||
reinterpret_cast<const uint8_t*>(srm.data()), srm.size());
|
||||
if (OEMCrypto_SUCCESS != status) {
|
||||
LOGW("OEMCrypto_LoadSRM fails with %d", status);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
CdmResponseType CryptoSession::GenericEncrypt(const std::string& in_buffer,
|
||||
const std::string& key_id,
|
||||
const std::string& iv,
|
||||
|
||||
Reference in New Issue
Block a user