Remove hash algorithm from renewal requests am: 340810f77f
Original change: https://googleplex-android-review.googlesource.com/c/platform/vendor/widevine/+/21589311 Change-Id: I0803cf5e51c82d22df2707f59f1857f9c9c842cd Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -165,8 +165,7 @@ class CryptoSession {
|
|||||||
// Renewal request/responses
|
// Renewal request/responses
|
||||||
virtual CdmResponseType PrepareAndSignRenewalRequest(
|
virtual CdmResponseType PrepareAndSignRenewalRequest(
|
||||||
const std::string& message, std::string* core_message,
|
const std::string& message, std::string* core_message,
|
||||||
std::string* signature, bool& should_specify_algorithm,
|
std::string* signature);
|
||||||
OEMCrypto_SignatureHashAlgorithm& algorithm);
|
|
||||||
// V16 licenses.
|
// V16 licenses.
|
||||||
virtual CdmResponseType LoadRenewal(const std::string& signed_message,
|
virtual CdmResponseType LoadRenewal(const std::string& signed_message,
|
||||||
const std::string& core_message,
|
const std::string& core_message,
|
||||||
|
|||||||
@@ -1121,8 +1121,7 @@ CdmResponseType CryptoSession::LoadLicense(const std::string& signed_message,
|
|||||||
|
|
||||||
CdmResponseType CryptoSession::PrepareAndSignRenewalRequest(
|
CdmResponseType CryptoSession::PrepareAndSignRenewalRequest(
|
||||||
const std::string& message, std::string* core_message,
|
const std::string& message, std::string* core_message,
|
||||||
std::string* signature, bool& should_specify_algorithm,
|
std::string* signature) {
|
||||||
OEMCrypto_SignatureHashAlgorithm& algorithm) {
|
|
||||||
LOGV("Preparing and signing renewal request: id = %u", oec_session_id_);
|
LOGV("Preparing and signing renewal request: id = %u", oec_session_id_);
|
||||||
if (signature == nullptr) {
|
if (signature == nullptr) {
|
||||||
LOGE("Output parameter |signature| not provided");
|
LOGE("Output parameter |signature| not provided");
|
||||||
@@ -1134,19 +1133,6 @@ CdmResponseType CryptoSession::PrepareAndSignRenewalRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
OEMCryptoResult sts;
|
OEMCryptoResult sts;
|
||||||
WithOecSessionLock("GetSignatureHashAlgorithm", [&] {
|
|
||||||
sts = OEMCrypto_GetSignatureHashAlgorithm(oec_session_id_, &algorithm);
|
|
||||||
});
|
|
||||||
metrics_->oemcrypto_get_signature_hash_algorithm_.Increment(sts, algorithm);
|
|
||||||
if (sts == OEMCrypto_SUCCESS) {
|
|
||||||
should_specify_algorithm = true;
|
|
||||||
} else if (sts == OEMCrypto_ERROR_NOT_IMPLEMENTED) {
|
|
||||||
should_specify_algorithm = false;
|
|
||||||
} else {
|
|
||||||
return MapOEMCryptoResult(sts, GET_SIGNATURE_HASH_ALGORITHM_ERROR_2,
|
|
||||||
"PrepareAndSignRenewalRequest");
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t signature_length = 0;
|
size_t signature_length = 0;
|
||||||
size_t core_message_length = 0;
|
size_t core_message_length = 0;
|
||||||
*core_message = "";
|
*core_message = "";
|
||||||
|
|||||||
@@ -503,11 +503,8 @@ CdmResponseType CdmLicense::PrepareKeyUpdateRequest(
|
|||||||
// Construct signature and core message.
|
// Construct signature and core message.
|
||||||
std::string core_message;
|
std::string core_message;
|
||||||
std::string license_request_signature;
|
std::string license_request_signature;
|
||||||
bool should_specify_algorithm;
|
|
||||||
OEMCrypto_SignatureHashAlgorithm oec_algorithm = OEMCrypto_SHA1;
|
|
||||||
const CdmResponseType status = crypto_session_->PrepareAndSignRenewalRequest(
|
const CdmResponseType status = crypto_session_->PrepareAndSignRenewalRequest(
|
||||||
serialized_license_req, &core_message, &license_request_signature,
|
serialized_license_req, &core_message, &license_request_signature);
|
||||||
should_specify_algorithm, oec_algorithm);
|
|
||||||
if (status != NO_ERROR) return status;
|
if (status != NO_ERROR) return status;
|
||||||
|
|
||||||
if (license_request_signature.empty()) {
|
if (license_request_signature.empty()) {
|
||||||
@@ -521,14 +518,6 @@ CdmResponseType CdmLicense::PrepareKeyUpdateRequest(
|
|||||||
signed_message.set_signature(license_request_signature);
|
signed_message.set_signature(license_request_signature);
|
||||||
signed_message.set_msg(serialized_license_req);
|
signed_message.set_msg(serialized_license_req);
|
||||||
signed_message.set_oemcrypto_core_message(core_message);
|
signed_message.set_oemcrypto_core_message(core_message);
|
||||||
if (should_specify_algorithm) {
|
|
||||||
HashAlgorithmProto proto_algorithm =
|
|
||||||
HashAlgorithmProto::HASH_ALGORITHM_UNSPECIFIED;
|
|
||||||
if (!OecAlgorithmToProtoAlgorithm(oec_algorithm, proto_algorithm)) {
|
|
||||||
return CdmResponseType(UNSUPPORTED_SIGNATURE_HASH_ALGORITHM_2);
|
|
||||||
}
|
|
||||||
signed_message.set_hash_algorithm(proto_algorithm);
|
|
||||||
}
|
|
||||||
|
|
||||||
signed_message.SerializeToString(signed_request);
|
signed_message.SerializeToString(signed_request);
|
||||||
*server_url = server_url_;
|
*server_url = server_url_;
|
||||||
|
|||||||
Reference in New Issue
Block a user