Merge OEMCrypto KDF and usage functions
Since KDF functions are only used right before specific functions, this merges them to simplify internal state within OEMCrypto. Fixes: 299527712 Change-Id: I426cfcdc102bd73cf65cd809b213da2474f44b34
This commit is contained in:
committed by
Robert Shih
parent
b04fda2908
commit
488a4647db
@@ -585,10 +585,6 @@ CdmResponseType CdmLicense::HandleKeyResponse(
|
||||
LOGE("Signed response has no session keys present");
|
||||
return CdmResponseType(SESSION_KEYS_NOT_FOUND);
|
||||
}
|
||||
CdmResponseType status = crypto_session_->GenerateDerivedKeys(
|
||||
key_request_, signed_response.session_key());
|
||||
|
||||
if (status != NO_ERROR) return status;
|
||||
|
||||
// Extract mac key
|
||||
std::string mac_key_iv;
|
||||
@@ -655,18 +651,19 @@ CdmResponseType CdmLicense::HandleKeyResponse(
|
||||
}
|
||||
|
||||
// If the field is not set, it will default to false.
|
||||
status =
|
||||
CdmResponseType status =
|
||||
crypto_session_->UseSecondaryKey(signed_response.using_secondary_key());
|
||||
if (status != NO_ERROR) return status;
|
||||
|
||||
CdmResponseType resp(NO_CONTENT_KEY);
|
||||
if (kLicenseKeyTypeEntitlement == key_type) {
|
||||
resp =
|
||||
HandleEntitlementKeyResponse(is_restore, signed_message, core_message,
|
||||
signature, key_array, license);
|
||||
resp = HandleEntitlementKeyResponse(
|
||||
is_restore, signed_response.session_key(), signed_message, core_message,
|
||||
signature, key_array, license);
|
||||
} else if (kLicenseKeyTypeContent == key_type) {
|
||||
resp = HandleContentKeyResponse(is_restore, signed_message, core_message,
|
||||
signature, key_array, license);
|
||||
resp = HandleContentKeyResponse(is_restore, signed_response.session_key(),
|
||||
signed_message, core_message, signature,
|
||||
key_array, license);
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
@@ -1086,15 +1083,17 @@ CdmResponseType CdmLicense::PrepareContentId(
|
||||
}
|
||||
|
||||
CdmResponseType CdmLicense::HandleContentKeyResponse(
|
||||
bool is_restore, const std::string& msg, const std::string& core_message,
|
||||
const std::string& signature, const std::vector<CryptoKey>& key_array,
|
||||
bool is_restore, const std::string& session_key, const std::string& msg,
|
||||
const std::string& core_message, const std::string& signature,
|
||||
const std::vector<CryptoKey>& key_array,
|
||||
const video_widevine::License& license) {
|
||||
if (key_array.empty()) {
|
||||
LOGE("No content keys provided");
|
||||
return CdmResponseType(NO_CONTENT_KEY);
|
||||
}
|
||||
const CdmResponseType resp = crypto_session_->LoadLicense(
|
||||
msg, core_message, signature, kLicenseKeyTypeContent);
|
||||
const CdmResponseType resp =
|
||||
crypto_session_->LoadLicense(key_request_, session_key, msg, core_message,
|
||||
signature, kLicenseKeyTypeContent);
|
||||
if (KEY_ADDED == resp) {
|
||||
loaded_keys_.clear();
|
||||
for (const CryptoKey& key : key_array) {
|
||||
@@ -1106,15 +1105,17 @@ CdmResponseType CdmLicense::HandleContentKeyResponse(
|
||||
}
|
||||
|
||||
CdmResponseType CdmLicense::HandleEntitlementKeyResponse(
|
||||
bool is_restore, const std::string& msg, const std::string& core_message,
|
||||
const std::string& signature, const std::vector<CryptoKey>& key_array,
|
||||
bool is_restore, const std::string& session_key, const std::string& msg,
|
||||
const std::string& core_message, const std::string& signature,
|
||||
const std::vector<CryptoKey>& key_array,
|
||||
const video_widevine::License& license) {
|
||||
if (key_array.empty()) {
|
||||
LOGE("No entitlement keys provided");
|
||||
return CdmResponseType(NO_CONTENT_KEY);
|
||||
}
|
||||
const CdmResponseType resp = crypto_session_->LoadLicense(
|
||||
msg, core_message, signature, kLicenseKeyTypeEntitlement);
|
||||
const CdmResponseType resp =
|
||||
crypto_session_->LoadLicense(key_request_, session_key, msg, core_message,
|
||||
signature, kLicenseKeyTypeEntitlement);
|
||||
|
||||
if (KEY_ADDED != resp) {
|
||||
return resp;
|
||||
|
||||
Reference in New Issue
Block a user