Address review comments and sync branches

This CL merges some missed pieces of the merge from Widevine repo of
http://go/wvgerrit/93405

Test: unit tests
Bug: 147879734, 147396294, 141247171
Change-Id: I3b92b983f68f6a529f109bc5dec91b313e3fd7fb
This commit is contained in:
Fred Gylys-Colwell
2020-02-04 20:42:05 -08:00
parent 8f9e5d7bb2
commit a3477aab03
2 changed files with 41 additions and 29 deletions

View File

@@ -810,15 +810,18 @@ CdmResponseType CryptoSession::PrepareAndSignLicenseRequest(
OEMCryptoResult sts;
size_t signature_length = 0;
size_t core_message_length = 0;
*core_message = "";
std::string combined_message = *core_message + message;
// First call is intended to determine the required size of the
// output buffers.
WithOecSessionLock("PrepareAndSignLicenseRequest", [&] {
M_TIME(
sts = OEMCrypto_PrepAndSignLicenseRequest(
oec_session_id_,
reinterpret_cast<uint8_t*>(const_cast<char*>(message.data())),
message.size(), &core_message_length, nullptr, &signature_length),
metrics_, oemcrypto_prep_and_sign_license_request_, sts);
M_TIME(sts = OEMCrypto_PrepAndSignLicenseRequest(
oec_session_id_,
reinterpret_cast<uint8_t*>(
const_cast<char*>(combined_message.data())),
combined_message.size(), &core_message_length, nullptr,
&signature_length),
metrics_, oemcrypto_prep_and_sign_license_request_, sts);
});
if (OEMCrypto_ERROR_SHORT_BUFFER != sts) {
@@ -830,7 +833,7 @@ CdmResponseType CryptoSession::PrepareAndSignLicenseRequest(
core_message->resize(core_message_length);
signature->resize(signature_length);
std::string combined_message = *core_message + message;
combined_message = *core_message + message;
WithOecSessionLock("PrepareAndSignLicenseRequest", [&] {
M_TIME(sts = OEMCrypto_PrepAndSignLicenseRequest(
oec_session_id_,
@@ -940,15 +943,18 @@ CdmResponseType CryptoSession::PrepareAndSignRenewalRequest(
OEMCryptoResult sts;
size_t signature_length = 0;
size_t core_message_length = 0;
*core_message = "";
std::string combined_message = *core_message + message;
// First call is intended to determine the required size of the
// output buffers.
WithOecSessionLock("PrepareAndSignRenewalRequest", [&] {
M_TIME(
sts = OEMCrypto_PrepAndSignRenewalRequest(
oec_session_id_,
reinterpret_cast<uint8_t*>(const_cast<char*>(message.data())),
message.size(), &core_message_length, nullptr, &signature_length),
metrics_, oemcrypto_prep_and_sign_renewal_request_, sts);
M_TIME(sts = OEMCrypto_PrepAndSignRenewalRequest(
oec_session_id_,
reinterpret_cast<uint8_t*>(
const_cast<char*>(combined_message.data())),
combined_message.size(), &core_message_length, nullptr,
&signature_length),
metrics_, oemcrypto_prep_and_sign_renewal_request_, sts);
});
if (OEMCrypto_ERROR_SHORT_BUFFER != sts) {
@@ -960,7 +966,7 @@ CdmResponseType CryptoSession::PrepareAndSignRenewalRequest(
core_message->resize(core_message_length);
signature->resize(signature_length);
std::string combined_message = *core_message + message;
combined_message = *core_message + message;
WithOecSessionLock("PrepareAndSignRenewalRequest", [&] {
M_TIME(sts = OEMCrypto_PrepAndSignRenewalRequest(
oec_session_id_,
@@ -1059,15 +1065,18 @@ CdmResponseType CryptoSession::PrepareAndSignProvisioningRequest(
OEMCryptoResult sts;
size_t signature_length = 0;
size_t core_message_length = 0;
*core_message = "";
std::string combined_message = *core_message + message;
// First call is intended to determine the required size of the
// output buffers.
WithOecSessionLock("PrepareAndSignProvisioningRequest", [&] {
M_TIME(
sts = OEMCrypto_PrepAndSignProvisioningRequest(
oec_session_id_,
reinterpret_cast<uint8_t*>(const_cast<char*>(message.data())),
message.size(), &core_message_length, nullptr, &signature_length),
metrics_, oemcrypto_prep_and_sign_provisioning_request_, sts);
M_TIME(sts = OEMCrypto_PrepAndSignProvisioningRequest(
oec_session_id_,
reinterpret_cast<uint8_t*>(
const_cast<char*>(combined_message.data())),
combined_message.size(), &core_message_length, nullptr,
&signature_length),
metrics_, oemcrypto_prep_and_sign_provisioning_request_, sts);
});
if (OEMCrypto_ERROR_SHORT_BUFFER != sts) {
@@ -1079,7 +1088,7 @@ CdmResponseType CryptoSession::PrepareAndSignProvisioningRequest(
core_message->resize(core_message_length);
signature->resize(signature_length);
std::string combined_message = *core_message + message;
combined_message = *core_message + message;
WithOecSessionLock("PrepareAndSignProvisioningRequest", [&] {
M_TIME(sts = OEMCrypto_PrepAndSignProvisioningRequest(
oec_session_id_,