Fix nonce problem in license renewal
Merge from Widevine repo of http://go/wvgerrit/94523 For OEMCrypto v16, a renewal does not get a new nonce. Bug: 149856581 Test: WvCdmRequestLicenseTest.StreamingLicenseRenewal Change-Id: I258f0bcb9c9a417310785f130d32d66fa7430185
This commit is contained in:
@@ -457,19 +457,25 @@ CdmResponseType CdmLicense::PrepareKeyUpdateRequest(
|
|||||||
current_license->set_seconds_since_last_played(seconds_since_last_played);
|
current_license->set_seconds_since_last_played(seconds_since_last_played);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get/set the nonce. This value will be reflected in the Key Control Block
|
uint32_t api_version = 0;
|
||||||
// of the license response.
|
if (!crypto_session_->GetApiVersion(&api_version)) {
|
||||||
uint32_t nonce;
|
LOGW("Unknown API Version");
|
||||||
CdmResponseType status = crypto_session_->GenerateNonce(&nonce);
|
api_version = 15;
|
||||||
|
}
|
||||||
switch (status) {
|
uint32_t nonce = 0;
|
||||||
case NO_ERROR:
|
if (api_version < 16) {
|
||||||
break;
|
// For a pre-v16 license, get/set the nonce. This value will be reflected
|
||||||
case SESSION_LOST_STATE_ERROR:
|
// in the Key Control Block of the license response.
|
||||||
case SYSTEM_INVALIDATED_ERROR:
|
const CdmResponseType status = crypto_session_->GenerateNonce(&nonce);
|
||||||
return status;
|
switch (status) {
|
||||||
default:
|
case NO_ERROR:
|
||||||
return LICENSE_RENEWAL_NONCE_GENERATION_ERROR;
|
break;
|
||||||
|
case SESSION_LOST_STATE_ERROR:
|
||||||
|
case SYSTEM_INVALIDATED_ERROR:
|
||||||
|
return status;
|
||||||
|
default:
|
||||||
|
return LICENSE_RENEWAL_NONCE_GENERATION_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
license_request.set_key_control_nonce(nonce);
|
license_request.set_key_control_nonce(nonce);
|
||||||
LOGD("nonce = %u", nonce);
|
LOGD("nonce = %u", nonce);
|
||||||
@@ -482,7 +488,7 @@ 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;
|
||||||
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);
|
||||||
if (status != NO_ERROR) return status;
|
if (status != NO_ERROR) return status;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user