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);
|
||||
}
|
||||
|
||||
// Get/set the nonce. This value will be reflected in the Key Control Block
|
||||
// of the license response.
|
||||
uint32_t nonce;
|
||||
CdmResponseType status = crypto_session_->GenerateNonce(&nonce);
|
||||
|
||||
switch (status) {
|
||||
case NO_ERROR:
|
||||
break;
|
||||
case SESSION_LOST_STATE_ERROR:
|
||||
case SYSTEM_INVALIDATED_ERROR:
|
||||
return status;
|
||||
default:
|
||||
return LICENSE_RENEWAL_NONCE_GENERATION_ERROR;
|
||||
uint32_t api_version = 0;
|
||||
if (!crypto_session_->GetApiVersion(&api_version)) {
|
||||
LOGW("Unknown API Version");
|
||||
api_version = 15;
|
||||
}
|
||||
uint32_t nonce = 0;
|
||||
if (api_version < 16) {
|
||||
// For a pre-v16 license, get/set the nonce. This value will be reflected
|
||||
// in the Key Control Block of the license response.
|
||||
const CdmResponseType status = crypto_session_->GenerateNonce(&nonce);
|
||||
switch (status) {
|
||||
case NO_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);
|
||||
LOGD("nonce = %u", nonce);
|
||||
@@ -482,7 +488,7 @@ CdmResponseType CdmLicense::PrepareKeyUpdateRequest(
|
||||
// Construct signature and core message.
|
||||
std::string core_message;
|
||||
std::string license_request_signature;
|
||||
status = crypto_session_->PrepareAndSignRenewalRequest(
|
||||
const CdmResponseType status = crypto_session_->PrepareAndSignRenewalRequest(
|
||||
serialized_license_req, &core_message, &license_request_signature);
|
||||
if (status != NO_ERROR) return status;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user